Opened 11 years ago
Closed 11 years ago
#10726 closed bug (fixed)
$(#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]')
Change History (8)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Owner: | set to 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.
comment:3 Changed 11 years ago by
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.
comment:4 Changed 11 years ago by
Component: | unfiled → traversing |
---|---|
Priority: | undecided → low |
This may be related: https://github.com/jquery/sizzle/pull/79
comment:5 Changed 11 years ago by
nope, that's a different issue. Don't think it's iframes specifically, just the #document node
comment:6 Changed 11 years ago by
Owner: | changed from cwolves to 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.
comment:7 Changed 11 years ago by
Component: | traversing → selector |
---|
comment:8 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fail silently if closest is somehow called on a document. Fixes #10726.
Changeset: 17a26f5bd9b14225248942b876e96545b4c21fb6
IE8