diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-11-18 21:15:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-18 21:15:03 +0100 |
commit | d0ce00cdfa680f1f0c38460bc51ea14079ae8b07 (patch) | |
tree | 8625b82760f0722443f3901f78d94025d7645463 /src/selector.js | |
parent | a612733be0c68d337647a6fcc8f8e0cabc1fc36b (diff) | |
download | jquery-d0ce00cdfa680f1f0c38460bc51ea14079ae8b07.tar.gz jquery-d0ce00cdfa680f1f0c38460bc51ea14079ae8b07.zip |
Core: Migrate from AMD to ES modules 🎉
Migrate all source AMD modules to ECMAScript modules. The final bundle
is compiled by a custom build process that uses Rollup under the hood.
Test files themselves are still loaded via RequireJS as that has to work in
IE 11.
Tests can now be run in "Load as modules" mode which replaces the previous
"Load with AMD" option. That option of running tests doesn't work in IE
and Edge as it requires support for dynamic imports.
Some of the changes required by the migration:
* check `typeof` of `noGlobal` instead of using the variable directly
as it's not available when modules are used
* change the nonce module to be an object as ECMASscript module exports
are immutable
* remove some unused exports
* import `./core/parseHTML.js` directly in `jquery.js` so that it's not
being cut out when the `ajax` module is excluded in a custom compilation
Closes gh-4541
Diffstat (limited to 'src/selector.js')
-rw-r--r-- | src/selector.js | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/selector.js b/src/selector.js index 8033f1115..019f25d62 100644 --- a/src/selector.js +++ b/src/selector.js @@ -1,22 +1,17 @@ -define( [ - "./core", - "./core/nodeName", - "./var/document", - "./var/documentElement", - "./var/indexOf", - "./var/pop", - "./var/push", - "./selector/rbuggyQSA", - "./selector/support", - - // The following utils are attached directly to the jQuery object. - "./selector/contains", - "./selector/escapeSelector", - "./selector/uniqueSort" -], function( jQuery, nodeName, document, documentElement, indexOf, pop, push, - rbuggyQSA, support ) { - -"use strict"; +import jQuery from "./core.js"; +import nodeName from "./core/nodeName.js"; +import document from "./var/document.js"; +import documentElement from "./var/documentElement.js"; +import indexOf from "./var/indexOf.js"; +import pop from "./var/pop.js"; +import push from "./var/push.js"; +import rbuggyQSA from "./selector/rbuggyQSA.js"; +import support from "./selector/support.js"; + +// The following utils are attached directly to the jQuery object. +import "./selector/contains.js"; +import "./selector/escapeSelector.js"; +import "./selector/uniqueSort.js"; var preferredDoc = document, matches = documentElement.matches || documentElement.msMatchesSelector; @@ -1642,5 +1637,3 @@ setDocument(); jQuery.find = find; } )(); - -} ); |