Created
July 5, 2012 16:31
-
-
Save cwardzala/3054671 to your computer and use it in GitHub Desktop.
Modernizr.changeinputtype test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Use Modernizr to test if changing input.type is allowed in x browser. | |
* Based on supportsChangingTypeAttribute from http://lea.verou.me/2009/06/on-password-masking-and-usability/ | |
*/ | |
Modernizr.addTest('changeinputtype', function () { | |
var input = document.createElement('input'); | |
try { | |
input.type = 'password'; | |
input.type = 'text'; | |
} catch (e) { | |
return false; | |
} | |
return input.type == 'text'; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment