svnno****@sourc*****
svnno****@sourc*****
2010年 10月 1日 (金) 22:15:29 JST
Revision: 2032
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2032
Author: dhrname
Date: 2010-10-01 22:15:29 +0900 (Fri, 01 Oct 2010)
Log Message:
-----------
appendChildメソッドの修正
Modified Paths:
--------------
branches/06x/061/org/w3c/core.js
Modified: branches/06x/061/org/w3c/core.js
===================================================================
--- branches/06x/061/org/w3c/core.js 2010-10-01 13:15:04 UTC (rev 2031)
+++ branches/06x/061/org/w3c/core.js 2010-10-01 13:15:29 UTC (rev 2032)
@@ -258,12 +258,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;