svnno****@sourc*****
svnno****@sourc*****
2010年 10月 1日 (金) 22:15:04 JST
Revision: 2031 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2031 Author: dhrname Date: 2010-10-01 22:15:04 +0900 (Fri, 01 Oct 2010) Log Message: ----------- appendChildメソッドの修正 Modified Paths: -------------- branches/06x/061/org/w3c/dom/events.js Modified: branches/06x/061/org/w3c/dom/events.js =================================================================== --- branches/06x/061/org/w3c/dom/events.js 2010-10-01 13:11:44 UTC (rev 2030) +++ branches/06x/061/org/w3c/dom/events.js 2010-10-01 13:15:04 UTC (rev 2031) @@ -380,12 +380,19 @@ } if (!ref) { //参照要素がNULLの場合、要素を追加する(appendChildと同じ効果) this.childNodes[this.childNodes.length] = n; - n.previousSibling = this.lastChild; + if (this.lastChild) { + n.previousSibling = this.lastChild; + this.lastChild.nextSibling = n; + } } else { if (ref.parentNode !== this) { //参照ノードが子要素でない場合 throw (new DOMException(DOMException.NOT_FOUND_ERR)); } this.childNodes.splice(ref._num,1,n,ref); //Arrayのspliceを利用して、リストにnノードを追加 + var rp = ref.previousSibling; + if (rp) { + rp.nextSibling = n; + } ref.previousSibling = n; } n.nextSibling = ref;