[Sie-announce] SIEコード [1762] getElementsByTagNameNSメソッドを子要素も探索できるように修正

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 3月 28日 (日) 23:18:08 JST


Revision: 1762
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1762
Author:   dhrname
Date:     2010-03-28 23:18:08 +0900 (Sun, 28 Mar 2010)

Log Message:
-----------
getElementsByTagNameNSメソッドを子要素も探索できるように修正

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

Modified: branches/ufltima/core.js
===================================================================
--- branches/ufltima/core.js	2010-03-27 14:04:22 UTC (rev 1761)
+++ branches/ufltima/core.js	2010-03-28 14:18:08 UTC (rev 1762)
@@ -596,21 +596,21 @@
   for (var i=0,tcli = tno.length;i<tcli;i++) {
     var tnoi = tno[i];
     if (tnoi.nodeType === Node.ELEMENT_NODE) {
-      namespaceURI = (namespaceURI === "*") ? tnoi.namespceURI : namespaceURI;
-      localName = (localName === "*") ? tnoi.localName : localName;
-      if(tnoi.namespaceURI == namespaceURI && tnoi.localName == localName) {
+      var ns = (namespaceURI === "*") ? tnoi.namespceURI : namespaceURI;
+      var ln = (localName === "*") ? tnoi.localName : localName;
+      if(tnoi.namespaceURI == ns && tnoi.localName == ln) {
         s[n] = tnoi;
         n++;
-      } else {
-        var d = tnoi.getElementsByTagNameNS(namespaceURI, localName);
-        if (d) {
-          s.concat(d);
-          n += d.length;
-        }
       }
+      var d = tnoi.getElementsByTagNameNS(namespaceURI, localName);
+      if (d) {
+        s = s.concat(d);
+        n += d.length;
+      }
+      ns = ln = d = null;
     }
   }
-  if (n==0) {
+  if (n === 0) {
     return null; //該当する要素なし
   }
   return s;




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