htmljs-parser 2.11.0 → 2.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Parser.js +28 -12
- package/package.json +1 -1
- package/test/autotest/argument-tag/expected.html +7 -0
- package/test/autotest/argument-tag/input.htmljs +3 -1
- package/test/autotest/attr-method-shorthand/expected.html +15 -4
- package/test/autotest/attr-method-shorthand/input.htmljs +14 -4
- package/test/autotest/tag-var-declaration/expected.html +5 -0
- package/test/autotest/tag-var-declaration/input.htmljs +3 -1
package/Parser.js
CHANGED
|
@@ -2198,7 +2198,13 @@ class Parser extends BaseParser {
|
|
|
2198
2198
|
openTagEOL();
|
|
2199
2199
|
}
|
|
2200
2200
|
return;
|
|
2201
|
-
} else if (
|
|
2201
|
+
} else if (
|
|
2202
|
+
currentPart.parentState === STATE_TAG_NAME ||
|
|
2203
|
+
(isConcise && (
|
|
2204
|
+
currentPart.parentState === STATE_TAG_ARGS ||
|
|
2205
|
+
currentPart.parentState === STATE_WITHIN_OPEN_TAG)
|
|
2206
|
+
)
|
|
2207
|
+
) {
|
|
2202
2208
|
currentPart.endPos = parser.pos;
|
|
2203
2209
|
endExpression();
|
|
2204
2210
|
|
|
@@ -2596,11 +2602,14 @@ class Parser extends BaseParser {
|
|
|
2596
2602
|
parser.rewind(1);
|
|
2597
2603
|
parser.enterState(STATE_WITHIN_OPEN_TAG);
|
|
2598
2604
|
return;
|
|
2599
|
-
} else if (
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2605
|
+
} else if (
|
|
2606
|
+
parser.lookAtCharCodeAhead(1) === CODE_OPEN_PAREN &&
|
|
2607
|
+
(currentPart.parentState === STATE_TAG_NAME || currentPart.value)
|
|
2608
|
+
) {
|
|
2609
|
+
currentPart.value += ch;
|
|
2610
|
+
endExpression();
|
|
2611
|
+
parser.enterState(STATE_TAG_ARGS);
|
|
2612
|
+
return;
|
|
2604
2613
|
}
|
|
2605
2614
|
}
|
|
2606
2615
|
}
|
|
@@ -2648,13 +2657,20 @@ class Parser extends BaseParser {
|
|
|
2648
2657
|
|
|
2649
2658
|
char(ch, code) {
|
|
2650
2659
|
var shorthand = currentPart;
|
|
2651
|
-
if (!isConcise) {
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2660
|
+
if (code === CODE_CLOSE_ANGLE_BRACKET && !isConcise) {
|
|
2661
|
+
currentOpenTag.tagNameEnd = parser.pos;
|
|
2662
|
+
endTagNameShorthand();
|
|
2663
|
+
parser.rewind(1);
|
|
2664
|
+
return;
|
|
2665
|
+
} else if (code === CODE_FORWARD_SLASH) {
|
|
2666
|
+
currentOpenTag.tagNameEnd = parser.pos;
|
|
2667
|
+
endTagNameShorthand();
|
|
2668
|
+
parser.rewind(1);
|
|
2669
|
+
|
|
2670
|
+
if (parser.lookAtCharCodeAhead(2) !== CODE_CLOSE_ANGLE_BRACKET) {
|
|
2671
|
+
parser.enterState(STATE_TAG_VAR);
|
|
2657
2672
|
}
|
|
2673
|
+
return;
|
|
2658
2674
|
}
|
|
2659
2675
|
|
|
2660
2676
|
if (isWhitespaceCode(code)) {
|
package/package.json
CHANGED
|
@@ -26,15 +26,26 @@ text:"\n"
|
|
|
26
26
|
</foo>
|
|
27
27
|
text:"\n"
|
|
28
28
|
text:"\n"
|
|
29
|
-
<foo
|
|
29
|
+
<foo onclick=function(event) {
|
|
30
30
|
console.log("hello");
|
|
31
31
|
event.preventDefault();
|
|
32
|
-
}
|
|
32
|
+
}>
|
|
33
33
|
</foo>
|
|
34
34
|
text:"\n"
|
|
35
|
+
<foo onclick=function(event) {
|
|
36
|
+
console.log("hello");
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
}>
|
|
39
|
+
</foo>
|
|
35
40
|
text:"\n"
|
|
36
|
-
<foo
|
|
41
|
+
<foo DEFAULT=function(event) {
|
|
37
42
|
console.log("hello");
|
|
38
43
|
event.preventDefault();
|
|
39
|
-
}
|
|
44
|
+
}>
|
|
45
|
+
</foo>
|
|
46
|
+
text:"\n"
|
|
47
|
+
<foo DEFAULT=function(event) {
|
|
48
|
+
console.log("hello");
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
}>
|
|
40
51
|
</foo>
|
|
@@ -18,12 +18,22 @@
|
|
|
18
18
|
event.preventDefault();
|
|
19
19
|
}/>
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
foo onclick(event) {
|
|
22
22
|
console.log("hello");
|
|
23
23
|
event.preventDefault();
|
|
24
|
-
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
foo onclick (event) {
|
|
27
|
+
console.log("hello");
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
foo(event) {
|
|
32
|
+
console.log("hello");
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
}
|
|
25
35
|
|
|
26
|
-
|
|
36
|
+
foo (event) {
|
|
27
37
|
console.log("hello");
|
|
28
38
|
event.preventDefault();
|
|
29
|
-
}
|
|
39
|
+
}
|