svnno****@sourc*****
svnno****@sourc*****
2010年 3月 14日 (日) 21:45:07 JST
Revision: 1729
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1729
Author: dhrname
Date: 2010-03-14 21:45:06 +0900 (Sun, 14 Mar 2010)
Log Message:
-----------
importNodeメソッドとgetElementsByTagNameNSメソッドを修正
Modified Paths:
--------------
branches/ufltima/core.js
Modified: branches/ufltima/core.js
===================================================================
--- branches/ufltima/core.js 2010-03-13 12:56:38 UTC (rev 1728)
+++ branches/ufltima/core.js 2010-03-14 12:45:06 UTC (rev 1729)
@@ -576,16 +576,19 @@
var s = [], n = 0;
var tno = this.childNodes;
for (var i=0,tcli = tno.length;i<tcli;i++) {
- namespaceURI = (namespaceURI === "*") ? tno[i].namespceURI : namespaceURI;
- localName = (localName === "*") ? tno[i].localName : localName;
- if(tno[i].namespaceURI == namespaceURI && tno[i].localName == localName) {
- s[n] = tno[i];
- n++;
- } else {
- var d = tno[i].getElementsByTagNameNS(namespaceURI, localName);
- if (d) {
- s.concat(d);
- n += d.length;
+ 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) {
+ s[n] = tnoi;
+ n++;
+ } else {
+ var d = tnoi.getElementsByTagNameNS(namespaceURI, localName);
+ if (d) {
+ s.concat(d);
+ n += d.length;
+ }
}
}
}
@@ -822,7 +825,7 @@
*/
/*Node*/ Document.prototype.importNode = function( /*Node*/ importedNode, /*boolean*/ deep) {
var s;
- /*以下の処理は引き渡されたimportNodeがMSXMLによって解析された
+ /*以下の処理は引き渡されたimportedNodeがMSXMLによって解析された
*データであることを前提にしている
*/
switch (importedNode.nodeType) {
@@ -847,9 +850,9 @@
s.nodeValue = importedNode.nodeValue;
break;
case Node.TEXT_NODE:
- s = this.createTextNode(importNode.data);
+ s = this.createTextNode(importedNode.data);
case Node.COMMENT_NODE:
- s = this.createComment(importNode.data);
+ s = this.createComment(importedNode.data);
break;
case Node.DOCUMENT_FRAGMENT_NODE:
s = this.createDocumentFragment();
@@ -866,27 +869,27 @@
s = this.createCDATASection();
break;
case Node.ENTITY_REFERENCE_NODE:
- s = this.createEntityReference(importNode.nodeName);
+ s = this.createEntityReference(importedNode.nodeName);
break;
case Node.ENTITY_NODE:
s = new Entity();
- s.publicId = importNode.publicId;
- s.systemId = importNode.systemId;
- s.notationName = importNode.notationName;
+ s.publicId = importedNode.publicId;
+ s.systemId = importedNode.systemId;
+ s.notationName = importedNode.notationName;
break;
case Node.PROCESSING_INSTRUCTION_NODE:
- s = this.createProcessingInstruction(importNode.nodeName, importNode.nodeValue)
+ s = this.createProcessingInstruction(importedNode.nodeName, importedNode.nodeValue)
break;
case Node.NOTATION_NODE:
s = new Notation();
- s.publicId = importNode.publicId;
- s.systemId = importNode.systemId;
+ s.publicId = importedNode.publicId;
+ s.systemId = importedNode.systemId;
break;
default:
throw (new DOMException(DOMException.NOT_SUPPORTED_ERR));
break;
}
- importNode = deep = null;
+ importedNode = deep = null;
return s;
};
/*createElementNSメソッド
@@ -894,7 +897,7 @@
*例:var s = DOC.createElementNS("http://www.w3.org/2000/svg", "svg:svg");
*/
/*Element*/ Document.prototype.createElementNS = function( /*string*/ namespaceURI, /*string*/ qualifiedName) {
- var ele, s, prefix = null, localName = null;
+ var ele, prefix = null, localName = null;
if (!qualifiedName) {
throw (new DOMException(DOMException.INVALID_CHARACTER_ERR));
}
@@ -905,15 +908,17 @@
} else {
localName = qualifiedName;
}
+ var isSpecified = false;
if (namespaceURI) {
var ti = this.implementation;
if (!!ti[namespaceURI]) {
if (!!ti[namespaceURI][localName]) { //もし、名前空間とローカル名によって、オブジェクトがあった場合
- ele = new (ti[namespaceURI][localName]);
+ isSpecified = true;
}
- } else {
- ele = new Element();
}
+ }
+ if (isSpecified) {
+ ele = new (ti[namespaceURI][localName]);
} else {
ele = new Element();
}
@@ -922,6 +927,7 @@
ele.localName = localName;
ele.prefix = prefix;
ele.ownerDocument = this;
+ namespaceURI = qualifiedName = prefix = localName = isSpecified;
return ele;
};
/*createAttributeNSメソッド