svnno****@sourc*****
svnno****@sourc*****
2011年 3月 24日 (木) 21:10:48 JST
Revision: 2505 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2505 Author: dhrname Date: 2011-03-24 21:10:48 +0900 (Thu, 24 Mar 2011) Log Message: ----------- addEventListenerメソッドを修正して、マウスイベントに対処できるようにした Modified Paths: -------------- branches/07x/073/org/w3c/dom/events.js Modified: branches/07x/073/org/w3c/dom/events.js =================================================================== --- branches/07x/073/org/w3c/dom/events.js 2011-03-24 11:54:07 UTC (rev 2504) +++ branches/07x/073/org/w3c/dom/events.js 2011-03-24 12:10:48 UTC (rev 2505) @@ -113,16 +113,19 @@ this.removeEventListener(type, listener, useCapture); //いったん、(あれば)リスナーを離す。 var s = new EventListener(useCapture, type, listener), //リスナーを作成 t = type.charAt(0), - node; + that; this._capter[this._capter.length] = s; //このノードにリスナーを登録しておく - if (t !== "D" && t !== "S" && type !== "beginEvent" && type !== "endEvent" && type !== "repeatEvent") { //MouseEventsならば - node = this; - node._tar.attachEvent("on" +type, function(){ - var evt = node.ownerDocument.createEvent("MouseEvents"); - evt.initMouseEvent(type, true, true, node.ownerDocument.defaultView, 0); - node.dispatchEvent(evt); - evt = null; - }); + if ((t !== "D") && (t !== "S") && (type !== "beginEvent") && (type !== "endEvent") && (type !== "repeatEvent")) { //MouseEventsならば + that = this; + that._tar.attachEvent("on" +type, (function(node) { + return function(){ + var evt = node.ownerDocument.createEvent("MouseEvents"); + evt.initMouseEvent(type, true, true, node.ownerDocument.defaultView, 0); + node.dispatchEvent(evt); + evt = null; + }; + })(that) + ); } s = t = node = null; }catch(e){