OSDN Git Service

Test Suiteのstruct-frag-05-tで、a要素の前に空白文字のテキストノードがあったため、Validという文字を表示できなかったバグを修正
authordhrname <dhrname@users.sourceforge.jp>
Sat, 3 Dec 2011 14:56:07 +0000 (23:56 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Sat, 3 Dec 2011 14:56:07 +0000 (23:56 +0900)
org/w3c/dom/svg.js

index b2e04e3..6721e26 100644 (file)
@@ -4255,8 +4255,8 @@ function SVGTextElement(_doc) {
           vis = style.getPropertyCSSValue("visibility"),
           disp = style.getPropertyCSSValue("display"),
           tts = tar._tar.style,
-          tft = tar.firstChild._tars,
-          ttt = tft[0].innerText.charAt(0), //あらかじめ初期化しておく
+          tft = tar.firstChild._tars, //空白のテキストノードの場合、tftがundefinedになる恐れがある
+          ttt = tft[0] ? tft[0].innerText.charAt(0) : [""], //あらかじめ初期化しておく
           tfti;
       if (color === "none"){
         tts.color = "transparent";
@@ -4281,7 +4281,9 @@ function SVGTextElement(_doc) {
           tfti.parentNode.removeChild(tfti);
         }
         //以下でinnerTextやinnerHTMLを使うのは、IE6でエラーとなる可能性がある
-        tft[0].replaceChild(_doc.createTextNode(ttt), tft[0].firstChild);
+        if (tft[0] && tft[0].replaceChild) {
+          tft[0].replaceChild(_doc.createTextNode(ttt), tft[0].firstChild);
+        }
         ttt = void 0;
       }
       var isRect = true,
@@ -4323,7 +4325,7 @@ function SVGTextElement(_doc) {
           ae[j]._tars[l].style.display = di;
         }
         l = void 0;
-      ++j;
+        ++j;
       }
       delete tar._cacheMatrix;
       ae = isRect = evt = tar = style = tedeco = tpp = ttpc = style = color = cursor = disp = vis = ttps = backr = backrs = di = tft = jt = void 0;