-
Notifications
You must be signed in to change notification settings - Fork 20.6k
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
Getting children of <object> tag with contents() not working correctly #4384
Closed
Labels
Milestone
Comments
4 tasks
Thanks for the report! This is a regression from jQuery 3.3.1 so I added the 3.4.2 milestone. |
PR: #4385 |
mgol
added a commit
to mgol/jquery
that referenced
this issue
May 6, 2019
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
2 tasks
mgol
added a commit
to mgol/jquery
that referenced
this issue
May 6, 2019
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
4 tasks
patocallaghan
added a commit
to intercom/jquery
that referenced
this issue
May 7, 2019
4 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
Version: jQuery 3.4.1
Since 0ba8e38 it appears that using
contents()
to get the children of an<object>
is not working as expected.Taking this example HTML
I'd expect the following to happen
But what actually happens is:
This happens because on this line
jquery/src/traversing.js
Lines 148 to 149 in 110802c
elem.contentDocument
is notundefined
. But in this scenarioelem.contentDocument
isnull
so the conditional is truthy and enters theif
block and returnsnull
for the contents.If we change the conditional to be
elem.contentDocument != null
it works correctly.Link to test case
https://codepen.io/patocallaghan/pen/bybaWv?editors=0011
I have a PR to fix it but I wanted to open an issue first.
The text was updated successfully, but these errors were encountered: