Coder Social home page Coder Social logo

IE8 bug about hideshowpassword HOT 4 CLOSED

cloudfour avatar cloudfour commented on June 17, 2024
IE8 bug

from hideshowpassword.

Comments (4)

tylersticka avatar tylersticka commented on June 17, 2024

@pixelthing Great catch, thanks!

It might not be the craziest idea to provide a fallback solution that toggles between separate <input type="text"> and <input type="password"> elements, in case IE < 9 is a requirement for someone. The plugin's simple enough that it seems like a shame for this one issue to prevent folks from using it in IE 8 entirely.

from hideshowpassword.

tylersticka avatar tylersticka commented on June 17, 2024

@pixelthing Just to give you an update, the replacement solution proved a bit untenable... it turns out you can't even read an <input> type property more than once in IE < 9, so it becomes really hard to maintain styles and attributes for duplicate elements.

The good news is that I've got a test working that seems to figure out if that feature is supported or not. The next major plugin update will use this to fail more gracefully, but in the meantime I thought I'd pass it along in case it's helpful for determining whether or not to enable the plugin:

var canSetInputAttribute = (function(){
  var body = document.body
    , input = document.createElement('input')
    , result = true;
  if (! body) {
    body = document.createElement('body');
  }
  input = body.appendChild(input);
  try {
    input.setAttribute('type', 'text');
  } catch (e) {
    result = false;
  }
  body.removeChild(input);
  return result;
}());

if (canSetInputAttribute) { /* hideShowPassword, etc. */ }

from hideshowpassword.

pixelthing avatar pixelthing commented on June 17, 2024

brilliant - much better feature detection than the method I was using...
thanks.

from hideshowpassword.

tylersticka avatar tylersticka commented on June 17, 2024

@pixelthing Just released version 2 of the plugin, and it should fail much more gracefully now without any additional checks.

from hideshowpassword.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.