[Sie-announce] SIEコード [1774] getElementByIdメソッドを修正

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 4月 4日 (日) 00:00:54 JST


Revision: 1774
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1774
Author:   dhrname
Date:     2010-04-04 00:00:53 +0900 (Sun, 04 Apr 2010)

Log Message:
-----------
getElementByIdメソッドを修正

Modified Paths:
--------------
    branches/ufltima/core.js

Modified: branches/ufltima/core.js
===================================================================
--- branches/ufltima/core.js	2010-04-01 14:09:29 UTC (rev 1773)
+++ branches/ufltima/core.js	2010-04-03 15:00:53 UTC (rev 1774)
@@ -572,9 +572,6 @@
   atn.nodeValue = value;
   atn.value = value;
   this.setAttributeNodeNS(atn);
-  if (atn.localName === "id") {              //id属性であったならば
-    this.ownerDocument._id[value] = this;                     //ドキュメントに登録しておく
-  }
 };
 /*void*/ Element.prototype.removeAttributeNS = function( /*string*/ namespaceURI, /*string*/ localName) {
 };
@@ -588,6 +585,9 @@
   }
   var s = this.attributes.setNamedItemNS(newAttr);
   newAttr.ownerElement = this;
+  if (newAttr.localName === "id") {                   //id属性であったならば
+    this.ownerDocument._id[newAttr.nodeValue] = this; //ドキュメントに登録しておく
+  }
   return s;
 };
 /*NodeList(Array)*/ Element.prototype.getElementsByTagNameNS = function( /*string*/ namespaceURI, /*string*/ localName) {
@@ -979,7 +979,7 @@
  *id属性の値で要素ノードを指定
  */
 /*Element*/            Document.prototype.getElementById = function( /*string*/ elementId) {
-  var s = (typeof(this._id[elementId]) === "undefined") ? null : this._id[elementId];
+  var s = !!this._id[elementId] ? this._id[elementId] : null;
   return s;
 };
 




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