diff --git a/src/16-:attr.js b/src/16-:attr.js index 026bf36..ed88086 100644 --- a/src/16-:attr.js +++ b/src/16-:attr.js @@ -47,7 +47,7 @@ var attrDir = Anot.directive('attr', { }, update: function(val) { var elem = this.element - var obj = {} + var obj = Object.create(null) var isSVG = rsvg.test(elem) val = toJson(val) @@ -84,6 +84,13 @@ var attrDir = Anot.directive('attr', { elem.style.cssText = obj[i] continue } + + if (i.slice(0, 6) === 'xlink:') { + var k = i + i = i.slice(6) + obj[i] = obj[k] + delete obj[k] + } // 修正这些值的显示 if (obj[i] === false || obj[i] === null || obj[i] === undefined) { obj[i] = ''