Skip to content

Commit b0b3058

Browse files
committed
jQuery.find: Rename jQuery.find.selectors to jQuery.expr
1 parent afa04b8 commit b0b3058

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

entries/jQuery.find.xml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -123,20 +123,20 @@
123123

124124
<h3 id="jquery-find-extension-api">Extension API</h3>
125125

126-
<h4><code>jQuery.find.selectors.match.NAME = RegExp</code></h4>
126+
<h4><code>jQuery.expr.match.NAME = RegExp</code></h4>
127127

128-
<p>This contains the regular expressions used to parse a selector into different parts, to be used for finding and filtering. The name of each of the regular expressions should correspond to the names specified in the <code>jQuery.find.selectors.find</code> and <code>jQuery.find.selectors.filter</code> objects.</p>
128+
<p>This contains the regular expressions used to parse a selector into different parts, to be used for finding and filtering. The name of each of the regular expressions should correspond to the names specified in the <code>jQuery.expr.find</code> and <code>jQuery.expr.filter</code> objects.</p>
129129

130130
<h4>Finding</h4>
131131

132132
<p>In order to add a new find function:</p>
133133
<ul>
134134
<li>A regular expression must be added to the <code>match</code> object.</li>
135135
<li>A function to <code>find</code> must be defined.</li>
136-
<li><code>"|" + NAME</code> must be appended to the <code>jQuery.find.selectors.order</code> regex.</li>
136+
<li><code>"|" + NAME</code> must be appended to the <code>jQuery.expr.order</code> regex.</li>
137137
</ul>
138138

139-
<h5><code>jQuery.find.selectors.find.NAME = function( match, context, isXML ) {}</code></h5>
139+
<h5><code>jQuery.expr.find.NAME = function( match, context, isXML ) {}</code></h5>
140140

141141
<p>A method for finding some elements on a page. The specified function will be called no more than once per selector.</p>
142142
<ul>
@@ -154,38 +154,38 @@
154154
<li>A function may optionally be added to the <code>preFilter</code> object.</li>
155155
</ul>
156156

157-
<h5><code>jQuery.find.selectors.preFilter.NAME = function( match ) {}</code></h5>
157+
<h5><code>jQuery.expr.preFilter.NAME = function( match ) {}</code></h5>
158158

159159
<p>An optional pre-filter function which allows filtering of the matched array against the corresponding regular expression, which will return a new matched array. This matched array will eventually be passed and flattened as arguments against the corresponding filter function. This is intended to clean up some of the repetitive processing that occurs in a filter function.</p>
160160

161-
<h5><code>jQuery.find.selectors.filter.NAME: function( element, match[1][, match[2], match[3], ...] ) {}</code></h5>
161+
<h5><code>jQuery.expr.filter.NAME: function( element, match[1][, match[2], match[3], ...] ) {}</code></h5>
162162

163163
<p><strong>Note:</strong> <code>match[0]</code> will be deleted prior to being passed to a filter, and must not be used.</p>
164164

165165
<p>The arguments for a filter method are the element and the captures from the regex corresponding to this filter (indicated above by what is in the match, starting at index 1). The return result must be boolean: true if the element matches the selector, false if not.</p>
166166

167167
<h4>Attributes</h4>
168168

169-
<h5><code>jQuery.find.selectors.attrHandle.LOWERCASE_NAME = function( elem, casePreservedName, isXML ) {}</code></h5>
169+
<h5><code>jQuery.expr.attrHandle.LOWERCASE_NAME = function( elem, casePreservedName, isXML ) {}</code></h5>
170170

171171
<p>Handle an attribute which requires specialized processing (such as <code>href</code>, which has cross-browser issues). The return result must be the actual string value of that attribute.</p>
172172

173173
<h4>Pseudo-selectors (pseudos)</h4>
174174

175-
<h5><code>jQuery.find.selectors.pseudos.NAME = function( elem ) {}</code></h5>
175+
<h5><code>jQuery.expr.pseudos.NAME = function( elem ) {}</code></h5>
176176

177177
<p><em>The most common extension to a selector engine</em>: adding a new pseudo. The return result from this function must be boolean: true if the element matches the selector, false if not.</p>
178178

