Side navigation
#7553 closed bug (duplicate)
Opened November 18, 2010 04:44PM UTC
Closed November 18, 2010 04:56PM UTC
Last modified November 18, 2010 04:56PM UTC
IE7 <object> element .getElementsByTagName behaves as if at document level, with workaround
Reported by: | http://psmay.com/ | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.5 |
Component: | unfiled | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
(A workaround can be implemented in jQuery to smooth this bug over, but it is not actually a defect with the library itself.)
At least IE7 has a bug with the combination of an <object/> element and the .getElementsByTagName() method. If one attempts to retrieve object.getElementsByTagName('param') (for example), the result is the list of ''all'' of the param elements in the entire document, not just descendants of that object element. This behavior is propagated by jQuery through e.g. $('object[name=...]').find('param') and $('object[name=...]').find('param[name=...]').
http://jsfiddle.net/kqaqh/6/ displays the bug in at least IE7 and works correctly in at least Firefox 3.6. It is really only visible in situations with multiple object elements. Two workarounds are also displayed as assigned to cparams and aparams. aparams is theoretically more complete as a solution, but cparams should cover many realistic cases. The library would have to special-case the find method for <object/> and any other affected elements, if any, to use the alternate approach.
How about this for a confirmation:
http://ejohn.org/blog/object-getelementsbytagname-ie7-bug/