svnno****@sourc*****
svnno****@sourc*****
2010年 6月 19日 (土) 23:41:21 JST
Revision: 1902 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1902 Author: dhrname Date: 2010-06-19 23:41:21 +0900 (Sat, 19 Jun 2010) Log Message: ----------- appendChildだけではなくて、insertBeforeメソッドにも対応 Modified Paths: -------------- branches/06x/061/org/w3c/dom/svg.js Modified: branches/06x/061/org/w3c/dom/svg.js =================================================================== --- branches/06x/061/org/w3c/dom/svg.js 2010-06-19 14:11:07 UTC (rev 1901) +++ branches/06x/061/org/w3c/dom/svg.js 2010-06-19 14:41:21 UTC (rev 1902) @@ -1198,8 +1198,10 @@ return; //強制終了させる } if (tar.nextSibling) { - tar.parentNode._tar.insertBefore(tar._tar, tar.nextSibling._tar); - } else { + if (!!tar.parentNode._tar && !!tar.nextSibling._tar) { + tar.parentNode._tar.insertBefore(tar._tar, tar.nextSibling._tar); + } + } else if (!!tar.parentNode._tar){ tar.parentNode._tar.appendChild(tar._tar); } evt.target.addEventListener("DOMAttrModified", function(evt){ @@ -2248,7 +2250,11 @@ if (evt.eventPhase === Event.BUBBLING_PHASE) { return; //強制終了させる } - if (tar.parentNode._tar) { + if (tar.nextSibling) { + if (!!tar.parentNode._tar && !!tar.nextSibling._tar) { + tar.parentNode._tar.insertBefore(tar._tar, tar.nextSibling._tar); + } + } else if (!!tar.parentNode._tar){ tar.parentNode._tar.appendChild(tar._tar); } tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt){ @@ -2469,7 +2475,13 @@ return; //強制終了させる } var tar = evt.target; - tar.parentNode._tar.appendChild(tar._tar); + if (tar.nextSibling) { + if (!!tar.parentNode._tar && !!tar.nextSibling._tar) { + tar.parentNode._tar.insertBefore(tar._tar, tar.nextSibling._tar); + } + } else if (!!tar.parentNode._tar){ + tar.parentNode._tar.appendChild(tar._tar); + } tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { var tar = evt.target; var rx = tar.hasAttributeNS(null, "rx"), ry = tar.hasAttributeNS(null, "ry"); @@ -2538,7 +2550,13 @@ return; //強制終了させる } var tar = evt.target; - tar.parentNode._tar.appendChild(tar._tar); + if (tar.nextSibling) { + if (!!tar.parentNode._tar && !!tar.nextSibling._tar) { + tar.parentNode._tar.insertBefore(tar._tar, tar.nextSibling._tar); + } + } else if (!!tar.parentNode._tar){ + tar.parentNode._tar.appendChild(tar._tar); + } tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { var tar = evt.target; var cx = tar.cx.baseVal.value, cy = tar.cy.baseVal.value, rx = ry = tar.r.baseVal.value; @@ -2590,7 +2608,13 @@ return; //強制終了させる } var tar = evt.target; - tar.parentNode._tar.appendChild(tar._tar); + if (tar.nextSibling) { + if (!!tar.parentNode._tar && !!tar.nextSibling._tar) { + tar.parentNode._tar.insertBefore(tar._tar, tar.nextSibling._tar); + } + } else if (!!tar.parentNode._tar){ + tar.parentNode._tar.appendChild(tar._tar); + } tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { var tar = evt.target; var cx = tar.cx.baseVal.value, cy = tar.cy.baseVal.value, rx = tar.rx.baseVal.value, ry = tar.ry.baseVal.value; @@ -2642,7 +2666,13 @@ return; //強制終了させる } var tar = evt.target; - tar.parentNode._tar.appendChild(tar._tar); + if (tar.nextSibling) { + if (!!tar.parentNode._tar && !!tar.nextSibling._tar) { + tar.parentNode._tar.insertBefore(tar._tar, tar.nextSibling._tar); + } + } else if (!!tar.parentNode._tar){ + tar.parentNode._tar.appendChild(tar._tar); + } tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { var tar = evt.target; var list = ["m", tar.x1.baseVal.value, tar.y1.baseVal.value, "l", tar.x2.baseVal.value, tar.y2.baseVal.value]; @@ -2707,7 +2737,13 @@ return; //強制終了させる } var tar = evt.target; - tar.parentNode._tar.appendChild(tar._tar); + if (tar.nextSibling) { + if (!!tar.parentNode._tar && !!tar.nextSibling._tar) { + tar.parentNode._tar.insertBefore(tar._tar, tar.nextSibling._tar); + } + } else if (!!tar.parentNode._tar){ + tar.parentNode._tar.appendChild(tar._tar); + } tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { var tar = evt.target, tp = tar.points; //以下は、配列listそのものをCTMで座標変換していく処理 @@ -2764,7 +2800,13 @@ return; //強制終了させる } var tar = evt.target; - tar.parentNode._tar.appendChild(tar._tar); + if (tar.nextSibling) { + if (!!tar.parentNode._tar && !!tar.nextSibling._tar) { + tar.parentNode._tar.insertBefore(tar._tar, tar.nextSibling._tar); + } + } else if (!!tar.parentNode._tar){ + tar.parentNode._tar.appendChild(tar._tar); + } tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { var tar = evt.target, tp = tar.points; //以下は、配列listそのものをCTMで座標変換していく処理 @@ -3071,7 +3113,13 @@ backr.filled = "false"; ttp.appendChild(backr); } - tar.parentNode._tar.appendChild(ttp); + if (tar.nextSibling) { + if (!!tar.parentNode._tar && !!tar.nextSibling._tar) { + tar.parentNode._tar.insertBefore(ttp, tar.nextSibling._tar); + } + } else if (!!tar.parentNode._tar){ + tar.parentNode._tar.appendChild(ttp); + } } tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { var tar = evt.target, ti = tar.firstChild; @@ -3573,15 +3621,19 @@ if (evt.eventPhase === Event.BUBBLING_PHASE) { return; //強制終了させる } - if (tar.parentNode._tar) { + if (tar.nextSibling) { + if (!!tar.parentNode._tar && !!tar.nextSibling._tar) { + tar.parentNode._tar.insertBefore(tar._tar, tar.nextSibling._tar); + } + } else if (!!tar.parentNode._tar){ tar.parentNode._tar.appendChild(tar._tar); - var txts = tar._tar.style; - txts.cursor = "hand"; - txts.left = "0px"; - txts.top = "0px"; - txts.textDecoration = "none"; - txts = null; } + var txts = tar._tar.style; + txts.cursor = "hand"; + txts.left = "0px"; + txts.top = "0px"; + txts.textDecoration = "none"; + txts = null; var t = tar.target.baseVal; var st = "replace"; if (t === "_blank") {