Skip to content

Commit d85b56b

Browse files
josephgyoshuawuyts
authored andcommitted
Fixed issue #55 parsing void tags (#56)
1 parent 1578fb7 commit d85b56b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

index.js

+3
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ module.exports = function (h, opts) {
8787
// empty string is falsy, not well behaved value in browser
8888
cur[1][key] = key.toLowerCase()
8989
}
90+
if (parts[i][0] === CLOSE) {
91+
i--
92+
}
9093
break
9194
}
9295
}

test/key.js

+7
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,10 @@ test('multiple keys dont overwrite existing ones', function (t) {
6363
t.equal(vdom.create(tree).toString(), '<input type="date" />')
6464
t.end()
6565
})
66+
67+
// https://github.com/choojs/hyperx/issues/55
68+
test('unquoted key does not make void element eat adjacent elements', function (t) {
69+
var tree = hx`<span><input type=text>sometext</span>`
70+
t.equal(vdom.create(tree).toString(), '<span><input type="text" />sometext</span>')
71+
t.end()
72+
})

0 commit comments

Comments
 (0)