aboutsummaryrefslogtreecommitdiffstats
path: root/src/traversing.js
diff options
context:
space:
mode:
authorLuis Emilio Velasco Sanchez <emibloque@gmail.com>2018-05-14 13:36:30 -0400
committerDave Methvin <dave.methvin@gmail.com>2018-05-14 13:41:42 -0400
commit0ba8e38d0c4ab4a4fb9054e7a713630be9743aff (patch)
tree4a7d8995a669afe3d4db1c9415dee5a70da68aa4 /src/traversing.js
parent821bf34353a6baf97f7944379a6459afb16badae (diff)
downloadjquery-0ba8e38d0c4ab4a4fb9054e7a713630be9743aff.tar.gz
jquery-0ba8e38d0c4ab4a4fb9054e7a713630be9743aff.zip
Traversing: $.fn.contents() support for object
Fixes gh-4045 Closes gh-4046
Diffstat (limited to 'src/traversing.js')
-rw-r--r--src/traversing.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/traversing.js b/src/traversing.js
index 64c7252b9..426d5b6ea 100644
--- a/src/traversing.js
+++ b/src/traversing.js
@@ -145,18 +145,18 @@ jQuery.each( {
return siblings( elem.firstChild );
},
contents: function( elem ) {
- if ( nodeName( elem, "iframe" ) ) {
- return elem.contentDocument;
- }
-
- // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
- // Treat the template element as a regular one in browsers that
- // don't support it.
- if ( nodeName( elem, "template" ) ) {
- elem = elem.content || elem;
- }
-
- return jQuery.merge( [], elem.childNodes );
+ if ( typeof elem.contentDocument !== "undefined" ) {
+ return elem.contentDocument;
+ }
+
+ // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
+ // Treat the template element as a regular one in browsers that
+ // don't support it.
+ if ( nodeName( elem, "template" ) ) {
+ elem = elem.content || elem;
+ }
+
+ return jQuery.merge( [], elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {