UNPKG

654 BJavaScriptView Raw
1define( [
2 "../core",
3 "../core/nodeName"
4], function( jQuery, nodeName ) {
5
6"use strict";
7
8function getAll( context, tag ) {
9
10 // Support: IE <=9 - 11 only
11 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151)
12 var ret;
13
14 if ( typeof context.getElementsByTagName !== "undefined" ) {
15 ret = context.getElementsByTagName( tag || "*" );
16
17 } else if ( typeof context.querySelectorAll !== "undefined" ) {
18 ret = context.querySelectorAll( tag || "*" );
19
20 } else {
21 ret = [];
22 }
23
24 if ( tag === undefined || tag && nodeName( context, tag ) ) {
25 return jQuery.merge( [ context ], ret );
26 }
27
28 return ret;
29}
30
31return getAll;
32} );