svnno****@sourc*****
svnno****@sourc*****
2010年 3月 13日 (土) 20:12:48 JST
Revision: 1724 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1724 Author: dhrname Date: 2010-03-13 20:12:48 +0900 (Sat, 13 Mar 2010) Log Message: ----------- insertBeforeとremoveChildメソッドの部分を修正 Modified Paths: -------------- branches/ufltima/dom/events.js Modified: branches/ufltima/dom/events.js =================================================================== --- branches/ufltima/dom/events.js 2010-03-11 14:28:28 UTC (rev 1723) +++ branches/ufltima/dom/events.js 2010-03-13 11:12:48 UTC (rev 1724) @@ -290,10 +290,10 @@ /*ここから*/ var evt = this.ownerDocument.createEvent("MutationEvents"); if (!s) { //ノードがすでにあるならば - evt.initMutationEvent("DOMAttrModified", true, false, newAttr, null, newAttr.nodeName, newAttr.nodeName, MutationEvent.MODIFICATION); + evt.initMutationEvent("DOMAttrModified", true, false, newAttr, null, newAttr.nodeValue, newAttr.nodeName, MutationEvent.MODIFICATION); this.dispatchEvent(evt); //このとき、MutationEventsが発動 } else { - evt.initMutationEvent("DOMAttrModified", true, false, newAttr, null, newAttr.nodeName, newAttr.nodeName, MutationEvent.ADDITION); + evt.initMutationEvent("DOMAttrModified", true, false, newAttr, s.nodeValue, newAttr.nodeValue, newAttr.nodeName, MutationEvent.ADDITION); this.dispatchEvent(evt); } evt = null; @@ -343,12 +343,14 @@ evt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null); n.dispatchEvent(evt); var descend = this.getElementsByTagNameNS("*", "*"); //全子孫要素を取得 - for (var i=0,dli=descend.length;i<dli;++i) { - var di = descend[i]; - evt.target = di; - evt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null); - di.dispatchEvent(evt); - di = null; + if (descend) { + for (var i=0,dli=descend.length;i<dli;++i) { + var di = descend[i]; + evt.target = di; + evt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null); + di.dispatchEvent(evt); + di = null; + } } evt = descend = null; /*ここまで追加*/ @@ -369,12 +371,14 @@ evt.initMutationEvent("DOMNodeRemovedFromDocument", false, false, null, null, null, null, null); n.dispatchEvent(evt); var descend = this.getElementsByTagNameNS("*", "*"); //全子孫要素を取得 - for (var i=0,dli=descend.length;i<dli;++i) { - var di = descend[i]; - evt.target = di; - evt.initMutationEvent("DOMNodeRemovedFromDocument", false, false, null, null, null, null, null); - di.dispatchEvent(evt); - di = null; + if (descend) { + for (var i=0,dli=descend.length;i<dli;++i) { + var di = descend[i]; + evt.target = di; + evt.initMutationEvent("DOMNodeRemovedFromDocument", false, false, null, null, null, null, null); + di.dispatchEvent(evt); + di = null; + } } evt.initMutationEvent("DOMNodeRemoved", true, false, this, null, null, null, null); ele.dispatchEvent(evt);