htmljs-parser 5.4.2 → 5.4.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/dist/index.js CHANGED
@@ -1624,8 +1624,21 @@ var EXPRESSION = {
1624
1624
  return;
1625
1625
  }
1626
1626
  if (expression.shouldTerminate(code, this.data, this.pos)) {
1627
- this.exitState();
1628
- return;
1627
+ let wasExpression = false;
1628
+ if (expression.operators) {
1629
+ const prevNonWhitespacePos = lookBehindWhile(
1630
+ isWhitespaceCode,
1631
+ this.data,
1632
+ this.pos - 1
1633
+ );
1634
+ if (prevNonWhitespacePos > expression.start) {
1635
+ wasExpression = lookBehindForOperator(this.data, prevNonWhitespacePos) !== -1;
1636
+ }
1637
+ }
1638
+ if (!wasExpression) {
1639
+ this.exitState();
1640
+ return;
1641
+ }
1629
1642
  }
1630
1643
  }
1631
1644
  switch (code) {
@@ -2646,6 +2659,7 @@ var PARSED_STRING = {
2646
2659
  },
2647
2660
  char(code, str) {
2648
2661
  if (code === str.quoteCharCode) {
2662
+ this.startText();
2649
2663
  this.pos++;
2650
2664
  this.exitState();
2651
2665
  } else if (!states_exports.checkForPlaceholder(this, code)) {
package/dist/index.mjs CHANGED
@@ -1599,8 +1599,21 @@ var EXPRESSION = {
1599
1599
  return;
1600
1600
  }
1601
1601
  if (expression.shouldTerminate(code, this.data, this.pos)) {
1602
- this.exitState();
1603
- return;
1602
+ let wasExpression = false;
1603
+ if (expression.operators) {
1604
+ const prevNonWhitespacePos = lookBehindWhile(
1605
+ isWhitespaceCode,
1606
+ this.data,
1607
+ this.pos - 1
1608
+ );
1609
+ if (prevNonWhitespacePos > expression.start) {
1610
+ wasExpression = lookBehindForOperator(this.data, prevNonWhitespacePos) !== -1;
1611
+ }
1612
+ }
1613
+ if (!wasExpression) {
1614
+ this.exitState();
1615
+ return;
1616
+ }
1604
1617
  }
1605
1618
  }
1606
1619
  switch (code) {
@@ -2621,6 +2634,7 @@ var PARSED_STRING = {
2621
2634
  },
2622
2635
  char(code, str) {
2623
2636
  if (code === str.quoteCharCode) {
2637
+ this.startText();
2624
2638
  this.pos++;
2625
2639
  this.exitState();
2626
2640
  } else if (!states_exports.checkForPlaceholder(this, code)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "htmljs-parser",
3
3
  "description": "An HTML parser recognizes content and string placeholders and allows JavaScript expressions as attribute values",
4
- "version": "5.4.2",
4
+ "version": "5.4.3",
5
5
  "devDependencies": {
6
6
  "@changesets/changelog-github": "^0.4.7",
7
7
  "@changesets/cli": "^2.25.2",