From d2b2cf81104ca014538b000acdeb5a2866312540 Mon Sep 17 00:00:00 2001 From: dhrname Date: Wed, 4 Nov 2015 22:56:04 +0900 Subject: [PATCH] Ligheten the _getAttr method --- org/w3c/dom/smil.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/org/w3c/dom/smil.js b/org/w3c/dom/smil.js index e2b78ac..00b62fb 100644 --- a/org/w3c/dom/smil.js +++ b/org/w3c/dom/smil.js @@ -795,10 +795,13 @@ base("$calcMode").up("$attribute").mix( { nameSpace = "http://www.w3.org/1999/xlink"; } var s = this._ele.getAttributeNS(nameSpace, name); - if (this.element && (s === "inherit")) { - return this.element.ownerDocument.defaultView.getComputedStyle(this.element.parentNode, "").getPropertyValue(this.attrName); - } else if (this.element && (s === "currentColor")) { - return this.element.ownerDocument.defaultView.getComputedStyle(this._ele, "").getPropertyValue("color"); + if (this.element) { + var view = this.element.ownerDocument.defaultView; + if (s === "inherit") { + return view.getComputedStyle(this.element.parentNode, "").getPropertyValue(this.attrName); + } else if (s === "currentColor") { + return view.getComputedStyle(this._ele, "").getPropertyValue("color"); + } } /*DOM Level2やIE11では、getAttributeNSメソッドは空文字を返す。他のブラウザではnullを返すことが多い * -- 2.11.0