diff --git a/css.escape.js b/css.escape.js index 60edc3a..49499c1 100644 --- a/css.escape.js +++ b/css.escape.js @@ -27,10 +27,10 @@ } if ( - // If the character is in the range [\1-\1F] (U+0001 to U+001F) or - // [\7F-\9F] (U+007F to U+009F), […] + // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is + // U+007F, […] (codeUnit >= 0x0001 && codeUnit <= 0x001F) || - (codeUnit >= 0x007F && codeUnit <= 0x009F) || + codeUnit == 0x007F || // If the character is the first character and is in the range [0-9] // (U+0030 to U+0039), […] (index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) || diff --git a/tests/tests.js b/tests/tests.js index 96cd534..0220b78 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -54,7 +54,8 @@ assertEquals(CSS.escape('-9a'), '-\\39 a'); assertEquals(CSS.escape('--a'), '-\\-a'); -assertEquals(CSS.escape('\x80\x2D\x5F\xA9'), '\\80 \x2D\x5F\xA9'); +assertEquals(CSS.escape('\x80\x2D\x5F\xA9'), '\x80\x2D\x5F\xA9'); +assertEquals(CSS.escape('\x7F\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F'), '\\7f \x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F'); assertEquals(CSS.escape('\xA0\xA1\xA2'), '\xA0\xA1\xA2'); assertEquals(CSS.escape('a0123456789b'), 'a0123456789b'); assertEquals(CSS.escape('abcdefghijklmnopqrstuvwxyz'), 'abcdefghijklmnopqrstuvwxyz');