1 import { jQuery
} from "../core.js";
3 // CSS string/identifier serialization
4 // https://drafts.csswg.org/cssom/#common-serializing-idioms
5 var rcssescape
= /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
7 function fcssescape( ch
, asCodePoint
) {
10 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
15 // Control characters and (dependent upon position) numbers get escaped as code points
16 return ch
.slice( 0, -1 ) + "\\" + ch
.charCodeAt( ch
.length
- 1 ).toString( 16 ) + " ";
19 // Other potentially-special ASCII characters get backslash-escaped
23 jQuery
.escapeSelector = function( sel
) {
24 return ( sel
+ "" ).replace( rcssescape
, fcssescape
);