[Sie-announce] SIEコード [2504] dispatchEventメソッドの整理

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 3月 24日 (木) 20:54:08 JST


Revision: 2504
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2504
Author:   dhrname
Date:     2011-03-24 20:54:07 +0900 (Thu, 24 Mar 2011)

Log Message:
-----------
dispatchEventメソッドの整理

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:43:06 UTC (rev 2503)
+++ branches/07x/073/org/w3c/dom/events.js	2011-03-24 11:54:07 UTC (rev 2504)
@@ -113,12 +113,12 @@
     this.removeEventListener(type, listener, useCapture);  //いったん、(あれば)リスナーを離す。
     var s = new EventListener(useCapture, type, listener), //リスナーを作成
         t = type.charAt(0),
-        node, evt;
+        node;
     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(){
-        evt = node.ownerDocument.createEvent("MouseEvents");
+        var evt = node.ownerDocument.createEvent("MouseEvents");
         evt.initMouseEvent(type, true, true, node.ownerDocument.defaultView, 0);
         node.dispatchEvent(evt);
         evt = null;
@@ -145,6 +145,8 @@
   var te = this,
       td = this.ownerDocument,
       etime = evt.timeStamp,
+      etype = evt.type,
+      ebub = evt.bubbles,
       tob,
       type = /*Event.CAPTURING_PHASE*/ 1,
       tce;
@@ -192,7 +194,7 @@
     evt.eventPhase = type;
     tce = td._capter; //tceは登録しておいたリスナーのリスト
     for (var j=0,tcli=tce.length;j<tcli;++j){
-      if (tce[j] && (evt.type === tce[j]._type)) {
+      if (tce[j] && (etype === tce[j]._type)) {
         tce[j].handleEvent(evt);
       }
     }
@@ -200,7 +202,7 @@
       break; //stopPropagationメソッドが呼ばれたら、停止する
     }
     if (td === this) {
-      if (!evt.bubbles) {
+      if (!ebub) {
         break; //浮上フェーズに移行せず、停止する
       }
       type = 3;//Event.BUBBLING_PHASE;
@@ -208,7 +210,7 @@
     td = td[type];
   }
   var ed = evt._default;
-  evt = te = tce = n = td = type = tob = j = tcli =null;
+  evt = te = tce = n = td = type = tob = j = tcli = etype = etime = ebub =null;
   return ed;
 };
 




Sie-announce メーリングリストの案内
Back to archive index