New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix retrieving children of <object>
using contents()
#4385
Fix retrieving children of <object>
using contents()
#4385
Conversation
e41e5b8
to
1cc978f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Looks good to me.
Note to self: remember to cherry-pick this to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good and has enough reviews.
I merged it and the newly added test fails in IE: http://swarm.jquery.org/result/3328701 |
The original fix didn't account for the fact that in IE `<object>` elements with no `data` attribute have an object `contentDocument`. The fix leverages the fact that this special object has a null prototype. Ref jquerygh-4384 Ref jquerygh-4385
PR with a fix for IE 11: #4390 |
The original fix didn't account for the fact that in IE `<object>` elements with no `data` attribute have an object `contentDocument`. The fix leverages the fact that this special object has a null prototype. Ref jquerygh-4384 Ref jquerygh-4385
Fix for #4384
Summary
Since 0ba8e38, using
contents()
to get the children of an<object>
is not working.Taking this example HTML
I'd expect the following to happen
But what actually happens is:
Changing the conditional to
elem.contentDocument != null
handles this case and the function returns the correct children.Checklist