Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 1 | define( [ |
| 2 | "../core", |
| 3 | "../core/nodeName" |
| 4 | ], function( jQuery, nodeName ) { |
| 5 | |
| 6 | "use strict"; |
| 7 | |
| 8 | function getAll( context, tag ) { |
| 9 | |
| 10 | // Support: IE <=9 - 11 only |
| 11 | // Use typeof to avoid zero-argument method invocation on host objects (#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 | |
| 31 | return getAll; |
| 32 | } ); |