🌐 AI搜索 & 代理 主页
Skip to content

Commit b6e8242

Browse files
committed
Traversing: Fix contents() on <object>s with children in IE
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
1 parent 4d865d9 commit b6e8242

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/traversing.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,13 @@ jQuery.each( {
145145
return siblings( elem.firstChild );
146146
},
147147
contents: function( elem ) {
148-
if ( elem.contentDocument != null ) {
148+
if ( elem.contentDocument != null &&
149+
150+
// Support: IE 11+
151+
// <object> elements with no `data` attribute has an object
152+
// `contentDocument` with a `null` prototype.
153+
Object.getPrototypeOf( elem.contentDocument ) ) {
154+
149155
return elem.contentDocument;
150156
}
151157

0 commit comments

Comments
 (0)