svnno****@sourc*****
svnno****@sourc*****
2010年 3月 10日 (水) 23:35:43 JST
Revision: 1717 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1717 Author: dhrname Date: 2010-03-10 23:35:43 +0900 (Wed, 10 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/events.js Modified: branches/ufltima/dom/events.js =================================================================== --- branches/ufltima/dom/events.js 2010-03-10 11:39:14 UTC (rev 1716) +++ branches/ufltima/dom/events.js 2010-03-10 14:35:43 UTC (rev 1717) @@ -171,9 +171,6 @@ *イベントの雛形となる。プロパティもすべて含めて、必須 */ function Event(evt) { - if (!evt) { - var evt = { ctrlKey:null, shiftKey:null, altKey:null, clientX:null, clientY:null}; - } /*DOMString*/ this.type; /*EventTarget*/ this.target; /*EventTarget*/ this.currentTarget = null; @@ -207,12 +204,22 @@ return this; }*/ /*Event*/ Document.prototype.createEvent = function( /*string*/ eventType) { - var evt = new Event(window.event); + var evt; + if (eventType === "MutationEvents") { + evt = new MutationEvent(); + } else if (eventType === "MouseEvents") { + evt = new MouseEvent(window.event); + } else if (eventType === "UIEvents") { + evt = new MouseEvent(window.event); + } else { + evt = new Event(); + } evt.type = eventType; return evt; }; function UIEvent() { + Event.call(this, arguments); /*views::AbstractView*/ this.view; /*long*/ this.detail = 0; return this; @@ -226,6 +233,7 @@ this.view = viewArg; }; function MouseEvent(evt) { + UIEvent.call(this, arguments); /*long*/ this.screenX; /*long*/ this.screenY; /*long*/ this.clientX = 0; @@ -244,6 +252,7 @@ }; function MutationEvent(){ + Event.call(this, arguments); /*Node*/ this.relatedNode; /*string*/ this.prevValue; /*string*/ this.newValue; @@ -275,7 +284,7 @@ /*Node*/ NamedNodeMap.prototype.setNamedItemNS = function(/*Node*/ arg) { var tgans = this.getNamedItemNS(arg.namespaceURI, arg.localName); /*ここから*/ - var evt = arg.ownerElement.ownerDocument.createEvent("MutationEvents"); + var evt = arg.ownerDocument.createEvent("MutationEvents"); /*ここまで追加*/ if (tgans) { //ノードがすでにあるならば、 var s = this[this._num];