Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixing attribute interpolation escaping #731

  • Loading branch information...
commit b1e8c58d1ac47800dd0f4969c8ec2bc9ba5f537b 1 parent b47d9cc
@naltatis authored
View
10 lib/lexer.js
@@ -4,6 +4,8 @@
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
+var utils = require('./utils');
+
/**
* Initialize `Lexer` with the given `str`.
@@ -502,12 +504,6 @@ Lexer.prototype = {
return states[states.length - 1];
}
- function interpolate(attr) {
- return attr.replace(/#\{([^}]+)\}/g, function(_, expr){
- return quote + " + (" + expr + ") + " + quote;
- });
- }
-
this.consume(index + 1);
tok.attrs = {};
tok.escaped = {};
@@ -535,7 +531,7 @@ Lexer.prototype = {
tok.escaped[key] = escapedAttr;
tok.attrs[key] = '' == val
? true
- : interpolate(val);
+ : utils.interpolate(val);
key = val = '';
}
break;
View
2  test/cases/attrs.interpolation.html
@@ -1 +1 @@
-<a href="/user/5"></a>
View
2  test/cases/attrs.interpolation.jade
@@ -1,2 +1,2 @@
- var id = 5
-a(href='/user/#{id}')
Please sign in to comment.
Something went wrong with that request. Please try again.