-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Closed
GulajavaMinistudio/jquery
#90Milestone
Description
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
<object type="application/x-shockwave-flash" width="200" height="300" id="penguin">
<param name="movie" value="flash/penguin.swf">
<param name="quality" value="high">
<img src="images/penguin.jpg" width="200" height="300" alt="Penguin">
</object>I'd expect the following to happen
jQuery(objectHtml).contents().length // => 3But what actually happens is:
jQuery(objectHtml).contents().length // => 0This happens because on this line
Lines 148 to 149 in 110802c
| if ( typeof elem.contentDocument !== "undefined" ) { | |
| return elem.contentDocument; |
elem.contentDocument is not undefined. But in this scenario elem.contentDocument is null so the conditional is truthy and enters the if block and returns null for the contents.
If we change the conditional to be elem.contentDocument != null it works correctly.
Link to test case
I have a PR to fix it but I wanted to open an issue first.