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 CHANGED
@@ -2198,7 +2198,13 @@ class Parser extends BaseParser {
2198
2198
  openTagEOL();
2199
2199
  }
2200
2200
  return;
2201
- } else if (currentPart.parentState === STATE_TAG_NAME) {
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 (parser.lookAtCharCodeAhead(1) === CODE_OPEN_PAREN && currentPart.value) {
2600
- currentPart.value += ch;
2601
- endExpression();
2602
- parser.enterState(STATE_TAG_ARGS);
2603
- return;
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
- if (code === CODE_CLOSE_ANGLE_BRACKET || code === CODE_FORWARD_SLASH) {
2653
- currentOpenTag.tagNameEnd = parser.pos;
2654
- endTagNameShorthand();
2655
- parser.rewind(1);
2656
- return;
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
@@ -40,5 +40,5 @@
40
40
  "publishConfig": {
41
41
  "registry": "https://registry.npmjs.org/"
42
42
  },
43
- "version": "2.11.0"
43
+ "version": "2.11.3"
44
44
  }
@@ -1,2 +1,9 @@
1
1
  <for ARGS=(x in y)>
2
2
  </for>
3
+ text:"\n"
4
+ <ab ARGS=('c') SELF_CLOSED>
5
+ </ab>
6
+ text:"\n"
7
+ <a ARGS=('b') SELF_CLOSED>
8
+ </a>
9
+ text:"\n"
@@ -1 +1,3 @@
1
- <for(x in y)></for>
1
+ <for(x in y)></for>
2
+ <ab('c')/>
3
+ <a('b')/>
@@ -26,15 +26,26 @@ text:"\n"
26
26
  </foo>
27
27
  text:"\n"
28
28
  text:"\n"
29
- <foo VAR=(bar) DEFAULT=function(event) {
29
+ <foo onclick=function(event) {
30
30
  console.log("hello");
31
31
  event.preventDefault();
32
- } SELF_CLOSED>
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 VAR=(bar) DEFAULT=function(event) {
41
+ <foo DEFAULT=function(event) {
37
42
  console.log("hello");
38
43
  event.preventDefault();
39
- } SELF_CLOSED>
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
- <foo/bar(event) {
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
- <foo/bar (event) {
36
+ foo (event) {
27
37
  console.log("hello");
28
38
  event.preventDefault();
29
- }/>
39
+ }
@@ -36,3 +36,8 @@ text:"\n"
36
36
  text:"\n"
37
37
  <div VAR=(ref) SELF_CLOSED>
38
38
  </div>
39
+ text:"\n"
40
+ text:"\n"
41
+ <div VAR=(ref) shorthandId="ab" shorthandClassNames=["cd"] SELF_CLOSED>
42
+ </div>
43
+ text:"\n"
@@ -16,4 +16,6 @@
16
16
  </>
17
17
 
18
18
  <div/ref/>
19
- <div/ref />
19
+ <div/ref />
20
+
21
+ <div#ab.cd/ref/>