svnno****@sourc*****
svnno****@sourc*****
2011年 1月 31日 (月) 23:28:37 JST
Revision: 2349
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2349
Author: dhrname
Date: 2011-01-31 23:28:36 +0900 (Mon, 31 Jan 2011)
Log Message:
-----------
dispatchEventメソッドにバッファリング処理を追加
Modified Paths:
--------------
branches/06x/069/org/w3c/dom/events.js
Modified: branches/06x/069/org/w3c/dom/events.js
===================================================================
--- branches/06x/069/org/w3c/dom/events.js 2011-01-31 14:27:27 UTC (rev 2348)
+++ branches/06x/069/org/w3c/dom/events.js 2011-01-31 14:28:36 UTC (rev 2349)
@@ -140,31 +140,44 @@
if (!evt.type || evt.type === "") { //Eventの型が設定されていないとき
throw new EventException(EventException.UNSPECIFIED_EVENT_TYPE_ERR);
}
+ if (!this.ownerDocument._isLoaded) {
+ if (evt.type === "SVGLoad") {
+ this.ownerDocument._isLoaded = 1;
+ }
+ if (!this.ownerDocument._limit_time_) {
+ this.ownerDocument._limit_time_ = evt.timeStamp;
+ } else {
+ var time = this.ownerDocument._limit_time_;
+ if ((evt.timeStamp - time) > 1000) {
+ if (this.ownerDocument.implementation._buffer_) {
+ /*1秒を超えたらバッファにため込んで後で使う*/
+ var tob = this.ownerDocument.implementation._buffer_;
+ tob[tob.length] = this;
+ tob[tob.length] = evt;
+ } else {
+ this.ownerDocument.implementation._buffer_ = [];
+ }
+ return true;
+ }
+ }
+ }
evt.target = this;
evt.eventPhase = 1;//Event.CAPTURING_PHASE
var te = this;
//このノードからドキュメントノードにいたるまでの、DOMツリーのリストを作成しておく
var td = this.ownerDocument;
td[/*Event.BUBBLING_PHASE*/ 3] = null;
- if (!te.parentNode) {
- /*もし、親要素がなければ、
- *ドキュメントから直接、イベントを発火させるようにする
- */
- td[/*Event.CAPTURING_PHASE*/ 1] = te;
- te[/*Event.BUBBLING_PHASE*/ 3] = td;
- } else {
- /*以下の処理では、documentElementのparentNodeが
- *Documentノードではなく、nullになっていることを前提としている。
- *したがって、documentElementのparentNodeがもし、Documentノードのオブジェクトならば、以下を書き換えるべきである
- */
- while (te.parentNode) {
- te.parentNode[/*Event.CAPTURING_PHASE*/ 1] = te;
- te[/*Event.BUBBLING_PHASE*/ 3] = te.parentNode;
- te = te.parentNode;
- }
- td[/*Event.CAPTURING_PHASE*/ 1] = te;
- te[/*Event.BUBBLING_PHASE*/ 3] = td;
+ /*以下の処理では、documentElementのparentNodeが
+ *Documentノードではなく、nullになっていることを前提としている。
+ *したがって、documentElementのparentNodeがもし、Documentノードのオブジェクトならば、以下を書き換えるべきである
+ */
+ while (te.parentNode) {
+ te.parentNode[/*Event.CAPTURING_PHASE*/ 1] = te;
+ te[/*Event.BUBBLING_PHASE*/ 3] = te.parentNode;
+ te = te.parentNode;
}
+ td[/*Event.CAPTURING_PHASE*/ 1] = te;
+ te[/*Event.BUBBLING_PHASE*/ 3] = td;
/*最初に捕獲フェーズでDOMツリーを下っていき、イベントのターゲットについたら、
*そこで、浮上フェーズとして折り返すように、反復処理をおこなう。
*/