Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'bugs/quoted-attrs'

  • Loading branch information...
commit 2f0a4973f86960c15a4dbd073b334900f34e92a1 2 parents 690350e + 77023d7
@tj tj authored
Showing with 7 additions and 1 deletion.
  1. +1 −1  lib/lexer.js
  2. +6 −0 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
6 test/jade.test.js
@@ -476,6 +476,12 @@ module.exports = {
assert.equal('<div style="color: white"></div>', render("div(style='color: white')"), 'Test attrs that contain attr separators');
assert.equal('<p class="foo"></p>', render("p('class'='foo')"), 'Test keys with single quotes');
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 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 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.