#12945 closed bug (fixed)
attr throws exception in IE9 on Flash <object>s
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | 1.9 |
Component: | attributes | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
attr throws exception in IE9 on Flash <object>s
IE9 does not seem to have the method getAttribute on Flash <object>s.
I changed line 2321 from
ret = elem.getAttribute( name );
to
ret = elem.getAttribute ? elem.getAttribute(name) : null;
to make it work.
Triggered this bug in combination with Uploadify Flash and jquery.validate.
Change History (22)
comment:1 Changed 10 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
comment:3 Changed 10 years ago by
Replying to dmethvin:
#12977 is a duplicate of this ticket.
Here is my reduced test case
http://jsfiddle.net/Niphor/6Uh9j/
I have to import swfupload.js to make the swf work properly。
I don't know why you can't visit demo.swfupload.org,but i must use it's swf.
(IE just stop download the swf on googlecode,I don't know why...)
don't use Firebug Lite,it doesn't show anything on IE>=9 when the bug occurs.
it seems that the bug only happens when swf bind some js callback,or need trigger some js event,or something.
I haven't figured it out. Sorry.
comment:4 Changed 10 years ago by
Component: | unfiled → attributes |
---|---|
Milestone: | None → 1.9 |
Priority: | undecided → blocker |
Status: | pending → open |
Ok, thanks for the test case! I agree with the OP, it looks like Flash objects do not have getAttribute and we need to check for the method before trying to use it.
comment:5 Changed 10 years ago by
Priority: | blocker → high |
---|
comment:6 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Fix #12945. Check for .getAttribute so IE9 is happy.
Changeset: a95f35744aff95a446cc05e1d8c558b3a4867836
comment:7 Changed 10 years ago by
Ref #12945, IE9/10 still needs safe .getAttribute check.
Changeset: c0241a47e270cd0e0ac2b2a0fdefc5a3a15b5ae6
comment:8 Changed 10 years ago by
I think this may have broke the use of .attr('name') on xml elements.
comment:10 Changed 10 years ago by
The fix is not working on IE10
if ( typeof elem.getAttribute !== core_strundefined ) {
getAttribute is null, core_strundefined is undefined, they are unequal and we have got exception.
comment:11 Changed 10 years ago by
@anonymous, you're saying that elem.getAttribute
is null
? Do you have a test case?
comment:12 Changed 10 years ago by
i have this bug when using uploadify on ie9. this fix is not working. Anyone have a solution?
comment:13 Changed 10 years ago by
Go ask in the uploadify forum: http://www.uploadify.com/forum/#/categories/uploadify-bugs
If someone can come up with a test case we can look at it. And by that I mean a test case not using Uploadify.
comment:14 Changed 10 years ago by
I took a stab at this, and got passes on all BrowserStack IE9 and IE10 options: http://jsfiddle.net/L3wHg/2/.
It sure looks to me like Uploadify is doing something unusual, so we need someone to specifically identify the trigger and make a case for support.
comment:15 Changed 10 years ago by
I reproduced this issue too with swfupload.
For me the patch for this ticket is incomplete:
Current fix: if ( typeof elem.getAttribute !== "undefined" )
A valid and more bullet proof fix would have been:
if ( elem.getAttribute ) or if ( jQuery.isFunction(elem.getAttribute) )
comment:16 Changed 10 years ago by
Your solution wouldn't seem to work on IE 6/7/8. If you think there's still a problem and want to propose a fix, please create a new ticket with a reduced test case. A pull request with a unit test would be wonderful too, if you can come up with one, thanks!
comment:17 Changed 10 years ago by
Could this bug be reopened please? The same test (typeof elem.getAttribute !== core_strundefined) is causing problems in IE 6. Specifically, IE will return "unknown" instead of "undefined" for certain typeof operations and when that happens the test incorrectly succeeds.
I have changed the test to jQuery.isFunction(elem.getAttribute) as suggested by happypoulp and it seems to be working correctly.
Unfortunately I can't provide a static html test case, as I'm only getting the error in a complex page after some doing some ajax requests.
comment:18 follow-up: 19 Changed 10 years ago by
@paol: It won't do much good to reopen without a test case. We need some way to reproduce it.
comment:19 follow-up: 20 Changed 10 years ago by
Replying to timmywil: Unfortunately I can't create a static test case, as I said. Some spurious object is being left on the page (and I can't discover anything about it in debugging because every property of it seems to be unknown, even tagName).
However the "unknown" vs "undefined" problem in IE is widely known, and it's plain to see that the test being used in the code will not handle a return of "unknown" correctly. I think that is enough reason to correct the test.
comment:20 Changed 10 years ago by
Replying to paol:
However the "unknown" vs "undefined" problem in IE is widely known, and it's plain to see that the test being used in the code will not handle a return of "unknown" correctly. I think that is enough reason to correct the test.
If it's widely known, it ought to be widely reproducible. Please, update http://jsfiddle.net/L3wHg/2/ to demonstrate the behavior.
comment:21 Changed 10 years ago by
there is a same bug in:
acceptData: function( elem ) { var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; // nodes accept data unless otherwise specified; rejection can be conditional return !noData || noData !== true && elem.getAttribute("classid") === noData; }
comment:22 Changed 10 years ago by
I would also vote that this bug gets reopened. I see this bug using IE10 when a selector like '[data-provide="typeahead"]' is run and tries to get the attribute from a FLASH OBJECT.
This is the easiest way you can see the error: http://jsfiddle.net/L3wHg/6/ Click the 'select files' button, dismiss the dialog that opens, and note the errors from jQuery.
Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket. Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/. Open the link and click to "Fork" (in the top menu) to get started.