diff options
author | John Resig <jeresig@gmail.com> | 2007-03-25 02:04:03 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2007-03-25 02:04:03 +0000 |
commit | ae208246fbd1708b72e822b61c9e24d3034d1a05 (patch) | |
tree | 7ebfe781241d6a411c7d55aabb11f1b5da8c9d89 /src/jquery/jquery.js | |
parent | af79bb1f255433d553d8d9dde0306cc340903c1a (diff) | |
download | jquery-ae208246fbd1708b72e822b61c9e24d3034d1a05.tar.gz jquery-ae208246fbd1708b72e822b61c9e24d3034d1a05.zip |
Added support for escaping selectors in ID and Classname queries (#143). You need to be sure to double-escape selectors, though, as JavaScript requires it to get the right effect.
Diffstat (limited to 'src/jquery/jquery.js')
-rw-r--r-- | src/jquery/jquery.js | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index a8872dfb8..910c11b21 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -1345,10 +1345,7 @@ jQuery.extend({ // internal only, use is(".class") has: function( t, c ) { - t = t.className || t; - // escape regex characters - c = c.replace(/([\.\\\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1"); - return t && new RegExp("(^|\\s)" + c + "(\\s|$)").test( t ); + return jQuery.inArray( c, (t.className || t).toString().split(/\s+/) ) > -1; } }, |