Skip to content

Commit

Permalink
Parse unquoted attributes.
Browse files Browse the repository at this point in the history
Closes #181.
  • Loading branch information
flatheadmill committed Dec 10, 2013
1 parent 42ce224 commit 909c6ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions parser.js
Expand Up @@ -66,6 +66,8 @@ function parse (source) {
expect(/^'$/)
break
default:
gather(/^[^\s>]$/, Infinity, true)
break
}
return token()
}
Expand Down
14 changes: 13 additions & 1 deletion t/parser/attributes.t.js
@@ -1,4 +1,4 @@
require('proof')(2, function (deepEqual) {
require('proof')(3, function (deepEqual) {
var parser = require('../../parser')
var tree = parser('<html lang="en"></html>')
deepEqual(tree, {
Expand All @@ -23,4 +23,16 @@ require('proof')(2, function (deepEqual) {
children: []
}]
}, 'parse single quoted attribute')

tree = parser("<html foo=bar lang=en></html>")
deepEqual(tree, {
type: 'document',
children:
[{
type: 'element',
name: 'html',
attributes: [ { name: 'foo', value: 'bar' }, { name: 'lang', value: 'en' } ],
children: []
}]
}, 'parse unquoted attribute')
})

0 comments on commit 909c6ae

Please sign in to comment.