2 // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters
3 import { whitespace
} from "../var/whitespace.js";
5 var runescape
= new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace
+
6 "?|\\\\([^\\r\\n\\f])", "g" ),
7 funescape = function( escape
, nonHex
) {
8 var high
= "0x" + escape
.slice( 1 ) - 0x10000;
12 // Strip the backslash prefix from a non-hex escape sequence
16 // Replace a hexadecimal escape sequence with the encoded Unicode code point
18 // For values outside the Basic Multilingual Plane (BMP), manually construct a
21 String
.fromCharCode( high
+ 0x10000 ) :
22 String
.fromCharCode( high
>> 10 | 0xD800, high
& 0x3FF | 0xDC00 );
25 export function unescapeSelector( sel
) {
26 return sel
.replace( runescape
, funescape
);