Ticket #9833 (closed bug: wontfix)
`maxLength` property is buggy in IE8/IE9
|Reported by:||mathias||Owned by:|
Description (last modified by mathias) (diff)
IE≤8 has a .maxlength property on <textarea> elements instead of .maxLength. IE9 is even funnier and has none of these properties (!). Looks like we’re forced to fall back to .getAttribute() for that browser — I can’t think of any other solution.
propFix in jQuery maps $(el).prop('maxlength') to el.maxLength but that fails in IE8.
Test case: http://jsfiddle.net/mathias/Vc9ap/ tests $(el).prop('maxlength'), $(el).prop('maxLength'), and el.maxlength.
It should say 42,42,undefined. Results:
- IE8: undefined,undefined,42
- IE9: undefined,undefined,undefined (WTF)
- IE10 and others get it right.
In my code, I’m using something like el.maxLength || el.maxlength || el.getAttribute('maxlength') now. It seems jQuery should do the same.
- Cc addyosmani added
- Status changed from new to open
- Component changed from unfiled to attributes
- Description modified (diff)