Created
May 23, 2011 07:30
-
-
Save chrome/986355 to your computer and use it in GitHub Desktop.
jquery.role — sizzle edition ;)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.expr.match['ROLE'] = /\$((?:[\w\u00c0-\uFFFF\-]|\\.)+)/; | |
jQuery.expr.preFilter['ROLE'] = function( match, curLoop, inplace, result, not, isXML ) { | |
match = " " + match[1] + " "; | |
return match; | |
} | |
jQuery.expr.filter['ROLE'] = function( elem, match ) { | |
return (" " + elem.getAttribute('role') + " ").indexOf( match ) > -1; | |
} | |
for ( var type in jQuery.expr.match ) { | |
jQuery.expr.match[ type ] = new RegExp( jQuery.expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); | |
jQuery.expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + jQuery.expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num) { | |
return "\\" + (num - 0 + 1); | |
})); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment