[Sie-announce] SIEコード [2546] GetSVGDocumentのAjax部分について、クロージャの使用をやめることで軽量化した

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 4月 1日 (金) 23:44:29 JST


Revision: 2546
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2546
Author:   dhrname
Date:     2011-04-01 23:44:29 +0900 (Fri, 01 Apr 2011)

Log Message:
-----------
GetSVGDocumentのAjax部分について、クロージャの使用をやめることで軽量化した

Modified Paths:
--------------
    branches/07x/074/org/w3c/dom/svg.js

Modified: branches/07x/074/org/w3c/dom/svg.js
===================================================================
--- branches/07x/074/org/w3c/dom/svg.js	2011-03-31 14:51:14 UTC (rev 2545)
+++ branches/07x/074/org/w3c/dom/svg.js	2011-04-01 14:44:29 UTC (rev 2546)
@@ -1639,6 +1639,9 @@
   this._next = null;
   return this;
 }
+function _ca_() {
+  window._that._ca();
+};
  GetSVGDocument.prototype = {
   /*_initメソッド
    *object(embed)要素で指定されたSVG文書を読み込んで、SVGを処理して表示させるメソッド
@@ -1647,7 +1650,6 @@
     /*objeiはobject要素かembed要素*/
     var xmlhttp = NAIBU.xmlhttp,
         objei = this._tar,
-        that = this,
         data;
     if (this._tar.nodeName === "OBJECT") {
       data = "data";
@@ -1658,10 +1660,9 @@
     objei.style.display = "none";
     xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
     this.xmlhttp = xmlhttp;
-    /*クロージャを利用しないと、_caはグローバルオブジェクトwindowの元で実行される*/
-    xmlhttp.onreadystatechange = function() {
-      that._ca();
-    };
+    /*クロージャを利用しないことで、軽量化を計る*/
+    window._that = this;
+    xmlhttp.onreadystatechange = _ca_;
     xmlhttp.send(null);
     objei = data = null;
   },




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