Skip to content

Commit d629efb

Browse files
substacksubstack
substack
authored and
substack
committed
Merge branch 'master' of https://github.com/jamen/hyperx
2 parents c0946cb + ddf5471 commit d629efb

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ module.exports = function (h, opts) {
175175
state = ATTR
176176
} else if (state === OPEN) {
177177
reg += c
178-
} else if (state === ATTR && /[\w-]/.test(c)) {
178+
} else if (state === ATTR && /[^\s"'=/]/.test(c)) {
179179
state = ATTR_KEY
180180
reg = c
181181
} else if (state === ATTR && /\s/.test(c)) {

test/attr.js

+12
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,15 @@ test('consecutive unquoted attributes', function (t) {
6262
t.equal(vdom.create(tree).toString(), '<div id="test" class="test"></div>')
6363
t.end()
6464
})
65+
66+
test('strange leading character attributes', function (t) {
67+
var tree = hx`<div @click='test' :href='/foo'></div>`
68+
t.equal(vdom.create(tree).toString(), '<div @click="test" :href="/foo"></div>')
69+
t.end()
70+
})
71+
72+
test('strange inbetween character attributes', function (t) {
73+
var tree = hx`<div f@o='bar' b&z='qux'></div>`
74+
t.equal(vdom.create(tree).toString(), `<div f@o="bar" b&z="qux"></div>`)
75+
t.end()
76+
})

0 commit comments

Comments
 (0)