aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2014-06-17 09:48:17 -0400
committerRichard Gibson <richard.gibson@gmail.com>2014-09-04 02:41:57 -0400
commit1ae025e24f9920d18cec8a8498bfc4eed7e3f1dc (patch)
tree5c605054294e91ad02a6ac239ef642977dcc6f47
parent609adf63dadb7052c816b1a3ee44e3f928ede2e3 (diff)
downloadjquery-1ae025e24f9920d18cec8a8498bfc4eed7e3f1dc.tar.gz
jquery-1ae025e24f9920d18cec8a8498bfc4eed7e3f1dc.zip
Manipulation: Tolerate XMLNode host object input to getAll
Fixes #15151 Ref 25712d77c3bc0221b5b2b9b9492c20a9cfbe1b17 Closes gh-1602
-rw-r--r--src/manipulation.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/manipulation.js b/src/manipulation.js
index 887c70c0a..13bbbfc8e 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -121,8 +121,12 @@ function cloneCopyEvent( src, dest ) {
}
function getAll( context, tag ) {
- var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
- context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
+ // Support: IE9-11+
+ // Use typeof to avoid zero-argument method invocation on host objects (#15151)
+ var ret = typeof context.getElementsByTagName !== "undefined" ?
+ context.getElementsByTagName( tag || "*" ) :
+ typeof context.querySelectorAll !== "undefined" ?
+ context.querySelectorAll( tag || "*" ) :
[];
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?