documentElement.webkitMatchesSelector ||
documentElement.mozMatchesSelector ||
documentElement.oMatchesSelector ||
- documentElement.msMatchesSelector;
+ documentElement.msMatchesSelector,
+
+ // CSS string/identifier serialization
+ // https://drafts.csswg.org/cssom/#common-serializing-idioms
+ rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,
+ fcssescape = function( ch, asCodePoint ) {
+ if ( asCodePoint ) {
+
+ // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
+ if ( ch === "\0" ) {
+ return "\uFFFD";
+ }
+
+ // Control characters and (dependent upon position) numbers get escaped as code points
+ return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
+ }
+
+ // Other potentially-special ASCII characters get backslash-escaped
+ return "\\" + ch;
+ };
function sortOrder( a, b ) {
return results;
}
+function escape( sel ) {
+ return ( sel + "" ).replace( rcssescape, fcssescape );
+}
+
jQuery.extend( {
+ uniqueSort: uniqueSort,
+ unique: uniqueSort,
+ escapeSelector: escape,
find: function( selector, context, results, seed ) {
var elem, nodeType,
i = 0;
return results;
},
- uniqueSort: uniqueSort,
- unique: uniqueSort,
text: function( elem ) {
var node,
ret = "",
iframeDoc.write( "<body><form id='navigate' action='?'></form></body>" );
iframeDoc.close();
} );
+
+QUnit.test( "Ensure escapeSelector exists (escape tests in Sizzle)", function( assert ) {
+ assert.expect( 1 );
+
+ assert.equal( jQuery.escapeSelector( "#foo.bar" ), "\\#foo\\.bar", "escapeSelector present" );
+} );