Skip to content

Commit

Permalink
Don’t escape U+0080 to U+009F
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens committed Apr 30, 2014
1 parent 83d21b1 commit 8e44737
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions css.escape.js
Expand Up @@ -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) ||
Expand Down
3 changes: 2 additions & 1 deletion tests/tests.js
Expand Up @@ -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');
Expand Down

0 comments on commit 8e44737

Please sign in to comment.