getAll.js 563 B

1234567891011121314151617181920212223
  1. define( [
  2. "../core"
  3. ], function( jQuery ) {
  4. "use strict";
  5. function getAll( context, tag ) {
  6. // Support: IE <=9 - 11 only
  7. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  8. var ret = typeof context.getElementsByTagName !== "undefined" ?
  9. context.getElementsByTagName( tag || "*" ) :
  10. typeof context.querySelectorAll !== "undefined" ?
  11. context.querySelectorAll( tag || "*" ) :
  12. [];
  13. return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
  14. jQuery.merge( [ context ], ret ) :
  15. ret;
  16. }
  17. return getAll;
  18. } );