Просмотр исходного кода

do not copy attributes containing special chars during transclusion

Evan You 10 лет назад
Родитель
Сommit
2862d97a39
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      src/compiler/transclude.js

+ 2 - 1
src/compiler/transclude.js

@@ -1,6 +1,7 @@
 var _ = require('../util')
 var _ = require('../util')
 var config = require('../config')
 var config = require('../config')
 var templateParser = require('../parsers/template')
 var templateParser = require('../parsers/template')
+var specialCharRE = /[#@\*\$\.]/
 
 
 /**
 /**
  * Process an element or a DocumentFragment based on a
  * Process an element or a DocumentFragment based on a
@@ -134,7 +135,7 @@ function mergeAttrs (from, to) {
   while (i--) {
   while (i--) {
     name = attrs[i].name
     name = attrs[i].name
     value = attrs[i].value
     value = attrs[i].value
-    if (!to.hasAttribute(name)) {
+    if (!to.hasAttribute(name) && !specialCharRE.test(name)) {
       to.setAttribute(name, value)
       to.setAttribute(name, value)
     } else if (name === 'class') {
     } else if (name === 'class') {
       value = to.getAttribute(name) + ' ' + value
       value = to.getAttribute(name) + ' ' + value