This repository has been archived on 2023-08-29. You can view files and clone it, but cannot push or open issues/pull-requests.
yutent
/
anot.js
Archived
1
0
Fork 0

优化xlink

master 2.2.2
宇天 2020-07-06 14:46:15 +08:00
parent ccfd33529c
commit 275f6700a2
1 changed files with 8 additions and 1 deletions

View File

@ -47,7 +47,7 @@ var attrDir = Anot.directive('attr', {
}, },
update: function(val) { update: function(val) {
var elem = this.element var elem = this.element
var obj = {} var obj = Object.create(null)
var isSVG = rsvg.test(elem) var isSVG = rsvg.test(elem)
val = toJson(val) val = toJson(val)
@ -84,6 +84,13 @@ var attrDir = Anot.directive('attr', {
elem.style.cssText = obj[i] elem.style.cssText = obj[i]
continue 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) { if (obj[i] === false || obj[i] === null || obj[i] === undefined) {
obj[i] = '' obj[i] = ''