Side navigation
#12863 closed bug (fixed)
Opened November 07, 2012 08:47PM UTC
Closed January 07, 2013 02:48AM UTC
behavior:url(#default#savehistory) causes event error on oldIE
Reported by: | dwilks | Owned by: | dmethvin |
---|---|---|---|
Priority: | high | Milestone: | 1.9 |
Component: | manipulation | Version: | 1.8.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
In IE8
- http://jsfiddle.net/ZpgGT/
- update jquery version as appropriate
- Run
Result: Object doesn't support this property or method.
The key conditions:
- body must have a change event
- the dynamically appended element must have an associated style with a behavior:url(#default#savehistory)
Full description at http://pdfcast.org/pdf/jquery-calendar-problem
(This is a re-post of the incorrectly closed #12178)
Attachments (0)
Change History (9)
Changed November 07, 2012 09:05PM UTC by comment:1
component: | unfiled → manipulation |
---|---|
milestone: | None → 1.9 |
priority: | undecided → high |
status: | new → open |
Changed November 07, 2012 10:17PM UTC by comment:2
@dmethvin: I don't think the Sizzle code is related. ;P
Changed November 07, 2012 10:22PM UTC by comment:3
@timmywil, I think it's the same basic problem, a simple falsy-check for elem.getAttribute
was calling it and here it seems to be elem.removeAttribute
instead.
Changed November 08, 2012 02:48AM UTC by comment:4
@dmethvin: The falsey check is on the return value of getAttribute("class")
rather than on the getAttribute
method itself. Wouldn't the code just fail if it tried to call a function that IE reports to be type "unknown"? I imagine that Sizzle still doesn't handle that issue.
I think you're thinking of the falsey check we used to use: if ( elem.getAttribute ) { ... }
Unfortunately, IE calls the method in XML (and some other edge cases) even without parens. There wasn't a performance loss in using typeof
, which never accidentally calls the method, so we switched to that. Your solution of a regex on typeof would work, but I'm not sure we want to add something like that.
I'm inclined to say this is not high priority. The behavior
property is proprietary IE and can most likely cause more problems than this.
Changed November 08, 2012 03:10AM UTC by comment:5
For the curious, it's on the order of +15 bytes gzipped.
Changed December 09, 2012 02:43PM UTC by comment:6
owner: | → dmethvin |
---|---|
status: | open → assigned |
Changed January 07, 2013 12:02AM UTC by comment:7
summary: | IE8 - Object doesn't support this property or method → behavior:url(#default#savehistory) causes event error on oldIE |
---|
Changed January 07, 2013 02:45AM UTC by comment:8
This did seem to be the same problem where .removeAttribute()
is being called, I changed to use a typeof
and the test case no longer fails. Unfortunately the setup is really complicated and involves the flakey focus events which are async in IE so I am having trouble creating a reliable unit test.
Still in -git:
https://github.com/jquery/jquery/blob/0ee94159023bebe1992c5281d0f4778b4f75ff0d/src/manipulation.js#L843
Seems that when a behavior is attached to an element,
typeof elem.removeAttribute === "unknown"
and the mere act of asking if the property exists causes it to call the method (incorrectly), similar to the problems that Sizzle works around here:https://github.com/jquery/sizzle/blob/5e6ae330a9ccb33fd343a0bdc73ed2b821767f9c/sizzle.js#L599
We'll need a trickier test like
!/undefined|unknown/.test( typeof elem.removeAttribute )
perhaps.