Created
October 12, 2009 14:56
-
-
Save miketaylr/208473 to your computer and use it in GitHub Desktop.
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
attrTests: { | |
testAccept: function(_el) { | |
return !!(_el.accept === '') && !!(_el.accept !== 'undefined'); | |
}, | |
testAutocomplete: function(_el){ | |
return !!(_el.autocomplete === '') && !!(_el.autocomplete !== 'undefined'); | |
}, | |
testAutofocus: function(_el){ | |
return !!(_el.autofocus === false) && !!(_el.autofocus !== 'undefined'); | |
}, | |
testChecked: function(_el) { | |
return !!(_el.checked === false) && !!(_el.checekd !== 'undefined'); | |
}, | |
testList: function(_el){ | |
return !!(typeof _el.list === 'object') && !!(_el.list !== 'undefined'); | |
}, | |
testMax: function(_el){ | |
//feature test for validity object first | |
if (typeof _el.validity === 'object'){ | |
return !!(_el.validity.rangeOverflow === false); | |
} else { | |
return false; | |
} | |
}, | |
testMaxlength: function(_el) { | |
//webkit sets default maxlength to 524288, gecko and presto to -1 | |
return (!!(_el.maxLength === -1) || !!(_el.maxLength === 524288)) && !!(_el.maxLength !== 'undefined'); | |
}, | |
testMin: function(_el) { | |
//feature test for validity object first | |
if (typeof _el.validity === 'object'){ | |
return !!(_el.validity.rangeUnderflow === false); | |
} else { | |
return false; | |
} | |
}, | |
testMultiple: function(_el) { | |
return (!!(_el.multiple === false) && !!(_el.multiple !== 'undefined')); | |
}, | |
testPattern: function(_el) { | |
return !!(_el.pattern === '') && !!(_el.pattern !== 'undefined'); | |
}, | |
testPlaceholder: function(_el) { | |
return !!(_el.placeholder === '') && !!(_el.placeholder !== 'undefined'); | |
}, | |
testReadOnly: function(_el) { | |
return !!(_el.readOnly === false) && !!(_el.readOnly !== 'undefined'); | |
}, | |
testRequired: function(_el) { | |
return !!(_el.required === false) && !!(_el.required !== 'undefined'); | |
}, | |
testSize: function(_el) { | |
// webkit sets default size to 20, gecko and presto to 0 | |
return (!!(_el.size === 0) || !!(_el.size === 20)) && !!(_text.size !== 'undefined'); | |
}, | |
testStep: function(_el) { | |
//feature test for validity object first | |
if (typeof _el.validity === 'object'){ | |
return !!(_el.validity.stepMismatch === false); | |
} else { | |
return false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment