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