OLD | NEW |
1 (function() | 1 (function() |
2 { | 2 { |
3 var filterClasses = require("filterClasses"); | 3 var filterClasses = require("filterClasses"); |
4 var Filter = filterClasses.Filter; | 4 var Filter = filterClasses.Filter; |
5 var ElemHideFilter = filterClasses.ElemHideFilter; | 5 var ElemHideFilter = filterClasses.ElemHideFilter; |
6 | 6 |
7 var filterComposer = require("filterComposer"); | 7 var filterComposer = require("filterComposer"); |
8 var escapeCSS = filterComposer.escapeCSS; | 8 var escapeCSS = filterComposer.escapeCSS; |
9 var quoteCSS = filterComposer.quoteCSS; | 9 var quoteCSS = filterComposer.quoteCSS; |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // is thrown when calling .querySelector() and .insertRule() | 80 // is thrown when calling .querySelector() and .insertRule() |
81 mustMatch: !/\s/.test(s) | 81 mustMatch: !/\s/.test(s) |
82 }); | 82 }); |
83 | 83 |
84 testSelector({ | 84 testSelector({ |
85 selector: "[foo=" + quoteCSS(s) + "]", | 85 selector: "[foo=" + quoteCSS(s) + "]", |
86 attributes: {foo: s} | 86 attributes: {foo: s} |
87 }); | 87 }); |
88 } | 88 } |
89 | 89 |
90 for (var i = 0; i < 0x80; i++) | 90 for (var i = 1; i < 0x80; i++) |
91 { | 91 { |
92 var chr = String.fromCharCode(i); | 92 var chr = String.fromCharCode(i); |
93 | 93 |
94 // Make sure that all ASCII characters are correctly escaped. | 94 // Make sure that all ASCII characters are correctly escaped. |
95 testEscape(chr); | 95 testEscape(chr); |
96 | 96 |
97 // Some characters are only escaped when in the first positon, | 97 // Some characters are only escaped when in the first positon, |
98 // so we still have to make sure that everything is correctly escaped | 98 // so we still have to make sure that everything is correctly escaped |
99 // in subsequent positions. | 99 // in subsequent positions. |
100 testEscape("x" + chr); | 100 testEscape("x" + chr); |
101 | 101 |
102 // Leading dashes must be escaped, when followed by certain characters. | 102 // Leading dashes must be escaped, when followed by certain characters. |
103 testEscape("-" + chr); | 103 testEscape("-" + chr); |
104 } | 104 } |
105 | 105 |
106 // Test some non-ASCII characters. However, those shouldn't require escaping
. | 106 // Test some non-ASCII characters. However, those shouldn't require escaping
. |
107 testEscape("\uD83D\uDE3B\u2665\u00E4"); | 107 testEscape("\uD83D\uDE3B\u2665\u00E4"); |
108 }); | 108 }); |
109 })(); | 109 })(); |
OLD | NEW |