Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Produce a real false value instead of "false". Quick n dirty hack to make it work #17

Merged
merged 3 commits into from
Jan 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions create.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ function create (modules, options) {
var data = {}
for (var i = 0, max = names.length; max > i; i++) {
var name = names[i]
if (input[name] === 'false') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this has broken the case where we want explicit "false" values for attributes. e.g.,

html`<img src="..."  draggable="false" />`

we end up throwing out the false attribute. This is what gets rendered:

<img src="..." />

input[name] = false
}

// Directive attributes
if (name.indexOf(directive) === 0) {
Expand Down
9 changes: 9 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ test('class attribute', function (t) {
)
})

test('non-string attribute value', function (t) {
t.plan(1)
t.is(
snabby`<input @class:x=${false}>`.data.class.x,
false,
'sets a prop to the real false value, not a string'
)
})

test('flatten array children', function (t) {
t.plan(1)
var arr = [
Expand Down