Skip to content

Commit 3180eab

Browse files
author
Evan You
committed
fix vuejs#253 attribute names with colons
1 parent eef00d6 commit 3180eab

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/compiler.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,8 @@ CompilerProto.compileElement = function (node, root) {
552552
// non directive attribute, check interpolation tags
553553
exp = TextParser.parseAttr(attr.value)
554554
if (exp) {
555-
directive = this.parseDirective('attr', attr.name + ':' + exp, node)
555+
directive = this.parseDirective('attr', exp, node)
556+
directive.arg = attr.name
556557
if (params && params.indexOf(attr.name) > -1) {
557558
// a param attribute... we should use the parent binding
558559
// to avoid circular updates like size={{size}}

test/unit/specs/misc.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,4 +285,18 @@ describe('Misc Features', function () {
285285

286286
})
287287

288+
describe('attribute names with colons', function () {
289+
290+
it('should be parsed properly', function () {
291+
var t = new Vue({
292+
template: '<use xlink:href="{{icon}}"></use>',
293+
data: {
294+
icon: 'test'
295+
}
296+
})
297+
assert.equal(t.$el.firstChild.getAttribute('xlink:href'), 'test')
298+
})
299+
300+
})
301+
288302
})

0 commit comments

Comments
 (0)