]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/node_modules/space-pen/node_modules/jquery/src/selector-native.js
d8163c2f9bcbe080f3f9906be7c1f4531cf3cc8c
3 ], function( jQuery
) {
6 * Optional (non-Sizzle) selector module for custom builds.
8 * Note that this DOES NOT SUPPORT many documented jQuery
9 * features in exchange for its smaller size:
11 * Attribute not equal selector
12 * Positional selectors (:first; :eq(n); :odd; etc.)
13 * Type selectors (:input; :checkbox; :button; etc.)
14 * State-based selectors (:animated; :visible; :hidden; etc.)
16 * :not(complex selector)
17 * custom selectors via Sizzle extensions
18 * Leading combinators (e.g., $collection.find("> *"))
19 * Reliable functionality on XML fragments
20 * Requiring all parts of a selector to match elements under context
21 * (e.g., $div.find("div > *") now matches children of $div)
22 * Matching against non-elements
23 * Reliable sorting of disconnected nodes
24 * querySelectorAll bug fixes (e.g., unreliable :focus on WebKit)
26 * If any of these are unacceptable tradeoffs, either use Sizzle or
27 * customize this stub for the project's specific needs.
30 var docElem
= window
.document
.documentElement
,
31 selector_hasDuplicate
,
32 matches
= docElem
.matches
||
33 docElem
.webkitMatchesSelector
||
34 docElem
.mozMatchesSelector
||
35 docElem
.oMatchesSelector
||
36 docElem
.msMatchesSelector
,
37 selector_sortOrder = function( a
, b
) {
38 // Flag for duplicate removal
40 selector_hasDuplicate
= true;
44 var compare
= b
.compareDocumentPosition
&& a
.compareDocumentPosition
&& a
.compareDocumentPosition( b
);
50 // Choose the first element that is related to our document
51 if ( a
=== document
|| jQuery
.contains(document
, a
) ) {
54 if ( b
=== document
|| jQuery
.contains(document
, b
) ) {
58 // Maintain original order
62 return compare
& 4 ? -1 : 1;
65 // Not directly comparable, sort on existence of method
66 return a
.compareDocumentPosition
? -1 : 1;
70 find: function( selector
, context
, results
, seed
) {
74 results
= results
|| [];
75 context
= context
|| document
;
77 // Same basic safeguard as Sizzle
78 if ( !selector
|| typeof selector
!== "string" ) {
82 // Early return if context is not an element or document
83 if ( (nodeType
= context
.nodeType
) !== 1 && nodeType
!== 9 ) {
88 while ( (elem
= seed
[i
++]) ) {
89 if ( jQuery
.find
.matchesSelector(elem
, selector
) ) {
94 jQuery
.merge( results
, context
.querySelectorAll(selector
) );
99 unique: function( results
) {
105 selector_hasDuplicate
= false;
106 results
.sort( selector_sortOrder
);
108 if ( selector_hasDuplicate
) {
109 while ( (elem
= results
[i
++]) ) {
110 if ( elem
=== results
[ i
] ) {
111 j
= duplicates
.push( i
);
115 results
.splice( duplicates
[ j
], 1 );
121 text: function( elem
) {
125 nodeType
= elem
.nodeType
;
128 // If no nodeType, this is expected to be an array
129 while ( (node
= elem
[i
++]) ) {
130 // Do not traverse comment nodes
131 ret
+= jQuery
.text( node
);
133 } else if ( nodeType
=== 1 || nodeType
=== 9 || nodeType
=== 11 ) {
134 // Use textContent for elements
135 return elem
.textContent
;
136 } else if ( nodeType
=== 3 || nodeType
=== 4 ) {
137 return elem
.nodeValue
;
139 // Do not include comment or processing instruction nodes
143 contains: function( a
, b
) {
144 var adown
= a
.nodeType
=== 9 ? a
.documentElement : a
,
145 bup
= b
&& b
.parentNode
;
146 return a
=== bup
|| !!( bup
&& bup
.nodeType
=== 1 && adown
.contains(bup
) );
148 isXMLDoc: function( elem
) {
149 return (elem
.ownerDocument
|| elem
).documentElement
.nodeName
!== "HTML";
154 bool: /^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$/i,
155 needsContext: /^[\x20\t\r\n\f]*[>+~]/
160 jQuery
.extend( jQuery
.find
, {
161 matches: function( expr
, elements
) {
162 return jQuery
.find( expr
, null, null, elements
);
164 matchesSelector: function( elem
, expr
) {
165 return matches
.call( elem
, expr
);
167 attr: function( elem
, name
) {
168 return elem
.getAttribute( name
);