Skip to content

Commit a561f4a

Browse files
committed
issue #4: '|=' attrselector ignored
1 parent 775d1e0 commit a561f4a

File tree

5 files changed

+53
-45
lines changed

5 files changed

+53
-45
lines changed

src/cssptt.js

Lines changed: 49 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,15 @@ if (global === ometajs_) {
223223
return function() {
224224
x = function() {
225225
switch (this._apply("anything")) {
226+
case "\n":
227+
return "\n";
228+
case "\r":
229+
return "\r";
226230
case "\\":
227231
return function() {
228232
this._applyWithArgs("exactly", '"');
229233
return '\\"';
230234
}.call(this);
231-
case "\n":
232-
return "\n";
233-
case "\r":
234-
return "\r";
235235
default:
236236
throw fail();
237237
}
@@ -244,15 +244,15 @@ if (global === ometajs_) {
244244
return function() {
245245
x = function() {
246246
switch (this._apply("anything")) {
247+
case "\n":
248+
return "\n";
249+
case "\r":
250+
return "\r";
247251
case "\\":
248252
return function() {
249253
this._applyWithArgs("exactly", "'");
250254
return "\\'";
251255
}.call(this);
252-
case "\n":
253-
return "\n";
254-
case "\r":
255-
return "\r";
256256
default:
257257
throw fail();
258258
}
@@ -409,6 +409,11 @@ if (global === ometajs_) {
409409
return function() {
410410
x = function() {
411411
switch (this._apply("anything")) {
412+
case "^":
413+
return function() {
414+
this._applyWithArgs("exactly", "=");
415+
return "^=";
416+
}.call(this);
412417
case "~":
413418
return function() {
414419
this._applyWithArgs("exactly", "=");
@@ -421,10 +426,10 @@ if (global === ometajs_) {
421426
this._applyWithArgs("exactly", "=");
422427
return "$=";
423428
}.call(this);
424-
case "^":
429+
case "|":
425430
return function() {
426431
this._applyWithArgs("exactly", "=");
427-
return "^=";
432+
return "|=";
428433
}.call(this);
429434
case "*":
430435
return function() {
@@ -778,6 +783,14 @@ if (global === ometajs_) {
778783
}.call(this);
779784
y = function() {
780785
switch (this._apply("anything")) {
786+
case "c":
787+
return function() {
788+
this._applyWithArgs("exactly", "h");
789+
this._applyWithArgs("exactly", "i");
790+
this._applyWithArgs("exactly", "l");
791+
this._applyWithArgs("exactly", "d");
792+
return "child";
793+
}.call(this);
781794
case "l":
782795
return function() {
783796
switch (this._apply("anything")) {
@@ -793,6 +806,14 @@ if (global === ometajs_) {
793806
case "-":
794807
return function() {
795808
switch (this._apply("anything")) {
809+
case "c":
810+
return function() {
811+
this._applyWithArgs("exactly", "h");
812+
this._applyWithArgs("exactly", "i");
813+
this._applyWithArgs("exactly", "l");
814+
this._applyWithArgs("exactly", "d");
815+
return "last-child";
816+
}.call(this);
796817
case "o":
797818
return function() {
798819
this._applyWithArgs("exactly", "f");
@@ -803,14 +824,6 @@ if (global === ometajs_) {
803824
this._applyWithArgs("exactly", "e");
804825
return "last-of-type";
805826
}.call(this);
806-
case "c":
807-
return function() {
808-
this._applyWithArgs("exactly", "h");
809-
this._applyWithArgs("exactly", "i");
810-
this._applyWithArgs("exactly", "l");
811-
this._applyWithArgs("exactly", "d");
812-
return "last-child";
813-
}.call(this);
814827
default:
815828
throw fail();
816829
}
@@ -841,14 +854,6 @@ if (global === ometajs_) {
841854
this._applyWithArgs("exactly", "e");
842855
return "of-type";
843856
}.call(this);
844-
case "c":
845-
return function() {
846-
this._applyWithArgs("exactly", "h");
847-
this._applyWithArgs("exactly", "i");
848-
this._applyWithArgs("exactly", "l");
849-
this._applyWithArgs("exactly", "d");
850-
return "child";
851-
}.call(this);
852857
default:
853858
throw fail();
854859
}
@@ -980,14 +985,15 @@ if (global === ometajs_) {
980985
return function() {
981986
t = function() {
982987
switch (this._apply("anything")) {
983-
case "f":
988+
case "*":
984989
return function() {
990+
this._applyWithArgs("exactly", "f");
985991
this._applyWithArgs("exactly", "i");
986992
this._applyWithArgs("exactly", "l");
987993
this._applyWithArgs("exactly", "t");
988994
this._applyWithArgs("exactly", "e");
989995
this._applyWithArgs("exactly", "r");
990-
return "filter";
996+
return "*filter";
991997
}.call(this);
992998
case "_":
993999
return function() {
@@ -999,6 +1005,15 @@ if (global === ometajs_) {
9991005
this._applyWithArgs("exactly", "r");
10001006
return "_filter";
10011007
}.call(this);
1008+
case "f":
1009+
return function() {
1010+
this._applyWithArgs("exactly", "i");
1011+
this._applyWithArgs("exactly", "l");
1012+
this._applyWithArgs("exactly", "t");
1013+
this._applyWithArgs("exactly", "e");
1014+
this._applyWithArgs("exactly", "r");
1015+
return "filter";
1016+
}.call(this);
10021017
case "-":
10031018
return function() {
10041019
switch (this._apply("anything")) {
@@ -1027,16 +1042,6 @@ if (global === ometajs_) {
10271042
throw fail();
10281043
}
10291044
}.call(this);
1030-
case "*":
1031-
return function() {
1032-
this._applyWithArgs("exactly", "f");
1033-
this._applyWithArgs("exactly", "i");
1034-
this._applyWithArgs("exactly", "l");
1035-
this._applyWithArgs("exactly", "t");
1036-
this._applyWithArgs("exactly", "e");
1037-
this._applyWithArgs("exactly", "r");
1038-
return "*filter";
1039-
}.call(this);
10401045
default:
10411046
throw fail();
10421047
}
@@ -1168,10 +1173,10 @@ if (global === ometajs_) {
11681173
return function() {
11691174
x = function() {
11701175
switch (this._apply("anything")) {
1171-
case "-":
1172-
return "-";
11731176
case "+":
11741177
return "+";
1178+
case "-":
1179+
return "-";
11751180
default:
11761181
throw fail();
11771182
}
@@ -1184,14 +1189,14 @@ if (global === ometajs_) {
11841189
return function() {
11851190
x = function() {
11861191
switch (this._apply("anything")) {
1187-
case ",":
1188-
return ",";
1192+
case "=":
1193+
return "=";
11891194
case ":":
11901195
return ":";
11911196
case "/":
11921197
return "/";
1193-
case "=":
1194-
return "=";
1198+
case ",":
1199+
return ",";
11951200
default:
11961201
throw fail();
11971202
}

src/parser.ometajs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ometa CSSParser {
5454

5555
s = (:x m_w(x) -> x)+:xx -> [#s, xx.join('')],
5656

57-
attrselector = (seq('=') | seq('~=') | seq('^=') | seq('$=') | seq('*=')):x -> [#attrselector, x],
57+
attrselector = (seq('=') | seq('~=') | seq('^=') | seq('$=') | seq('*=') | seq('|=')):x -> [#attrselector, x],
5858

5959
delim = ',' -> [#delim],
6060

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
|=
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
|=
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
['attrselector', '|=']

0 commit comments

Comments
 (0)