Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed quoted attributes

  • Loading branch information...
commit 77023d75fd5f598a86166286ee04babfb9f3262b 1 parent 6e00dc4
@tj tj authored
Showing with 4 additions and 3 deletions.
  1. +1 −1  lib/lexer.js
  2. +3 −2 test/jade.test.js
View
2  lib/lexer.js
@@ -228,7 +228,7 @@ Lexer.prototype = {
if (captures = /^\((.+)\)/.exec(this.input)) {
this.consume(captures[0].length);
var tok = this.tok('attrs', captures[1]),
- attrs = tok.val.split(/ *, *(?=[\w-]+ *[:=]|[\w-]+ *$)/);
+ attrs = tok.val.split(/ *, *(?=['"\w-]+ *[:=]|[\w-]+ *$)/);
tok.attrs = {};
for (var i = 0, len = attrs.length; i < len; ++i) {
var pair = attrs[i];
View
5 test/jade.test.js
@@ -478,9 +478,10 @@ module.exports = {
assert.equal('<p class="foo"></p>', render("p(\"class\": 'foo')"), 'Test keys with double quotes');
assert.equal('<p data-dynamic="true"></p>', render('p("data-dynamic": "true")'));
- assert.equal('<p class="name" data-dynamic="true"></p>', render('p("class": "name", "data-dynamic": "true")'));
+ assert.equal('<p data-dynamic="true" class="name"></p>', render('p("class": "name", "data-dynamic": "true")'));
assert.equal('<p data-dynamic="true"></p>', render('p(\'data-dynamic\': "true")'));
- assert.equal('<p class="name" data-dynamic="true"></p>', render('p(\'class\': "name", \'data-dynamic\': "true")'));
+ assert.equal('<p data-dynamic="true" class="name"></p>', render('p(\'class\': "name", \'data-dynamic\': "true")'));
+ assert.equal('<p data-dynamic="true" yay="yay" class="name"></p>', render('p(\'class\': "name", \'data-dynamic\': "true", yay)'));
},
'test code attrs': function(assert){
Please sign in to comment.
Something went wrong with that request. Please try again.