\r
/*アニメーションするために、対象の属性やプロパティを変化させるメソッド*/\r
setAttribute: function (value) {\r
- if (!this.attrName) {\r
+ var attrName = this.attrName;\r
+ if (!attrName) {\r
return;\r
}\r
var ele = this.element;\r
- ele.setAttributeNS(this.attrNameSpace, this.attrName, value);\r
+ ele.setAttributeNS(this.attrNameSpace, attrName, value);\r
/*スタイルシートのプロパティも上書きしておく*/\r
- ele.style.setProperty(this.attrName, value, "");\r
+ this.isCSS && ele.style.setProperty(attrName, value, "");\r
value = ele = void 0;\r
},\r
\r
/*setAttributeメソッドとは逆の効果で、無効化させるメソッド*/\r
removeAttribute: function () {\r
- if (!this.attrName) {\r
+ var attrName = this.attrName;\r
+ if (!attrName) {\r
return;\r
}\r
var ele = this.element;\r
} else {\r
/*初期段階でターゲットの要素に属性が指定されていない場合は、\r
* 現在の属性値を削除するだけでよい*/\r
- ele.removeAttributeNS(this.attrNameSpace, this.attrName);\r
+ ele.removeAttributeNS(this.attrNameSpace, attrName);\r
/*スタイルシートのプロパティも削除しておく。removePropertyでないことに注意*/\r
- this.isCSS && ele.style.setProperty(this.attrName, this.defaultValue, "");\r
+ this.isCSS && ele.style.setProperty(attrName, this.defaultValue, "");\r
}\r
value = ele = void 0;\r
},\r
*/\r
return null;\r
}\r
+ \r
+ /*属性値の設定*/\r
+ this.attrName = this.getAttr("attributeName", "");\r
+ \r
/*属性タイプの設定*/\r
var attrType = this.getAttr("attributeType", "auto");\r
var computedStyle = this.element && this.element.ownerDocument.defaultView.getComputedStyle(this.element, "");\r
this.isCSS = true;\r
} else if ((attrType === "auto") && this.element) {\r
if ( computedStyle.getPropertyValue(this.attrName) ) {\r
- this.isCSS = true;\r
+ this.isCSS = true;\r
}\r
}\r
- /*属性値の設定*/\r
- this.attrName = this.getAttr("attributeName", "");\r
+ \r
+ /*xlink関連の属性のときは名前空間を変更しておく*/\r
if (this.attrName.indexOf("xlink") > -1) {\r
this.attrNameSpace = "http://www.w3.org/1999/xlink";\r
}\r
expect(attr.setAttribute()).toBeUndefined();\r
expect(attr.setAttribute("block")).toBeUndefined();\r
expect(p4.hasAttributeNS(null, "display")).toBeFalsy();\r
+ expect(attr.isCSS).toBeFalsy();\r
+ \r
s.setAttributeNS(null, "attributeName", "display");\r
attr.push(s);\r
expect(attr.setAttribute("block")).toBeUndefined();\r
expect(p4.hasAttributeNS(null, "display")).toBeTruthy();\r
+ expect(attr.isCSS).toBeTruthy();\r
expect(p4.style.getPropertyValue("display")).toBe("block");\r
\r
p4 = document.createElementNS("http://www.w3.org/2000/svg", "g");\r