Skip to content

Commit 1ae025e

Browse files
committed
Manipulation: Tolerate XMLNode host object input to getAll
Fixes #15151 Ref 25712d7 Closes jquerygh-1602
1 parent 609adf6 commit 1ae025e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/manipulation.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,12 @@ function cloneCopyEvent( src, dest ) {
121121
}
122122

123123
function getAll( context, tag ) {
124-
var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
125-
context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
124+
// Support: IE9-11+
125+
// Use typeof to avoid zero-argument method invocation on host objects (#15151)
126+
var ret = typeof context.getElementsByTagName !== "undefined" ?
127+
context.getElementsByTagName( tag || "*" ) :
128+
typeof context.querySelectorAll !== "undefined" ?
129+
context.querySelectorAll( tag || "*" ) :
126130
[];
127131

128132
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?

0 commit comments

Comments
 (0)