aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAriel Flesler <aflesler@gmail.com>2008-05-06 00:13:20 +0000
committerAriel Flesler <aflesler@gmail.com>2008-05-06 00:13:20 +0000
commite6fccd71031bd37300c1dfe79873b3d2529b4775 (patch)
tree2dd1c72a594785bf3f0b91d124f0b20cbcfd0cae
parentd726a96b1f5008f29097f1efbea9a987015af641 (diff)
downloadjquery-e6fccd71031bd37300c1dfe79873b3d2529b4775.tar.gz
jquery-e6fccd71031bd37300c1dfe79873b3d2529b4775.zip
jquery selector: reverting [5343], check #1960.
-rw-r--r--src/selector.js38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/selector.js b/src/selector.js
index 294fed028..abb1e7f69 100644
--- a/src/selector.js
+++ b/src/selector.js
@@ -331,30 +331,24 @@ jQuery.extend({
r = jQuery.classFilter(r, m[2], not);
else if ( m[1] == "[" ) {
- var type = m[3];
+ var tmp = [], type = m[3];
- // special case, filter by exact name
- if ( !not && m[2] == 'name' && type == '=' )
- r = jQuery.grep( document.getElementsByName(m[5]), function(elem){
- return jQuery.inArray( elem, r ) != -1;
- });
- else {
- for ( var i = 0, rl = r.length, tmp = []; i < rl; i++ ) {
- var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
-
- if ( z == null || /href|src|selected/.test(m[2]) )
- z = jQuery.attr(a,m[2]) || '';
-
- if ( (type == "" && !!z ||
- type == "=" && z == m[5] ||
- type == "!=" && z != m[5] ||
- type == "^=" && z && !z.indexOf(m[5]) ||
- type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
- (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
- tmp.push( a );
- }
- r = tmp;
+ for ( var i = 0, rl = r.length; i < rl; i++ ) {
+ var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
+
+ if ( z == null || /href|src|selected/.test(m[2]) )
+ z = jQuery.attr(a,m[2]) || '';
+
+ if ( (type == "" && !!z ||
+ type == "=" && z == m[5] ||
+ type == "!=" && z != m[5] ||
+ type == "^=" && z && !z.indexOf(m[5]) ||
+ type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
+ (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
+ tmp.push( a );
}
+
+ r = tmp;
// We can get a speed boost by handling nth-child here
} else if ( m[1] == ":" && m[2] == "nth-child" ) {