179179
<p>For example, this defines a simple <code>:fixed</code> pseudo:</p>
180180
<pre><code>
181181
var $test = jQuery( document );
182-
jQuery.find.selectors.pseudos.fixed = function( elem ) {
182+
jQuery.expr.pseudos.fixed = function( elem ) {
183183
$test[ 0 ] = elem;
184184
return $test.css( "position" ) === "fixed";
185185
};
186186
</code></pre>
187187

188-
<h5><code>jQuery.find.selectors.createPseudo( function )</code></h5>
188+
<h5><code>jQuery.expr.createPseudo( function )</code></h5>
189189

190190
<p><code>createPseudo</code> is only required if the custom pseudo-selector accepts an argument.</p>
191191

@@ -196,8 +196,8 @@ jQuery.find.selectors.pseudos.fixed = function( elem ) {
196196
<p>For example, within jQuery, the implementation of the <code>:not( &lt;sub-selector&gt; )</code> pseudo is very similar to:</p>
197197

198198
<pre><code>
199-
jQuery.find.selectors.pseudos.not =
200-
jQuery.find.selectors.createPseudo( function( subSelector ) {
199+
jQuery.expr.pseudos.not =
200+
jQuery.expr.createPseudo( function( subSelector ) {
201201
var matcher = jQuery.find.compile( subSelector );
202202
return function( elem ) {
203203
return !matcher( elem );
@@ -237,32 +237,32 @@ $.expr.pseudos.icontains = $.expr.createPseudo ?
237237
} )( jQuery );
238238
</code></pre>
239239

240-
<h5><code>jQuery.find.selectors.setFilters.LOWERCASE_NAME = function( elements, argument, not ) {}</code></h5>
240+
<h5><code>jQuery.expr.setFilters.LOWERCASE_NAME = function( elements, argument, not ) {}</code></h5>
241241

242-
<p>These filters are run after a previous part of a selector has already returned results. <code>setFilters</code> are found from matching <code>jQuery.find.selectors.match.POS</code>. When applicable, <code>argument</code> is expected to be an integer. The <code>not</code> argument is a boolean indicating whether the result should be inverted (as in <code>div:not(:first)</code>).</p>
242+
<p>These filters are run after a previous part of a selector has already returned results. <code>setFilters</code> are found from matching <code>jQuery.expr.match.POS</code>. When applicable, <code>argument</code> is expected to be an integer. The <code>not</code> argument is a boolean indicating whether the result should be inverted (as in <code>div:not(:first)</code>).</p>
243243

244244
<p>For example, the code for the <code>:first</code> setFilter is similar to:</p>
245245
<pre><code>
246246
var first = function( elements, argument, not ) {
247247
// No argument for first
248248
return not ? elements.slice( 1 ) : [ elements[ 0 ] ];
249249
};
250-
jQuery.find.selectors.setFilters.first = first;
250+
jQuery.expr.setFilters.first = first;
251251
</code></pre>
252252

253253
<p>It is easy to extend jQuery selection engine — even jQuery's <code>POS</code> selectors. For example, to rename <code>:first</code> as <code>:uno</code>:</p>
254254
<pre><code><![CDATA[
255-
jQuery.find.selectors.match.POS = new RegExp( oldPOS.source.replace( "first", "uno" ), "gi" );
256-
jQuery.find.selectors.setFilters.uno = jQuery.find.selectors.setFilters.first;
257-
delete jQuery.find.selectors.setFilters.first;
255+
jQuery.expr.match.POS = new RegExp( oldPOS.source.replace( "first", "uno" ), "gi" );
256+
jQuery.expr.setFilters.uno = jQuery.expr.setFilters.first;
257+
delete jQuery.expr.setFilters.first;
258258
jQuery.find( "div:uno" ); // ==> [ <div> ]
259259
]]></code></pre>
260260

261261
<h3 id="jquery-find-internal-api">Internal API</h3>
262262

263263
<p><strong>Note:</strong> Functionality should be accessed via the Public and Extension APIs. While the Internal API is intended specifically for internal use, it has been exposed for edge cases.</p>
264264

265-
<h4><code>jQuery.find.selectors.cacheLength</code></h4>
265+
<h4><code>jQuery.expr.cacheLength</code></h4>
266266

267267
<p>jQuery internally caches compiled selector functions and tokenization objects. The length of these caches defaults to 50, but can be set to any positive integer by assigning to this property.</p>
268268

0 commit comments

Comments
 (0)