aboutsummaryrefslogtreecommitdiffstats
path: root/src/css/var/isHiddenWithinTree.js
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2019-11-18 21:15:03 +0100
committerGitHub <noreply@github.com>2019-11-18 21:15:03 +0100
commitd0ce00cdfa680f1f0c38460bc51ea14079ae8b07 (patch)
tree8625b82760f0722443f3901f78d94025d7645463 /src/css/var/isHiddenWithinTree.js
parenta612733be0c68d337647a6fcc8f8e0cabc1fc36b (diff)
downloadjquery-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/css/var/isHiddenWithinTree.js')
-rw-r--r--src/css/var/isHiddenWithinTree.js40
1 files changed, 17 insertions, 23 deletions
diff --git a/src/css/var/isHiddenWithinTree.js b/src/css/var/isHiddenWithinTree.js
index 1e99b96d3..0cc163178 100644
--- a/src/css/var/isHiddenWithinTree.js
+++ b/src/css/var/isHiddenWithinTree.js
@@ -1,26 +1,20 @@
-define( [
- "../../core"
+import jQuery from "../../core.js";
- // css is assumed
-], function( jQuery ) {
- "use strict";
+// isHiddenWithinTree reports if an element has a non-"none" display style (inline and/or
+// through the CSS cascade), which is useful in deciding whether or not to make it visible.
+// It differs from the :hidden selector (jQuery.expr.pseudos.hidden) in two important ways:
+// * A hidden ancestor does not force an element to be classified as hidden.
+// * Being disconnected from the document does not force an element to be classified as hidden.
+// These differences improve the behavior of .toggle() et al. when applied to elements that are
+// detached or contained within hidden ancestors (gh-2404, gh-2863).
+export default function( elem, el ) {
- // isHiddenWithinTree reports if an element has a non-"none" display style (inline and/or
- // through the CSS cascade), which is useful in deciding whether or not to make it visible.
- // It differs from the :hidden selector (jQuery.expr.pseudos.hidden) in two important ways:
- // * A hidden ancestor does not force an element to be classified as hidden.
- // * Being disconnected from the document does not force an element to be classified as hidden.
- // These differences improve the behavior of .toggle() et al. when applied to elements that are
- // detached or contained within hidden ancestors (gh-2404, gh-2863).
- return function( elem, el ) {
+ // isHiddenWithinTree might be called from jQuery#filter function;
+ // in that case, element will be second argument
+ elem = el || elem;
- // isHiddenWithinTree might be called from jQuery#filter function;
- // in that case, element will be second argument
- elem = el || elem;
-
- // Inline style trumps all
- return elem.style.display === "none" ||
- elem.style.display === "" &&
- jQuery.css( elem, "display" ) === "none";
- };
-} );
+ // Inline style trumps all
+ return elem.style.display === "none" ||
+ elem.style.display === "" &&
+ jQuery.css( elem, "display" ) === "none";
+};