Skip to content
Open
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
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function context () {
e.setAttribute(v, l[k][v])
}
}
else if (k.substr(0, 5) === "data-") {
else if (/^(data|aria)-/.test(k)) {
e.setAttribute(k, l[k])
} else {
e[k] = l[k]
Expand Down
6 changes: 6 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ test('sets data attributes', function(t){
t.end()
})

test('sets aria attributes', function(t){
var div = h('div', {'aria-label': 'Close'})
t.equal(div.getAttribute('aria-label'), 'Close')
t.end()
})

test('boolean, number, date, regex get to-string\'ed', function(t){
var e = h('p', true, false, 4, new Date('Mon Jan 15 2001'), /hello/)
t.assert(e.outerHTML.match(/<p>truefalse4Mon Jan 15.+2001.*\/hello\/<\/p>/))
Expand Down