mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Fixes #425 - Breaking change: treat concise line starting with ${ as a dynamic tag name
This commit is contained in:
parent
179a564d9a
commit
291f678492
@ -59,7 +59,7 @@
|
||||
"events": "^1.0.2",
|
||||
"events-light": "^1.0.0",
|
||||
"he": "^1.1.0",
|
||||
"htmljs-parser": "^2.0.0",
|
||||
"htmljs-parser": "^2.1.0",
|
||||
"lasso-modules-client": "^1.0.0",
|
||||
"lasso-package-root": "^1.0.0",
|
||||
"listener-tracker": "^2.0.0",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<var foo bar/>
|
||||
<assign foo=123 bar='hello'/>
|
||||
|
||||
${bar.toUpperCase()} ${foo*10}
|
||||
-- ${bar.toUpperCase()} ${foo*10}
|
||||
@ -1 +1 @@
|
||||
${"<div></div>"}
|
||||
-- ${"<div></div>"}
|
||||
@ -1 +1 @@
|
||||
${"<div></div>"} $!{"<div></div>"}
|
||||
-- ${"<div></div>"} $!{"<div></div>"}
|
||||
@ -1 +1 @@
|
||||
$!{"<div></div>"}
|
||||
-- $!{"<div></div>"}
|
||||
@ -1,4 +1,4 @@
|
||||
div -- Hello ${data.name}
|
||||
span if(data.name)
|
||||
${data.name}
|
||||
-- ${data.name}
|
||||
p else -- No name!
|
||||
|
||||
@ -0,0 +1 @@
|
||||
<hello-world class="my-class" foo="bar">My nested content</hello-world><foo class="my-class" foo="bar">My nested content</foo>
|
||||
@ -0,0 +1,5 @@
|
||||
hello-${data.myTagName} class="my-class" foo="bar"
|
||||
-- My nested content
|
||||
|
||||
${data.foo ? 'foo' : 'bar'} class="my-class" foo="bar"
|
||||
-- My nested content
|
||||
4
test/autotests/render/dynamic-tag-name-concise/test.js
Normal file
4
test/autotests/render/dynamic-tag-name-concise/test.js
Normal file
@ -0,0 +1,4 @@
|
||||
exports.templateData = {
|
||||
myTagName: 'world',
|
||||
foo: true
|
||||
};
|
||||
@ -9,4 +9,4 @@
|
||||
|
||||
<input type="checked" checked=(true ? true : false)/>
|
||||
|
||||
${count>50 ? ((name ? 'Hello ${name}! ' : '') + 'Over 50') : ((name ? 'Hello ${name}! ' : '') + '50 or less')}
|
||||
-- ${count>50 ? ((name ? 'Hello ${name}! ' : '') + 'Over 50') : ((name ? 'Hello ${name}! ' : '') + '50 or less')}
|
||||
@ -1,2 +1,2 @@
|
||||
<var name=data.name count=data.count/>
|
||||
${name != null ? "Hello ${name.toUpperCase()}! You have ${count} new messages." : null}
|
||||
-- ${name != null ? "Hello ${name.toUpperCase()}! You have ${count} new messages." : null}
|
||||
@ -18,7 +18,7 @@ html lang="en"
|
||||
|
||||
ul.features
|
||||
li for(feature in ['async', 'streaming', 'custom-tags', 'readable', 'modules'])
|
||||
${feature}
|
||||
-- ${feature}
|
||||
|
||||
ul if(data.colors && data.colors.length)
|
||||
li for(color in data.colors) -- ${color}
|
||||
|
||||
@ -18,7 +18,7 @@ html lang="en"
|
||||
|
||||
ul.features
|
||||
li for(feature in ['async', 'streaming', 'custom-tags', 'readable', 'modules'])
|
||||
${feature}
|
||||
-- ${feature}
|
||||
|
||||
ul if(data.colors && data.colors.length)
|
||||
li for(color in data.colors) -- ${color}
|
||||
|
||||
@ -6,6 +6,6 @@ html lang="en"
|
||||
h1 -- Hello ${data.name}!
|
||||
ul if(data.colors.length)
|
||||
li for(color in data.colors)
|
||||
${color}
|
||||
-- ${color}
|
||||
div else
|
||||
-- No colors!
|
||||
@ -8,6 +8,6 @@ html lang="en"
|
||||
</h1>
|
||||
ul if(data.colors.length)
|
||||
li for(color in data.colors)
|
||||
${color}
|
||||
-- ${color}
|
||||
div else
|
||||
-- No colors!
|
||||
@ -1,3 +1,3 @@
|
||||
<var name='Frank' age=10 foo/>
|
||||
|
||||
${name.toUpperCase()} ${age*365} [${foo}]
|
||||
-- ${name.toUpperCase()} ${age*365} [${foo}]
|
||||
@ -1 +1 @@
|
||||
${"WHITE SPACE"}
|
||||
-- ${"WHITE SPACE"}
|
||||
@ -1,2 +1,2 @@
|
||||
$!{data.welcome}
|
||||
${data.name}
|
||||
-- $!{data.welcome}
|
||||
-- ${data.name}
|
||||
Loading…
x
Reference in New Issue
Block a user