Ticket #4561 (closed enhancement: fixed)
IE seems to be case sensitive, please either document or enhance jQuery.attr()
|Reported by:||borg42||Owned by:|
|Keywords:||attr area map ie ie7 browser_dependent||Cc:|
Consider the following piece of code:
- IE7: red background, two attributes present on the BODY tag, imagemap broken
- FF3: yellow background, one attribute is present on the BODY tag, imagemap works
IE's being case sensitive here seems wrong for me. Anyway, as jQuery is a cross-browser library, it'd be great if it rendered the same result in these major browsers, or at least documented this caveat at attr().
Setting major prio instead of minor since this is an evil one (and no "normal" prio exists):
- It might affect a handful of attributes: className, httpEquiv, aLink, bgColor (confirmed), vLink, acceptCharset, tabIndex, accessKey, readOnly (seems not affected), useMap (confirmed), htmlFor, dateTime, isMap, codeBase, codeType, noHref, cellPadding, cellSpacing, chOff, vAlign, colSpan, noWrap, rowSpan, frameBorder, longDesc, marginHeight, marginWidth, noResize - and possibly others.
- attr() is a pretty widely used method, developers should know about its caveats. Even if one knows about the case sensitivity problem of setAttribute in IE, he/she can't know how exactly has jQuery implemented attr().
- When starting off with jQuery, attr() seems and behaves cross-browser, but apparently it's not, it's not exactly a nice surprise to learn that.
- It affects attribute useMap, and that might lead to false error repors regarding jQuery imagemap support.
Possible hint for a fix: http://msdn.microsoft.com/en-us/library/ms536429(VS.85,loband).aspx , parameter iFlags.
Using Windows XP SP2, IE 7.0.5730.13, FF 3.0.8, jQuery 1.3.2 min, XHTML doctype. Haven't tested in other IE versions and doctypes.
(For Googlers: if your dynamically generated image map doesn't work in ie7/ie, look for
and replace with
notice the case of the letter M. gotta love ie..)