You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<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>
129
129
130
130
<h4>Finding</h4>
131
131
132
132
<p>In order to add a new find function:</p>
133
133
<ul>
134
134
<li>A regular expression must be added to the <code>match</code> object.</li>
135
135
<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>
<p>A method for finding some elements on a page. The specified function will be called no more than once per selector.</p>
142
142
<ul>
@@ -154,38 +154,38 @@
154
154
<li>A function may optionally be added to the <code>preFilter</code> object.</li>
155
155
</ul>
156
156
157
-
<h5><code>jQuery.find.selectors.preFilter.NAME = function( match ) {}</code></h5>
157
+
<h5><code>jQuery.expr.preFilter.NAME = function( match ) {}</code></h5>
158
158
159
159
<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>
<p><strong>Note:</strong> <code>match[0]</code> will be deleted prior to being passed to a filter, and must not be used.</p>
164
164
165
165
<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>
<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>
<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>
178
178
179
179
<p>For example, this defines a simple <code>:fixed</code> pseudo:</p>
<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>
241
241
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>
243
243
244
244
<p>For example, the code for the <code>:first</code> setFilter is similar to:</p>
<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>
254
254
<pre><code><![CDATA[
255
-
jQuery.find.selectors.match.POS = new RegExp( oldPOS.source.replace( "first", "uno" ), "gi" );
<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>
<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>
0 commit comments