c5169e0e
Renato De Donato
a new hope
|
1
2
3
|
define([
"./core"
], function( jQuery ) {
|
74249687
Luigi Serra
Cross browser con...
|
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/*
* Optional (non-Sizzle) selector module for custom builds.
*
* Note that this DOES NOT SUPPORT many documented jQuery
* features in exchange for its smaller size:
*
* Attribute not equal selector
* Positional selectors (:first; :eq(n); :odd; etc.)
* Type selectors (:input; :checkbox; :button; etc.)
* State-based selectors (:animated; :visible; :hidden; etc.)
* :has(selector)
* :not(complex selector)
* custom selectors via Sizzle extensions
* Leading combinators (e.g., $collection.find("> *"))
* Reliable functionality on XML fragments
* Requiring all parts of a selector to match elements under context
* (e.g., $div.find("div > *") now matches children of $div)
* Matching against non-elements
* Reliable sorting of disconnected nodes
* querySelectorAll bug fixes (e.g., unreliable :focus on WebKit)
*
* If any of these are unacceptable tradeoffs, either use Sizzle or
* customize this stub for the project's specific needs.
*/
|
c5169e0e
Renato De Donato
a new hope
|
30
31
32
33
34
35
36
37
38
39
40
41
|
var docElem = window.document.documentElement,
selector_hasDuplicate,
matches = docElem.matches ||
docElem.webkitMatchesSelector ||
docElem.mozMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector,
selector_sortOrder = function( a, b ) {
// Flag for duplicate removal
if ( a === b ) {
selector_hasDuplicate = true;
return 0;
|
a1a3bc73
Luigi Serra
graphs updates
|
42
|
}
|
74249687
Luigi Serra
Cross browser con...
|
43
|
|
c5169e0e
Renato De Donato
a new hope
|
44
|
var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );
|
74249687
Luigi Serra
Cross browser con...
|
45
|
|
c5169e0e
Renato De Donato
a new hope
|
46
47
48
|
if ( compare ) {
// Disconnected nodes
if ( compare & 1 ) {
|
74249687
Luigi Serra
Cross browser con...
|
49
|
|
c5169e0e
Renato De Donato
a new hope
|
50
51
52
53
54
55
56
|
// Choose the first element that is related to our document
if ( a === document || jQuery.contains(document, a) ) {
return -1;
}
if ( b === document || jQuery.contains(document, b) ) {
return 1;
}
|
74249687
Luigi Serra
Cross browser con...
|
57
|
|
c5169e0e
Renato De Donato
a new hope
|
58
59
|
// Maintain original order
return 0;
|
a1a3bc73
Luigi Serra
graphs updates
|
60
|
}
|
74249687
Luigi Serra
Cross browser con...
|
61
|
|
c5169e0e
Renato De Donato
a new hope
|
62
63
|
return compare & 4 ? -1 : 1;
}
|
74249687
Luigi Serra
Cross browser con...
|
64
|
|
c5169e0e
Renato De Donato
a new hope
|
65
66
67
|
// Not directly comparable, sort on existence of method
return a.compareDocumentPosition ? -1 : 1;
};
|
a1a3bc73
Luigi Serra
graphs updates
|
68
|
|
c5169e0e
Renato De Donato
a new hope
|
69
|
jQuery.extend({
|
74249687
Luigi Serra
Cross browser con...
|
70
71
72
73
74
75
76
77
78
79
80
81
82
|
find: function( selector, context, results, seed ) {
var elem, nodeType,
i = 0;
results = results || [];
context = context || document;
// Same basic safeguard as Sizzle
if ( !selector || typeof selector !== "string" ) {
return results;
}
// Early return if context is not an element or document
|
c5169e0e
Renato De Donato
a new hope
|
83
|
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
|
74249687
Luigi Serra
Cross browser con...
|
84
85
86
87
|
return [];
}
if ( seed ) {
|
c5169e0e
Renato De Donato
a new hope
|
88
89
|
while ( (elem = seed[i++]) ) {
if ( jQuery.find.matchesSelector(elem, selector) ) {
|
74249687
Luigi Serra
Cross browser con...
|
90
91
92
93
|
results.push( elem );
}
}
} else {
|
c5169e0e
Renato De Donato
a new hope
|
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
jQuery.merge( results, context.querySelectorAll(selector) );
}
return results;
},
unique: function( results ) {
var elem,
duplicates = [],
i = 0,
j = 0;
selector_hasDuplicate = false;
results.sort( selector_sortOrder );
if ( selector_hasDuplicate ) {
while ( (elem = results[i++]) ) {
if ( elem === results[ i ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
|
74249687
Luigi Serra
Cross browser con...
|
117
118
119
120
|
}
return results;
},
|
74249687
Luigi Serra
Cross browser con...
|
121
122
123
124
125
126
127
|
text: function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( !nodeType ) {
|
74249687
Luigi Serra
Cross browser con...
|
128
|
// If no nodeType, this is expected to be an array
|
c5169e0e
Renato De Donato
a new hope
|
129
|
while ( (node = elem[i++]) ) {
|
74249687
Luigi Serra
Cross browser con...
|
130
131
132
133
|
// Do not traverse comment nodes
ret += jQuery.text( node );
}
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
|
74249687
Luigi Serra
Cross browser con...
|
134
135
136
137
138
|
// Use textContent for elements
return elem.textContent;
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
|
74249687
Luigi Serra
Cross browser con...
|
139
140
141
142
143
144
145
|
// Do not include comment or processing instruction nodes
return ret;
},
contains: function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
|
c5169e0e
Renato De Donato
a new hope
|
146
|
return a === bup || !!( bup && bup.nodeType === 1 && adown.contains(bup) );
|
74249687
Luigi Serra
Cross browser con...
|
147
148
|
},
isXMLDoc: function( elem ) {
|
c5169e0e
Renato De Donato
a new hope
|
149
|
return (elem.ownerDocument || elem).documentElement.nodeName !== "HTML";
|
74249687
Luigi Serra
Cross browser con...
|
150
151
152
153
|
},
expr: {
attrHandle: {},
match: {
|
c5169e0e
Renato De Donato
a new hope
|
154
|
bool: /^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$/i,
|
74249687
Luigi Serra
Cross browser con...
|
155
156
157
|
needsContext: /^[\x20\t\r\n\f]*[>+~]/
}
}
|
c5169e0e
Renato De Donato
a new hope
|
158
|
});
|
74249687
Luigi Serra
Cross browser con...
|
159
160
161
162
163
164
165
166
167
|
jQuery.extend( jQuery.find, {
matches: function( expr, elements ) {
return jQuery.find( expr, null, null, elements );
},
matchesSelector: function( elem, expr ) {
return matches.call( elem, expr );
},
attr: function( elem, name ) {
|
c5169e0e
Renato De Donato
a new hope
|
168
|
return elem.getAttribute( name );
|
74249687
Luigi Serra
Cross browser con...
|
169
|
}
|
c5169e0e
Renato De Donato
a new hope
|
170
|
});
|
74249687
Luigi Serra
Cross browser con...
|
171
|
|
c5169e0e
Renato De Donato
a new hope
|
172
|
});
|