mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Traversing: Fix contents()
on <object>
s with children
(cherry-picked from 4d865d96aa
)
Fixes gh-4384
Closes gh-4385
This commit is contained in:
parent
0e3e23df22
commit
42badf3460
@ -145,7 +145,7 @@ jQuery.each( {
|
|||||||
return siblings( elem.firstChild );
|
return siblings( elem.firstChild );
|
||||||
},
|
},
|
||||||
contents: function( elem ) {
|
contents: function( elem ) {
|
||||||
if ( typeof elem.contentDocument !== "undefined" ) {
|
if ( elem.contentDocument != null ) {
|
||||||
return elem.contentDocument;
|
return elem.contentDocument;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,6 +808,19 @@ QUnit.test( "contents() for <object />", function( assert ) {
|
|||||||
jQuery( "#qunit-fixture" ).append( svgObject );
|
jQuery( "#qunit-fixture" ).append( svgObject );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
QUnit.test( "contents() for <object /> with children", function( assert ) {
|
||||||
|
assert.expect( 1 );
|
||||||
|
|
||||||
|
var object = "<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>";
|
||||||
|
|
||||||
|
var contents = jQuery( object ).contents();
|
||||||
|
assert.equal( contents.length, 3, "Check object contents children are correct" );
|
||||||
|
} );
|
||||||
|
|
||||||
QUnit.test( "contents() for <frame />", function( assert ) {
|
QUnit.test( "contents() for <frame />", function( assert ) {
|
||||||
assert.expect( 2 );
|
assert.expect( 2 );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user