1
|
define( [
|
2
|
"../../core",
|
3
|
"../../selector"
|
4
|
|
5
|
// css is assumed
|
6
|
], function( jQuery ) {
|
7
|
"use strict";
|
8
|
|
9
|
// isHiddenWithinTree reports if an element has a non-"none" display style (inline and/or
|
10
|
// through the CSS cascade), which is useful in deciding whether or not to make it visible.
|
11
|
// It differs from the :hidden selector (jQuery.expr.pseudos.hidden) in two important ways:
|
12
|
// * A hidden ancestor does not force an element to be classified as hidden.
|
13
|
// * Being disconnected from the document does not force an element to be classified as hidden.
|
14
|
// These differences improve the behavior of .toggle() et al. when applied to elements that are
|
15
|
// detached or contained within hidden ancestors (gh-2404, gh-2863).
|
16
|
return function( elem, el ) {
|
17
|
|
18
|
// isHiddenWithinTree might be called from jQuery#filter function;
|
19
|
// in that case, element will be second argument
|
20
|
elem = el || elem;
|
21
|
|
22
|
// Inline style trumps all
|
23
|
return elem.style.display === "none" ||
|
24
|
elem.style.display === "" &&
|
25
|
|
26
|
// Otherwise, check computed style
|
27
|
// Support: Firefox <=43 - 45
|
28
|
// Disconnected elements can have computed display: none, so first confirm that elem is
|
29
|
// in the document.
|
30
|
jQuery.contains( elem.ownerDocument, elem ) &&
|
31
|
|
32
|
jQuery.css( elem, "display" ) === "none";
|
33
|
};
|
34
|
} );
|