aboutsummaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/DOMEval.js64
-rw-r--r--src/core/access.js12
-rw-r--r--src/core/camelCase.js8
-rw-r--r--src/core/init.js16
-rw-r--r--src/core/isAttached.js37
-rw-r--r--src/core/nodeName.js8
-rw-r--r--src/core/parseHTML.js16
-rw-r--r--src/core/ready-no-deferred.js10
-rw-r--r--src/core/ready.js13
-rw-r--r--src/core/readyException.js8
-rw-r--r--src/core/stripAndCollapse.js20
-rw-r--r--src/core/toType.js11
-rw-r--r--src/core/var/rhtml.js8
-rw-r--r--src/core/var/rsingleTag.js10
14 files changed, 83 insertions, 158 deletions
diff --git a/src/core/DOMEval.js b/src/core/DOMEval.js
index df83cca52..b0238fd69 100644
--- a/src/core/DOMEval.js
+++ b/src/core/DOMEval.js
@@ -1,43 +1,39 @@
-define( [
- "../var/document"
-], function( document ) {
- "use strict";
+import document from "../var/document.js";
- var preservedScriptAttributes = {
- type: true,
- src: true,
- nonce: true,
- noModule: true
- };
+var preservedScriptAttributes = {
+ type: true,
+ src: true,
+ nonce: true,
+ noModule: true
+};
- function DOMEval( code, node, doc ) {
- doc = doc || document;
+function DOMEval( code, node, doc ) {
+ doc = doc || document;
- var i, val,
- script = doc.createElement( "script" );
+ var i, val,
+ script = doc.createElement( "script" );
- script.text = code;
- if ( node ) {
- for ( i in preservedScriptAttributes ) {
+ script.text = code;
+ if ( node ) {
+ for ( i in preservedScriptAttributes ) {
- // Support: Firefox <=64 - 66+, Edge <=18+
- // Some browsers don't support the "nonce" property on scripts.
- // On the other hand, just using `getAttribute` is not enough as
- // the `nonce` attribute is reset to an empty string whenever it
- // becomes browsing-context connected.
- // See https://github.com/whatwg/html/issues/2369
- // See https://html.spec.whatwg.org/#nonce-attributes
- // The `node.getAttribute` check was added for the sake of
- // `jQuery.globalEval` so that it can fake a nonce-containing node
- // via an object.
- val = node[ i ] || node.getAttribute && node.getAttribute( i );
- if ( val ) {
- script.setAttribute( i, val );
- }
+ // Support: Firefox <=64 - 66+, Edge <=18+
+ // Some browsers don't support the "nonce" property on scripts.
+ // On the other hand, just using `getAttribute` is not enough as
+ // the `nonce` attribute is reset to an empty string whenever it
+ // becomes browsing-context connected.
+ // See https://github.com/whatwg/html/issues/2369
+ // See https://html.spec.whatwg.org/#nonce-attributes
+ // The `node.getAttribute` check was added for the sake of
+ // `jQuery.globalEval` so that it can fake a nonce-containing node
+ // via an object.
+ val = node[ i ] || node.getAttribute && node.getAttribute( i );
+ if ( val ) {
+ script.setAttribute( i, val );
}
}
- doc.head.appendChild( script ).parentNode.removeChild( script );
}
+ doc.head.appendChild( script ).parentNode.removeChild( script );
+}
- return DOMEval;
-} );
+export default DOMEval;
diff --git a/src/core/access.js b/src/core/access.js
index e088a6557..4eaec4695 100644
--- a/src/core/access.js
+++ b/src/core/access.js
@@ -1,9 +1,5 @@
-define( [
- "../core",
- "../core/toType"
-], function( jQuery, toType ) {
-
-"use strict";
+import jQuery from "../core.js";
+import toType from "../core/toType.js";
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
@@ -66,6 +62,4 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
return len ? fn( elems[ 0 ], key ) : emptyGet;
};
-return access;
-
-} );
+export default access;
diff --git a/src/core/camelCase.js b/src/core/camelCase.js
index 61ed90d05..f12a2c67d 100644
--- a/src/core/camelCase.js
+++ b/src/core/camelCase.js
@@ -1,7 +1,3 @@
-define( [], function() {
-
-"use strict";
-
// Matches dashed string for camelizing
var rdashAlpha = /-([a-z])/g;
@@ -15,6 +11,4 @@ function camelCase( string ) {
return string.replace( rdashAlpha, fcamelCase );
}
-return camelCase;
-
-} );
+export default camelCase;
diff --git a/src/core/init.js b/src/core/init.js
index 71f30e926..c2f35e1f4 100644
--- a/src/core/init.js
+++ b/src/core/init.js
@@ -1,13 +1,9 @@
// Initialize a jQuery object
-define( [
- "../core",
- "../var/document",
- "./var/rsingleTag",
+import jQuery from "../core.js";
+import document from "../var/document.js";
+import rsingleTag from "./var/rsingleTag.js";
- "../traversing/findFilter"
-], function( jQuery, document, rsingleTag ) {
-
-"use strict";
+import "../traversing/findFilter.js";
// A central reference to the root jQuery(document)
var rootjQuery,
@@ -123,6 +119,4 @@ init.prototype = jQuery.fn;
// Initialize central reference
rootjQuery = jQuery( document );
-return init;
-
-} );
+export default init;
diff --git a/src/core/isAttached.js b/src/core/isAttached.js
index 579bcffb2..3857d94a8 100644
--- a/src/core/isAttached.js
+++ b/src/core/isAttached.js
@@ -1,23 +1,20 @@
-define( [
- "../core",
- "../var/documentElement",
- "../selector/contains" // jQuery.contains
-], function( jQuery, documentElement ) {
- "use strict";
+import jQuery from "../core.js";
+import documentElement from "../var/documentElement.js";
- var isAttached = function( elem ) {
- return jQuery.contains( elem.ownerDocument, elem );
- },
- composed = { composed: true };
+import "../selector/contains.js"; // jQuery.contains
- // Support: IE 9 - 11+, Edge 12 - 18+
- // Check attachment across shadow DOM boundaries when possible (gh-3504)
- if ( documentElement.getRootNode ) {
- isAttached = function( elem ) {
- return jQuery.contains( elem.ownerDocument, elem ) ||
- elem.getRootNode( composed ) === elem.ownerDocument;
- };
- }
+var isAttached = function( elem ) {
+ return jQuery.contains( elem.ownerDocument, elem );
+ },
+ composed = { composed: true };
- return isAttached;
-} );
+// Support: IE 9 - 11+, Edge 12 - 18+
+// Check attachment across shadow DOM boundaries when possible (gh-3504)
+if ( documentElement.getRootNode ) {
+ isAttached = function( elem ) {
+ return jQuery.contains( elem.ownerDocument, elem ) ||
+ elem.getRootNode( composed ) === elem.ownerDocument;
+ };
+}
+
+export default isAttached;
diff --git a/src/core/nodeName.js b/src/core/nodeName.js
index 8a5f5f036..d10e484bc 100644
--- a/src/core/nodeName.js
+++ b/src/core/nodeName.js
@@ -1,13 +1,7 @@
-define( function() {
-
-"use strict";
-
function nodeName( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
};
-return nodeName;
-
-} );
+export default nodeName;
diff --git a/src/core/parseHTML.js b/src/core/parseHTML.js
index 8c5268fb1..15278fa02 100644
--- a/src/core/parseHTML.js
+++ b/src/core/parseHTML.js
@@ -1,11 +1,7 @@
-define( [
- "../core",
- "../var/document",
- "./var/rsingleTag",
- "../manipulation/buildFragment"
-], function( jQuery, document, rsingleTag, buildFragment ) {
-
-"use strict";
+import jQuery from "../core.js";
+import document from "../var/document.js";
+import rsingleTag from "./var/rsingleTag.js";
+import buildFragment from "../manipulation/buildFragment.js";
// Argument "data" should be string of html
// context (optional): If specified, the fragment will be created in this context,
@@ -52,7 +48,3 @@ jQuery.parseHTML = function( data, context, keepScripts ) {
return jQuery.merge( [], parsed.childNodes );
};
-
-return jQuery.parseHTML;
-
-} );
diff --git a/src/core/ready-no-deferred.js b/src/core/ready-no-deferred.js
index 2c3fc1b84..51f6d7f6b 100644
--- a/src/core/ready-no-deferred.js
+++ b/src/core/ready-no-deferred.js
@@ -1,9 +1,5 @@
-define( [
- "../core",
- "../var/document"
-], function( jQuery, document ) {
-
-"use strict";
+import jQuery from "../core.js";
+import document from "../var/document.js";
var readyCallbacks = [],
whenReady = function( fn ) {
@@ -89,5 +85,3 @@ if ( document.readyState !== "loading" ) {
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed );
}
-
-} );
diff --git a/src/core/ready.js b/src/core/ready.js
index 3abb6c03a..d6c507e41 100644
--- a/src/core/ready.js
+++ b/src/core/ready.js
@@ -1,11 +1,8 @@
-define( [
- "../core",
- "../var/document",
- "../core/readyException",
- "../deferred"
-], function( jQuery, document ) {
+import jQuery from "../core.js";
+import document from "../var/document.js";
-"use strict";
+import "../core/readyException.js";
+import "../deferred.js";
// The deferred used on DOM ready
var readyList = jQuery.Deferred();
@@ -79,5 +76,3 @@ if ( document.readyState !== "loading" ) {
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed );
}
-
-} );
diff --git a/src/core/readyException.js b/src/core/readyException.js
index 72bdd90b5..1b5512c15 100644
--- a/src/core/readyException.js
+++ b/src/core/readyException.js
@@ -1,13 +1,7 @@
-define( [
- "../core"
-], function( jQuery ) {
-
-"use strict";
+import jQuery from "../core.js";
jQuery.readyException = function( error ) {
window.setTimeout( function() {
throw error;
} );
};
-
-} );
diff --git a/src/core/stripAndCollapse.js b/src/core/stripAndCollapse.js
index 2b63820da..944a79362 100644
--- a/src/core/stripAndCollapse.js
+++ b/src/core/stripAndCollapse.js
@@ -1,14 +1,10 @@
-define( [
- "../var/rnothtmlwhite"
-], function( rnothtmlwhite ) {
- "use strict";
+import rnothtmlwhite from "../var/rnothtmlwhite.js";
- // Strip and collapse whitespace according to HTML spec
- // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
- function stripAndCollapse( value ) {
- var tokens = value.match( rnothtmlwhite ) || [];
- return tokens.join( " " );
- }
+// Strip and collapse whitespace according to HTML spec
+// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
+function stripAndCollapse( value ) {
+ var tokens = value.match( rnothtmlwhite ) || [];
+ return tokens.join( " " );
+}
- return stripAndCollapse;
-} );
+export default stripAndCollapse;
diff --git a/src/core/toType.js b/src/core/toType.js
index c555ef9df..67af8a67f 100644
--- a/src/core/toType.js
+++ b/src/core/toType.js
@@ -1,9 +1,5 @@
-define( [
- "../var/class2type",
- "../var/toString"
-], function( class2type, toString ) {
-
-"use strict";
+import class2type from "../var/class2type.js";
+import toString from "../var/toString.js";
function toType( obj ) {
if ( obj == null ) {
@@ -15,5 +11,4 @@ function toType( obj ) {
typeof obj;
}
-return toType;
-} );
+export default toType;
diff --git a/src/core/var/rhtml.js b/src/core/var/rhtml.js
index d7921aa3b..3dace14c5 100644
--- a/src/core/var/rhtml.js
+++ b/src/core/var/rhtml.js
@@ -1,7 +1 @@
-define( function() {
-
-"use strict";
-
-return ( /HTML$/i );
-
-} );
+export default ( /HTML$/i );
diff --git a/src/core/var/rsingleTag.js b/src/core/var/rsingleTag.js
index 340b80db0..5bf52d568 100644
--- a/src/core/var/rsingleTag.js
+++ b/src/core/var/rsingleTag.js
@@ -1,7 +1,3 @@
-define( function() {
- "use strict";
-
- // rsingleTag matches a string consisting of a single HTML element with no attributes
- // and captures the element's name
- return ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
-} );
+// rsingleTag matches a string consisting of a single HTML element with no attributes
+// and captures the element's name
+export default ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );