[Sie-announce] SIEコード [2382] Eventオブジェクトの生成において、createEventメソッドを修正し、Dateオブジェクトの生成を抑制して、軽量化

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 2月 12日 (土) 23:23:24 JST


Revision: 2382
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2382
Author:   dhrname
Date:     2011-02-12 23:23:24 +0900 (Sat, 12 Feb 2011)

Log Message:
-----------
Eventオブジェクトの生成において、createEventメソッドを修正し、Dateオブジェクトの生成を抑制して、軽量化

Modified Paths:
--------------
    branches/07x/070/org/w3c/dom/events.js

Modified: branches/07x/070/org/w3c/dom/events.js
===================================================================
--- branches/07x/070/org/w3c/dom/events.js	2011-02-10 13:56:05 UTC (rev 2381)
+++ branches/07x/070/org/w3c/dom/events.js	2011-02-12 14:23:24 UTC (rev 2382)
@@ -242,7 +242,6 @@
  *イベントの雛形となる。プロパティもすべて含めて、必須
  */
 function Event() {
-  /*DOMTimeStamp*/     this.timeStamp = +(new Date());
   return this;
 };
 // PhaseType
@@ -250,6 +249,7 @@
 /*unsigned short*/ Event.AT_TARGET         = 2;
 /*unsigned short*/ Event.BUBBLING_PHASE    = 3;
 Event.prototype = {
+  /*DOMTimeStamp*/     timeStamp : 0,
   /*DOMString*/        type : null,
   /*EventTarget*/      target : null,
   /*EventTarget*/      currentTarget : null,
@@ -276,6 +276,10 @@
 function DocumentEvent() {
   return this;
 }*/
+/*_date_プロパティは、createEventメソッドで使われるために、
+ *あらかじめ、Dateオブジェクトを作成しておいて、それを入れるプロパティ
+ */
+Document.prototype._date_ = new Date();
 /*Event*/ Document.prototype.createEvent = function( /*string*/ eventType) {
   var evt;
   if (eventType === "MutationEvents") {
@@ -292,6 +296,7 @@
     evt =  new Event();
   }
   evt.type = eventType;
+  evt.timeStamp = this._date_.getTime();
   return evt;
 };
 




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