marko 4.24.4 → 4.24.5

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [4.24.5](https://github.com/marko-js/marko/compare/v4.24.4...v4.24.5) (2022-07-14)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * ignoreUnrecognizedTags attr tags under control flow ([8e0aaf2](https://github.com/marko-js/marko/commit/8e0aaf227d4e192e3c02b494995f1f2682c4cbc3))
11
+
5
12
  ### [4.24.4](https://github.com/marko-js/marko/compare/v4.24.3...v4.24.4) (2022-03-22)
6
13
 
7
14
 
@@ -104,8 +104,16 @@ class Normalizer {
104
104
  try {
105
105
  if (elNode.rawTagNameExpression) {
106
106
  tagName = builder.parseExpression(elNode.rawTagNameExpression);
107
- } else if (context.ignoreUnrecognizedTags && !elNode.parentNode.tagDef && !elNode.parentNode.rawTagNameExpression) {
108
- tagName = tagName.replace(/^@/, "at_"); // escapes @tags inside unrecognized tags
107
+ } else if (context.ignoreUnrecognizedTags && tagName[0] === "@") {
108
+ let owner = elNode.parentNode;
109
+
110
+ while (owner && /^(?:for|while|if|else(?:-if))$/.test(owner.tagName)) {
111
+ owner = owner.parentNode;
112
+ }
113
+
114
+ if (!owner || !(owner.rawTagNameExpression || owner.tagDef)) {
115
+ tagName = "at_" + tagName.slice(1); // escapes @tags inside unrecognized tags
116
+ }
109
117
  }
110
118
  } catch (e) {
111
119
  const type = elNode.rawTagNameExpression === "()" ? "Missing" : "Invalid";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "4.24.4",
3
+ "version": "4.24.5",
4
4
  "license": "MIT",
5
5
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
6
6
  "dependencies": {
@@ -122,12 +122,16 @@ class Normalizer {
122
122
  try {
123
123
  if (elNode.rawTagNameExpression) {
124
124
  tagName = builder.parseExpression(elNode.rawTagNameExpression);
125
- } else if (
126
- context.ignoreUnrecognizedTags &&
127
- !elNode.parentNode.tagDef &&
128
- !elNode.parentNode.rawTagNameExpression
129
- ) {
130
- tagName = tagName.replace(/^@/, "at_"); // escapes @tags inside unrecognized tags
125
+ } else if (context.ignoreUnrecognizedTags && tagName[0] === "@") {
126
+ let owner = elNode.parentNode;
127
+
128
+ while (owner && /^(?:for|while|if|else(?:-if))$/.test(owner.tagName)) {
129
+ owner = owner.parentNode;
130
+ }
131
+
132
+ if (!owner || !(owner.rawTagNameExpression || owner.tagDef)) {
133
+ tagName = "at_" + tagName.slice(1); // escapes @tags inside unrecognized tags
134
+ }
131
135
  }
132
136
  } catch (e) {
133
137
  const type = elNode.rawTagNameExpression === "()" ? "Missing" : "Invalid";