olum-compiler 1.9.5 → 1.9.6
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/lib/changes.txt +8 -0
- package/lib/events.js +9 -7
- package/package.json +1 -1
- package/tests/compiler.test.js +3 -2
package/lib/changes.txt
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
change /tmp/olum-dev-test-bTmY24/src/page.html
|
|
2
|
+
change /tmp/olum-dev-test-bTmY24/public/main.css
|
|
3
|
+
addDir /tmp/olum-dev-test-bTmY24/src/blog
|
|
4
|
+
add /tmp/olum-dev-test-bTmY24/src/blog/page.html
|
|
5
|
+
unlink /tmp/olum-dev-test-bTmY24/src/blog/page.html
|
|
6
|
+
unlinkDir /tmp/olum-dev-test-bTmY24/src/blog
|
|
7
|
+
change /tmp/olum-dev-test-bTmY24/src/util.js
|
|
8
|
+
change /tmp/olum-dev-test-bTmY24/src/page.html
|
package/lib/events.js
CHANGED
|
@@ -134,19 +134,21 @@ function handleEvents(body, counter, filePath, anonHandlers, propsAliases) {
|
|
|
134
134
|
return str.replace(/\$event/g, "'$event'");
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
const encodeArgs = (args) =>
|
|
138
|
+
"${encodeURIComponent(JSON.stringify([" +
|
|
139
|
+
args +
|
|
140
|
+
"])).replace(/'/g,'%27')}";
|
|
141
|
+
|
|
137
142
|
let chain = e + "|";
|
|
138
143
|
methodsNames.forEach((item, index) => {
|
|
139
144
|
if (index === methodsNames.length - 1)
|
|
140
145
|
return (chain +=
|
|
141
146
|
item +
|
|
142
|
-
"
|
|
143
|
-
handle$event(methodsArgs[index]) +
|
|
144
|
-
"
|
|
147
|
+
"=" +
|
|
148
|
+
encodeArgs(handle$event(methodsArgs[index])) +
|
|
149
|
+
"-]]-");
|
|
145
150
|
chain +=
|
|
146
|
-
item +
|
|
147
|
-
"=${JSON.stringify([" +
|
|
148
|
-
handle$event(methodsArgs[index]) +
|
|
149
|
-
"])}&";
|
|
151
|
+
item + "=" + encodeArgs(handle$event(methodsArgs[index])) + "&";
|
|
150
152
|
});
|
|
151
153
|
|
|
152
154
|
chain = chain.replace(/{/g, "<-olum->");
|
package/package.json
CHANGED
package/tests/compiler.test.js
CHANGED
|
@@ -281,8 +281,9 @@ check(
|
|
|
281
281
|
"$event is forwarded to the handler",
|
|
282
282
|
comp(`<input oninput="setVal($event)" />`, `const setVal = (e) => 0;`),
|
|
283
283
|
(out) =>
|
|
284
|
-
/oninput\|setVal=\$\{JSON\.stringify\(\['\$event'\]\)\
|
|
285
|
-
|
|
284
|
+
/oninput\|setVal=\$\{encodeURIComponent\(JSON\.stringify\(\['\$event'\]\)\)/.test(
|
|
285
|
+
tmpl(out),
|
|
286
|
+
) && parses(out),
|
|
286
287
|
);
|
|
287
288
|
check(
|
|
288
289
|
"inline arrow handler becomes a named __olumAnon_ method",
|