htmljs-parser 2.10.0 → 2.11.2

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
@@ -429,16 +429,6 @@ class Parser extends BaseParser {
429
429
  }
430
430
  }
431
431
  }
432
-
433
- if (currentOpenTag.hasUnenclosedWhitespace && attributes.length > 1) {
434
- for(let i = 0; i < attributes.length-1; i++) {
435
- if(!attributes[i].endedWithComma) {
436
- notifyError(attributes[i].pos,
437
- 'COMMAS_REQUIRED',
438
- 'commas are required to separate all attributes when using complex attribute values with un-enclosed whitespace');
439
- }
440
- }
441
- }
442
432
  }
443
433
 
444
434
 
@@ -2208,7 +2198,13 @@ class Parser extends BaseParser {
2208
2198
  openTagEOL();
2209
2199
  }
2210
2200
  return;
2211
- } 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
+ ) {
2212
2208
  currentPart.endPos = parser.pos;
2213
2209
  endExpression();
2214
2210
 
@@ -2606,11 +2602,14 @@ class Parser extends BaseParser {
2606
2602
  parser.rewind(1);
2607
2603
  parser.enterState(STATE_WITHIN_OPEN_TAG);
2608
2604
  return;
2609
- } else if (parser.lookAtCharCodeAhead(1) === CODE_OPEN_PAREN && currentPart.value) {
2610
- currentPart.value += ch;
2611
- endExpression();
2612
- parser.enterState(STATE_TAG_ARGS);
2613
- 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;
2614
2613
  }
2615
2614
  }
2616
2615
  }
package/package.json CHANGED
@@ -40,5 +40,5 @@
40
40
  "publishConfig": {
41
41
  "registry": "https://registry.npmjs.org/"
42
42
  },
43
- "version": "2.10.0"
43
+ "version": "2.11.2"
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')/>
@@ -1,40 +1,14 @@
1
- <foo onclick=function(event) {
2
- console.log("hello");
3
- event.preventDefault();
4
- } SELF_CLOSED>
5
- </foo>
6
- text:"\n"
7
- text:"\n"
8
- <foo onclick=function(event) {
9
- console.log("hello");
10
- event.preventDefault();
11
- } SELF_CLOSED>
12
- </foo>
13
- text:"\n"
14
- text:"\n"
15
- <foo DEFAULT=function(event) {
16
- console.log("hello");
17
- event.preventDefault();
18
- } SELF_CLOSED>
19
- </foo>
20
- text:"\n"
21
- text:"\n"
22
- <foo DEFAULT=function(event) {
23
- console.log("hello");
24
- event.preventDefault();
25
- } SELF_CLOSED>
26
- </foo>
27
- text:"\n"
28
- text:"\n"
29
- <foo VAR=(bar) DEFAULT=function(event) {
30
- console.log("hello");
31
- event.preventDefault();
32
- } SELF_CLOSED>
33
- </foo>
34
- text:"\n"
35
- text:"\n"
36
- <foo VAR=(bar) DEFAULT=function(event) {
37
- console.log("hello");
38
- event.preventDefault();
39
- } SELF_CLOSED>
40
- </foo>
1
+ <let VAR=(count) DEFAULT=0>
2
+ </let>
3
+ <effect DEFAULT=function() {
4
+ const interval = setInterval(() => {
5
+ count += 1
6
+ }, 1000);
7
+ return () => clearInterval(interval)
8
+ }>
9
+ </effect>
10
+ <div>
11
+ text:"The count is "
12
+ ${"$escapeXml(count)"}
13
+ text:"!"
14
+ </div>
@@ -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
+ }
@@ -0,0 +1,5 @@
1
+ <test a=(123 + 456) b=789>
2
+ </test>
3
+ text:"\n"
4
+ <test a=123 b=(456 + 789)>
5
+ </test>
@@ -1 +0,0 @@
1
- error:"commas are required to separate all attributes when using complex attribute values with un-enclosed whitespace" (code: "COMMAS_REQUIRED")