Side navigation
#10726 closed bug (fixed)
Opened November 08, 2011 08:25PM UTC
Closed July 25, 2012 08:06PM UTC
$(#document).closest('[foo]') throws error in IE
Reported by: | cwolves | Owned by: | timmywil |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | selector | Version: | |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Trying to access properties of what I think is a document fragment (nodeName === '#document' ) throws an error in IE:
Object doesn't support property or method 'getAttribute'
The code triggering this is $('iframe').contents().closest('[foo]')
Attachments (0)
Change History (8)
Changed November 08, 2011 08:26PM UTC by comment:1
Changed November 08, 2011 08:51PM UTC by comment:2
owner: | → cwolves |
---|---|
status: | new → pending |
Can you provide a simple reduced test case?
What is the use case for this? Closest is going to look up from the .contents() and that doesn't even seem useful.
Changed November 08, 2011 09:05PM UTC by comment:3
status: | pending → new |
---|
the $('iframe').contents()
piece is coming from a 3rd party plugin. I'm doing $node.closest('[foo]')
for a separate purpose, I'm just getting a #document node.
Changed November 08, 2011 09:16PM UTC by comment:4
component: | unfiled → traversing |
---|---|
priority: | undecided → low |
This may be related: https://github.com/jquery/sizzle/pull/79
Changed November 08, 2011 09:30PM UTC by comment:5
_comment0: | nope, that's a different issue. \ \ Simplified use case: \ \ $('<iframe></iframe>').appendTo(document.body).contents().get(0).attr('foo') → 1320787870773045 |
---|---|
_comment1: | nope, that's a different issue. \ \ Simplified use case: \ \ $('<iframe></iframe>').appendTo(document.body).contents().attr('foo') → 1320787917336996 |
nope, that's a different issue. Don't think it's iframes specifically, just the #document node
Changed November 08, 2011 09:52PM UTC by comment:6
owner: | cwolves → timmywil |
---|---|
status: | new → assigned |
@cwolves, I still wouldn't rule it out. .closest uses matchesSelector and calling matchesSelector on a document should be fine.
http://jsfiddle.net/timmywil/qa29b/
Calling matchesSelector on an iframe document while trying to access an attribute could be a problem, but I will look into it more.
Changed July 12, 2012 01:47AM UTC by comment:7
component: | traversing → selector |
---|
IE8