Comparing version 0.1.10 to 0.1.11
{ | ||
"name": "xmldom", | ||
"version": "0.1.10", | ||
"version": "0.1.11", | ||
"description": "A W3C Standard XML DOM(Level2 CORE) implementation and parser(DOMParser/XMLSerializer).", | ||
@@ -17,3 +17,4 @@ "keywords": ["XML","DOM","parser","javascript","DOMParser","XMLSerializer"], | ||
{"name" : "Yaron Naveh","email" : "yaronn01@gmail.com","web" : "http://webservices20.blogspot.com/"}, | ||
{"name" : "Harutyun Amirjanyan","email" : "amirjanyan@gmail.com","web" : "https://github.com/nightwing"} | ||
{"name" : "Harutyun Amirjanyan","email" : "amirjanyan@gmail.com","web" : "https://github.com/nightwing"}, | ||
{"name" : "bigeasy","email" : "alan@prettyrobots.com","web" : "http://www.prettyrobots.com/"} | ||
], | ||
@@ -20,0 +21,0 @@ "bugs": {"email": "jindw@xidea.org","url": "http://github.com/jindw/xmldom/issues"}, |
@@ -281,2 +281,3 @@ //[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] | ||
while(i--){ | ||
a = el[i]; | ||
var prefix = a.prefix; | ||
@@ -283,0 +284,0 @@ if(prefix){//no prefix attribute has no namespace |
@@ -49,2 +49,18 @@ var wows = require('vows'); | ||
} | ||
function addAttributes(el){ | ||
var c =parseInt(Math.random()*10); | ||
while(c--){ | ||
el.setAttribute('dynamic-attr'+c,c+new Array(c).join('.')); | ||
} | ||
var child = el.firstChild; | ||
while(child){ | ||
if(child.nodeType == 1){ | ||
addAttributes(child) | ||
}else if(child.nodeType == 4){//cdata | ||
el.insertBefore(el.ownerDocument.createTextNode(child.data),child); | ||
el.removeChild(child); | ||
} | ||
child = child.nextSibling; | ||
} | ||
} | ||
// Create a Test Suite | ||
@@ -63,16 +79,37 @@ wows.describe('XML Node Parse').addBatch({ | ||
xmldomresult = (doc1+'').replace(/^<\?.*?\?>\s*|<!\[CDATA\[\]\]>/g,'') | ||
addAttributes(doc1.documentElement); | ||
data = doc1.toString(); | ||
var doc1 = xmldom(data); | ||
var doc2 = domjs(data); | ||
var doc3 = libxml(data); | ||
xmldomresult = (domjs(doc1+'')+'').replace(/^<\?.*?\?>\s*|<!\[CDATA\[\]\]>/g,'') | ||
domjsresult = (doc2+'').replace(/^<\?.*?\?>\s*|<!\[CDATA\[\]\]>/g,'') | ||
// var begin = 0; | ||
// var end = 5 | ||
// xmldomresult = xmldomresult.substring(begin,end) | ||
// domjsresult = domjsresult.substring(begin,end) | ||
// console.log(xmldomresult,domjsresult) | ||
//console.log(xmldomresult,domjsresult) | ||
//assert.equal(xmldomresult,domjsresult); | ||
//,xmldomresult,domjsresult) | ||
console.assert(xmldomresult == domjsresult,xmldomresult,domjsresult) | ||
if(xmldomresult !== domjsresult){ | ||
for(var i=0;i<xmldomresult.length;i++){ | ||
if(xmldomresult.charAt(i)!=domjsresult.charAt(i)){ | ||
console.log(xmldomresult.charAt(i)) | ||
var begin = i-50; | ||
var len = 100; | ||
xmldomresult = xmldomresult.substr(begin,len) | ||
domjsresult = domjsresult.substr(begin,len) | ||
//console.log(xmldomresult.length,domjsresult.length) | ||
console.log('pos'+i,'\n',xmldomresult,'\n\n\n\n',domjsresult) | ||
console.assert(xmldomresult == domjsresult) | ||
break; | ||
} | ||
} | ||
} | ||
//console.assert(xmldomresult == domjsresult,xmldomresult.length,i) | ||
} | ||
}).run(); // Run it |
@@ -34,2 +34,6 @@ var wows = require('vows'); | ||
}, | ||
"attribute namespace":function(){ | ||
var root = new DOMParser().parseFromString("<xml xmlns:a='a' xmlns:b='b' a:b='e'></xml>",'text/xml').documentElement; | ||
console.assert(root.getAttributeNS("a", "b"), "e"); | ||
}, | ||
"override ns attribute":function(){ | ||
@@ -36,0 +40,0 @@ |
@@ -31,3 +31,6 @@ var XMLSerializer = require('xmldom').XMLSerializer; | ||
//console.log('['+xmldomresult+'],['+domjsresult+']') | ||
assert.equal(xmldomresult,domjsresult); | ||
if(xmldomresult!=domjsresult){ | ||
assert.equal(format(xmldomresult),domjsresult); | ||
} | ||
} | ||
@@ -34,0 +37,0 @@ DOMParser.prototype.parseFromString = function(data,mimeType){ |
@@ -16,3 +16,3 @@ var wows = require('vows'); | ||
'prefix namespace': function () { | ||
var dom = new DOMParser().parseFromString('<xml xmlns:p1="http://p1.com" xmlns:p2="http://p2.com"><p1:child p1:attr="1"/><p2:child/></xml>','text/xml'); | ||
var dom = new DOMParser().parseFromString('<xml xmlns:p1="http://p1.com" xmlns:p2="http://p2.com"><p1:child a="1" p1:attr="1" b="2"/><p2:child/></xml>','text/xml'); | ||
var root = dom.documentElement; | ||
@@ -19,0 +19,0 @@ console.assert(root.firstChild.namespaceURI == 'http://p1.com') |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1291929
2250