From 275f6700a238e7da15a503938e80c72d2255c679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Mon, 6 Jul 2020 14:46:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96xlink?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/16-:attr.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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] = ''