Comparing version 0.1.9 to 0.1.10
function DOMParser(){ | ||
} | ||
DOMParser.prototype.parseFromString = function(source){ | ||
DOMParser.prototype.parseFromString = function(source,mimeType){ | ||
var sax = new XMLReader(); | ||
var handler = new DOMHandler(); | ||
var defaultNSMap = {}; | ||
var entityMap = {'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"} | ||
sax.contentHandler = handler; | ||
sax.lexicalHandler = handler; | ||
sax.errorHandler = handler; | ||
sax.parse(source); | ||
if(/\/x?html?$/.test(mimeType)){ | ||
entityMap.nbsp = '\xa0'; | ||
entityMap.copy = '\xa9'; | ||
defaultNSMap['']= 'http://www.w3.org/1999/xhtml'; | ||
} | ||
sax.parse(source,defaultNSMap,entityMap); | ||
return handler.document; | ||
@@ -13,0 +19,0 @@ } |
119
dom.js
@@ -37,2 +37,3 @@ /* | ||
} | ||
var htmlns = 'http://www.w3.org/1999/xhtml' ; | ||
// Node Types | ||
@@ -53,3 +54,2 @@ var NodeType = {} | ||
// ExceptionCode | ||
@@ -505,3 +505,3 @@ var ExceptionCode = {} | ||
if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){ | ||
var newFirst = newChild.firstNode; | ||
var newFirst = newChild.firstChild; | ||
var newLast = newChild.lastChild; | ||
@@ -524,2 +524,4 @@ }else{ | ||
parentNode.lastChild = newLast; | ||
}else{ | ||
nextChild.previousSibling = newLast; | ||
} | ||
@@ -531,2 +533,6 @@ do{ | ||
//console.log(parentNode.lastChild.nextSibling == null) | ||
if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) { | ||
newChild.firstChild = newChild.lastChild = null; | ||
} | ||
return newChild; | ||
} | ||
@@ -551,2 +557,3 @@ function _appendSingleChild(parentNode,newChild){ | ||
_onUpdateChild(parentNode.ownerDocument,parentNode,newChild); | ||
return newChild; | ||
//console.log("__aa",parentNode.lastChild.nextSibling == null) | ||
@@ -817,3 +824,3 @@ } | ||
//} | ||
Node.prototype.appendChild.apply(this,arguments) | ||
return Node.prototype.appendChild.apply(this,arguments) | ||
}, | ||
@@ -891,2 +898,3 @@ deleteData: function(offset, count) { | ||
DocumentFragment.prototype.nodeName = "#document-fragment"; | ||
DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE; | ||
_extends(DocumentFragment,Node); | ||
@@ -915,11 +923,17 @@ | ||
var nodeName = node.tagName; | ||
var isHTML = htmlns === node.namespaceURI | ||
buf.push('<',nodeName); | ||
for(var i=0;i<len;i++){ | ||
serializeToString(attrs.item(i),buf); | ||
serializeToString(attrs.item(i),buf,isHTML); | ||
} | ||
if(child){ | ||
if(child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)){ | ||
buf.push('>'); | ||
while(child){ | ||
serializeToString(child,buf); | ||
child = child.nextSibling; | ||
//if is cdata child node | ||
if(isHTML && /^script$/i.test(nodeName)){ | ||
buf.push(child.data); | ||
}else{ | ||
while(child){ | ||
serializeToString(child,buf); | ||
child = child.nextSibling; | ||
} | ||
} | ||
@@ -1066,55 +1080,58 @@ buf.push('</',nodeName,'>'); | ||
//do dynamic | ||
if(Object.defineProperty){ | ||
__set__ = function(object,key,value){ | ||
//console.log(value) | ||
object['$$'+key] = value | ||
} | ||
Object.defineProperty(LiveNodeList.prototype,'length',{ | ||
get:function(){ | ||
_updateLiveList(this); | ||
return this.$$length; | ||
} | ||
}); | ||
Object.defineProperty(Node.prototype,'textContent',{ | ||
get:function(){ | ||
return getTextContent(this); | ||
}, | ||
set:function(data){ | ||
switch(this.nodeType){ | ||
try{ | ||
if(Object.defineProperty){ | ||
Object.defineProperty(LiveNodeList.prototype,'length',{ | ||
get:function(){ | ||
_updateLiveList(this); | ||
return this.$$length; | ||
} | ||
}); | ||
Object.defineProperty(Node.prototype,'textContent',{ | ||
get:function(){ | ||
return getTextContent(this); | ||
}, | ||
set:function(data){ | ||
switch(this.nodeType){ | ||
case 1: | ||
case 11: | ||
var c = node.firstChild; | ||
while(c){ | ||
node.removeChild(c) | ||
c = c.nextSibling; | ||
} | ||
return ; | ||
default: | ||
//TODO: | ||
this.data = data; | ||
this.value = value; | ||
this.nodeValue = data; | ||
} | ||
} | ||
}) | ||
function getTextContent(node){ | ||
switch(node.nodeType){ | ||
case 1: | ||
case 11: | ||
var c = node.firstChild; | ||
while(c){ | ||
node.removeChild(c) | ||
c = c.nextSibling; | ||
var buf = []; | ||
node = node.firstChild; | ||
while(node){ | ||
if(node.nodeType!==7 && node.nodeType !==8){ | ||
buf.push(getTextContent(node)); | ||
} | ||
node = node.nextSibling; | ||
} | ||
return ; | ||
return buf.join(''); | ||
default: | ||
//TODO: | ||
this.data = data; | ||
this.value = value; | ||
this.nodeValue = data; | ||
return node.nodeValue; | ||
} | ||
} | ||
}) | ||
function getTextContent(node){ | ||
switch(node.nodeType){ | ||
case 1: | ||
case 11: | ||
var buf = []; | ||
node = node.firstChild; | ||
while(node){ | ||
if(node.nodeType!==7 && node.nodeType !==8){ | ||
buf.push(getTextContent(node)); | ||
} | ||
node = node.nextSibling; | ||
} | ||
return buf.join(''); | ||
default: | ||
return node.nodeValue; | ||
__set__ = function(object,key,value){ | ||
//console.log(value) | ||
object['$$'+key] = value | ||
} | ||
} | ||
}catch(e){//ie8 | ||
} | ||
if(typeof require == 'function'){ | ||
@@ -1121,0 +1138,0 @@ exports.DOMImplementation = DOMImplementation; |
{ | ||
"name": "xmldom", | ||
"version": "0.1.9", | ||
"description": "A W3C Standard based DOMParser and XMLSerializer (DOM Level2 CORE). ", | ||
"keywords": [ | ||
"javascript", | ||
"XML", | ||
"DOM", | ||
"DOMParser", | ||
"XMLSerializer" | ||
], | ||
"maintainers": [{ | ||
"name": "jindw", | ||
"email": "jindw@xidea.org", | ||
"url": "http://www.xidea.org" | ||
}], | ||
"contributors": [ | ||
{ | ||
"name" : "Yaron Naveh", | ||
"email" : "yaronn01@gmail.com", | ||
"web" : "http://webservices20.blogspot.com/" | ||
}, | ||
{ | ||
"name" : "Harutyun Amirjanyan", | ||
"email" : "amirjanyan@gmail.com", | ||
"web" : "https://github.com/nightwing" | ||
} | ||
], | ||
"bugs": { | ||
"email": "jindw@xidea.org", | ||
"url": "http://github.com/jindw/xmldom/issues" | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "LGPL", | ||
"url": "http://www.gnu.org/licenses/lgpl.html" | ||
} | ||
], | ||
"repositories": [ | ||
{ | ||
"type": "git", | ||
"url": "git://github.com/jindw/xmldom.git" | ||
} | ||
], | ||
"implements": [ | ||
], | ||
"dependencies": { | ||
}, | ||
"devDependencies" : { | ||
"vows" : "*" | ||
}, | ||
"engines" : { "node" : ">=0.1" }, | ||
"directories": { | ||
"lib": "./" | ||
}, | ||
"main": "./dom-parser.js" | ||
"name": "xmldom", | ||
"version": "0.1.10", | ||
"description": "A W3C Standard XML DOM(Level2 CORE) implementation and parser(DOMParser/XMLSerializer).", | ||
"keywords": ["XML","DOM","parser","javascript","DOMParser","XMLSerializer"], | ||
"author": "jindw <jindw@xidea.org> (http://www.xidea.org)", | ||
"homepage": "https://github.com/jindw/xmldom", | ||
"repository": {"type": "git","url": "git://github.com/jindw/xmldom.git"}, | ||
"main": "./dom-parser.js", | ||
"scripts": {"test": "./test"}, | ||
"engines": {"node": ">=0.1"}, | ||
"dependencies": {}, | ||
"devDependencies": {}, | ||
"maintainers": [{"name": "jindw","email": "jindw@xidea.org","url": "http://www.xidea.org"}], | ||
"contributors": [ | ||
{"name" : "Yaron Naveh","email" : "yaronn01@gmail.com","web" : "http://webservices20.blogspot.com/"}, | ||
{"name" : "Harutyun Amirjanyan","email" : "amirjanyan@gmail.com","web" : "https://github.com/nightwing"} | ||
], | ||
"bugs": {"email": "jindw@xidea.org","url": "http://github.com/jindw/xmldom/issues"}, | ||
"licenses": [{"type": "LGPL","url": "http://www.gnu.org/licenses/lgpl.html"}] | ||
} |
145
sax.js
@@ -0,1 +1,9 @@ | ||
//[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] | ||
//[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040] | ||
//[5] Name ::= NameStartChar (NameChar)* | ||
var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]///\u10000-\uEFFFF | ||
var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\u00B7\u0300-\u036F\\ux203F-\u2040]"); | ||
var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$'); | ||
//var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/ | ||
//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',') | ||
@@ -6,18 +14,18 @@ function XMLReader(){ | ||
XMLReader.prototype = { | ||
parse:function(source){ | ||
parse:function(source,defaultNSMap,entityMap){ | ||
var contentHandler = this.contentHandler; | ||
contentHandler.startDocument(); | ||
parse(source,this.entityMap,contentHandler,this.lexicalHandler,this.errorHandler); | ||
_copy(defaultNSMap ,defaultNSMap = {}) | ||
parse(source,defaultNSMap,entityMap, | ||
contentHandler,this.lexicalHandler,this.errorHandler); | ||
contentHandler.endDocument(); | ||
}, | ||
entityMap:{'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'", | ||
'nbsp':' ','copy':'©'} | ||
} | ||
} | ||
function parse(source,entityMap,contentHandler,lexHandler,errorHandler){ | ||
function parse(source,defaultNSMapCopy,entityMap,contentHandler,lexHandler,errorHandler){ | ||
function entityReplacer(a){ | ||
var k = a.slice(1,-1); | ||
if(k.charAt(0) == '#'){ | ||
if(k in entityMap){ | ||
return entityMap[k]; | ||
}else if(k.charAt(0) === '#'){ | ||
return String.fromCharCode(parseInt(k.substr(1).replace('x','0x'))) | ||
}else if(k in entityMap){ | ||
return entityMap[k]; | ||
}else{ | ||
@@ -33,3 +41,3 @@ errorHandler.error('entity not found:'+a); | ||
} | ||
var elStack = [{currentNSMap:{}}] | ||
var elStack = [{currentNSMap:defaultNSMapCopy}] | ||
var closeMap = {}; | ||
@@ -70,3 +78,7 @@ var start = 0; | ||
}else{ | ||
var end = parseElementAttribute(source,i,entityReplacer,contentHandler,closeMap,elStack); | ||
try{ | ||
var end = parseElementAttribute(source,i,entityReplacer,contentHandler,lexHandler,closeMap,elStack); | ||
}catch(e){ | ||
end = -1; | ||
} | ||
} | ||
@@ -82,3 +94,27 @@ | ||
} | ||
function parseElementAttribute(source,start,entityReplacer,contentHandler,closeMap,elStack){ | ||
function parseSpecialContent(el,source,p,entityReplacer,contentHandler,lexHandler){ | ||
var ns = el.uri; | ||
var tagName = el.tagName; | ||
if(ns === 'http://www.w3.org/1999/xhtml' &&/^(?:script|textarea)$/i.test(tagName)){ | ||
var end = source.indexOf('</'+tagName+'>',p); | ||
var text = source.substring(p+1,end); | ||
if(/[&<]/.test(text)){ | ||
if(/^script$/i.test(tagName)){ | ||
//if(!/\]\]>/.test(text)){ | ||
//lexHandler.startCDATA(); | ||
contentHandler.characters(text,0,text.length); | ||
//lexHandler.endCDATA(); | ||
return end; | ||
//} | ||
}//}else{//text area | ||
text = text.replace(/&#?\w+;/g,entityReplacer); | ||
contentHandler.characters(text,0,text.length); | ||
return end; | ||
//} | ||
} | ||
} | ||
} | ||
function parseElementAttribute(source,start,entityReplacer,contentHandler,lexHandler,closeMap,elStack){ | ||
var el = new ElementAttributes(); | ||
@@ -128,24 +164,30 @@ var tagName; | ||
case 2: | ||
attrName = source.slice(start,p) | ||
case 3: | ||
//reportWarning for s == 3 | ||
if(attrName.slice(-1) === '/'){ | ||
case 5: | ||
var value = source.slice(start,p); | ||
if(value.slice(-1) === '/'){ | ||
selfClosed = true; | ||
attrName = attrName.slice(0,-1) | ||
if(attrName){ | ||
if(s){ | ||
el[index++] = {qName:attrName,value:attrName} | ||
}else{ | ||
tagName = attrName; | ||
} | ||
value = value.slice(0,-1) | ||
} | ||
if(value){ | ||
if(s == 2){ | ||
el[index++] = {qName:value,value:value} | ||
}else if(s==5){ | ||
el[index++] = {qName:attrName,value:value} | ||
}else if(s ==0){ | ||
tagName = value; | ||
} | ||
}else if(s===0){ | ||
tagName = attrName | ||
} | ||
break; | ||
case 1: | ||
default: | ||
//case 4://error | ||
//case 4://error | ||
} | ||
// console.log(tagName,tagNamePattern,tagNamePattern.test(tagName)) | ||
el.length = index; | ||
appendElement(contentHandler,elStack,el,tagName,selfClosed||fixSelfClosed(closeMap,source,tagName,p)); | ||
//console.dir(el) | ||
return p+1; | ||
selfClosed = selfClosed||fixSelfClosed(closeMap,source,tagName,p) | ||
appendElement(contentHandler,elStack,el,tagName,selfClosed); | ||
return selfClosed ?p+1: parseSpecialContent(el,source,p,entityReplacer,contentHandler,lexHandler) || p+1; | ||
/*xml space '\x20' | #x9 | #xD | #xA; */ | ||
@@ -195,5 +237,6 @@ case '\u0080': | ||
if(pos == null){ | ||
pos = closeMap[tagName] = source.lastIndexOf('</'+tagName+'>',p) | ||
//console.log(tagName) | ||
pos = closeMap[tagName] = source.lastIndexOf('</'+tagName+'>') | ||
} | ||
return pos>p; | ||
return pos<p; | ||
//} | ||
@@ -205,2 +248,7 @@ } | ||
var i = el.length; | ||
if(!tagNamePattern.test(tagName)){ | ||
console.error('invalid tagName:',tagName) | ||
throw new Error(); | ||
} | ||
while(i--){ | ||
@@ -211,2 +259,7 @@ var a = el[i]; | ||
var nsp = qName.indexOf(':'); | ||
if(!tagNamePattern.test(qName)){ | ||
console.error('invalid attribute:',qName) | ||
throw new Error(); | ||
} | ||
if(nsp>0){ | ||
@@ -226,8 +279,4 @@ var prefix = a.prefix = qName.slice(0,nsp); | ||
if(localNSMap == null){ | ||
localNSMap = {}; | ||
for(var n in currentNSMap){ | ||
localNSMap[n] = currentNSMap[n]; | ||
} | ||
currentNSMap = localNSMap; | ||
localNSMap = {} | ||
_copy(currentNSMap,currentNSMap={}) | ||
} | ||
@@ -260,3 +309,2 @@ currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value; | ||
contentHandler.startElement(el.uri = currentNSMap[prefix || ''],localName,tagName,el); | ||
if(selfClosed){ | ||
@@ -276,4 +324,6 @@ contentHandler.endElement(el.uri,localName,tagName); | ||
} | ||
function parseDCC(source,start,contentHandler,lex){//sure start with '<!' | ||
function _copy(source,target){ | ||
for(var n in source){target[n] = source[n]} | ||
} | ||
function parseDCC(source,start,contentHandler,lexHandler){//sure start with '<!' | ||
var next= source.charAt(start+2) | ||
@@ -285,3 +335,3 @@ switch(next){ | ||
//append comment source.substring(4,end)//<!-- | ||
lex && lex.comment(source,start+4,end-start-4); | ||
lexHandler.comment(source,start+4,end-start-4); | ||
return end+3; | ||
@@ -295,5 +345,5 @@ }else{ | ||
var end = source.indexOf(']]>',start+9); | ||
lex && lex.startCDATA(); | ||
lexHandler.startCDATA(); | ||
contentHandler.characters(source,start+9,end-start-9); | ||
lex && lex.endCDATA() | ||
lexHandler.endCDATA() | ||
return end+3; | ||
@@ -310,4 +360,4 @@ } | ||
var lastMatch = matchs[len-1] | ||
lex && lex.startDTD(name,pubid,sysid); | ||
lex && lex.endDTD(); | ||
lexHandler.startDTD(name,pubid,sysid); | ||
lexHandler.endDTD(); | ||
@@ -393,13 +443,2 @@ return lastMatch.index+lastMatch[0].length | ||
function split2(source){ | ||
var match; | ||
var buf = []; | ||
var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g; | ||
reg.lastIndex = 0; | ||
reg.exec(source);//skip < | ||
while(match = reg.exec(source)){ | ||
buf.push(match); | ||
if(match[1])return buf; | ||
} | ||
} | ||
if(typeof require == 'function'){ | ||
@@ -406,0 +445,0 @@ exports.XMLReader = XMLReader; |
@@ -10,3 +10,3 @@ var wows = require('vows'); | ||
var n =doc1.cloneNode(true) | ||
console.log(new XMLSerializer().serializeToString(doc1)) | ||
console.assert(n == new XMLSerializer().serializeToString(doc1)) | ||
}, | ||
@@ -16,6 +16,9 @@ 'import': function () { | ||
var doc2 = new DOMParser().parseFromString("<doc1 attr1='1' attr2='a2'>text1<child>text2</child></doc1>",'text/xml') | ||
var doc3 = new DOMParser().parseFromString("<doc2 attr='2'><doc1 attr1='1' attr2='a2'>text1<child>text2</child></doc1></doc2>") | ||
var n =doc1.importNode(doc2.documentElement, true) | ||
doc1.documentElement.appendChild(n) | ||
console.log(new XMLSerializer().serializeToString(doc1)) | ||
console.assert(doc1 == doc3+'') | ||
console.assert(doc2 != doc3+'') | ||
} | ||
}).run(); // Run it |
@@ -38,5 +38,5 @@ var wows = require('vows'); | ||
var feed = new DOMParser().parseFromString('<feed><entry>foo</entry></feed>'); | ||
var entries = feed.documentElement.getElementsByTagName('entry'); | ||
console.log(entries[0].nodeName); | ||
var feed = new DOMParser().parseFromString('<feed><entry>foo</entry></feed>'); | ||
var entries = feed.documentElement.getElementsByTagName('entry'); | ||
console.log(entries[0].nodeName); | ||
console.log(feed.documentElement.childNodes.item(0).nodeName); | ||
@@ -43,0 +43,0 @@ }, |
@@ -23,4 +23,3 @@ var XMLSerializer = require('xmldom').XMLSerializer; | ||
} | ||
DOMParser.prototype.parseFromString = function(data){ | ||
var doc = oldParser.apply(this,arguments); | ||
function check(data,doc){ | ||
var domjsresult = format(data); | ||
@@ -34,2 +33,10 @@ var xmldomresult = new XMLSerializer().serializeToString(doc); | ||
assert.equal(xmldomresult,domjsresult); | ||
} | ||
DOMParser.prototype.parseFromString = function(data,mimeType){ | ||
var doc = oldParser.apply(this,arguments); | ||
if(!/\/x?html?\b/.test(mimeType)){ | ||
try{ | ||
check(data,doc); | ||
}catch(e){console.dir(e)} | ||
} | ||
return doc; | ||
@@ -42,2 +49,3 @@ } | ||
require('./namespace'); | ||
require('./html/normalize'); | ||
//require('./big-file-performance'); |
@@ -45,2 +45,39 @@ var wows = require('vows'); | ||
console.assert ( root.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nodeValue =='end'); | ||
}, | ||
'append node': function () { | ||
var dom = new DOMParser().parseFromString('<xml/>'); | ||
var child = dom.createElement("child"); | ||
console.assert ( child == dom.documentElement.appendChild(child)); | ||
console.assert ( child == dom.documentElement.firstChild); | ||
var fragment = new dom.createDocumentFragment(); | ||
console.assert ( child == fragment.appendChild(child)); | ||
}, | ||
'insert node': function () { | ||
var dom = new DOMParser().parseFromString('<xml><child/></xml>'); | ||
var node = dom.createElement("sibling"); | ||
var child = dom.documentElement.firstChild; | ||
child.parentNode.insertBefore(node, child); | ||
console.assert ( node == child.previousSibling); | ||
console.assert ( node.nextSibling == child); | ||
console.assert ( node.parentNode == child.parentNode); | ||
}, | ||
'insert fragment': function () { | ||
var dom = new DOMParser().parseFromString('<xml><child/></xml>'); | ||
var fragment = dom.createDocumentFragment(); | ||
assert(fragment.nodeType === 11); | ||
var first = fragment.appendChild(dom.createElement("first")); | ||
var last = fragment.appendChild(dom.createElement("last")); | ||
console.assert ( fragment.firstChild == first); | ||
console.assert ( fragment.lastChild == last); | ||
console.assert ( last.previousSibling == first); | ||
console.assert ( first.nextSibling == last); | ||
var child = dom.documentElement.firstChild; | ||
child.parentNode.insertBefore(fragment, child); | ||
console.assert ( last.previousSibling == first); | ||
console.assert ( first.nextSibling == last); | ||
console.assert ( child.parentNode.firstChild == first); | ||
console.assert ( last == child.previousSibling); | ||
console.assert ( last.nextSibling == child); | ||
console.assert ( first.parentNode == child.parentNode); | ||
console.assert ( last.parentNode == child.parentNode); | ||
} | ||
@@ -47,0 +84,0 @@ }).addBatch({ |
@@ -9,23 +9,24 @@ var wows = require('vows'); | ||
'noAttribute': function () { | ||
var dom = new DOMParser().parseFromString('<xml ></xml>'); | ||
var dom = new DOMParser().parseFromString('<xml></xml>'); | ||
var dom = new DOMParser().parseFromString('<xml />'); | ||
var dom = new DOMParser().parseFromString('<xml/>'); | ||
var dom = new DOMParser().parseFromString('<xml ></xml>','text/xml'); | ||
var dom = new DOMParser().parseFromString('<xml></xml>','text/xml'); | ||
var dom = new DOMParser().parseFromString('<xml />','text/xml'); | ||
var dom = new DOMParser().parseFromString('<xml/>','text/xml'); | ||
var dom = new DOMParser().parseFromString('<xml/>','text/xml'); | ||
}, | ||
// 'simpleAttribute': function () { | ||
// var dom = new DOMParser().parseFromString('<xml a=1 b=2></xml>'); | ||
// var dom = new DOMParser().parseFromString('<xml a=1 b=2 ></xml>'); | ||
// var dom = new DOMParser().parseFromString('<xml a="1" b=\'\'></xml>'); | ||
// var dom = new DOMParser().parseFromString('<xml a="1" b=\'\' ></xml>'); | ||
// var dom = new DOMParser().parseFromString('<xml a=1 b=2/>'); | ||
// var dom = new DOMParser().parseFromString('<xml a=1 b=2 />'); | ||
// var dom = new DOMParser().parseFromString('<xml a="1" b=\'\'/>'); | ||
// var dom = new DOMParser().parseFromString('<xml a="1" b=\'\' />'); | ||
// }, | ||
// 'nsAttribute': function () { | ||
// var dom = new DOMParser().parseFromString('<xml xmlns=1 xmlns:a=2 a:test=3></xml>'); | ||
// var dom = new DOMParser().parseFromString('<xml xmlns=1 xmlns:a=2 a:test=3 ></xml>'); | ||
// var dom = new DOMParser().parseFromString('<xml xmlns=1 xmlns:a=2 a:test=3/>'); | ||
// var dom = new DOMParser().parseFromString('<xml xmlns=1 xmlns:a=2 a:test=3 />'); | ||
// } | ||
'simpleAttribute': function () { | ||
var dom = new DOMParser().parseFromString('<xml a="1" b="2"></xml>','text/xml'); | ||
var dom = new DOMParser().parseFromString('<xml a="1" b="2" ></xml>','text/xml'); | ||
var dom = new DOMParser().parseFromString('<xml a="1" b=\'\'></xml>','text/xml'); | ||
var dom = new DOMParser().parseFromString('<xml a="1" b=\'\' ></xml>','text/xml'); | ||
var dom = new DOMParser().parseFromString('<xml a="1" b="2/">','text/xml'); | ||
var dom = new DOMParser().parseFromString('<xml a="1" b="2" />','text/xml'); | ||
var dom = new DOMParser().parseFromString('<xml a="1" b=\'\'/>','text/xml'); | ||
var dom = new DOMParser().parseFromString('<xml a="1" b=\'\' />','text/xml'); | ||
}, | ||
'nsAttribute': function () { | ||
var dom = new DOMParser().parseFromString('<xml xmlns="1" xmlns:a="2" a:test="3"></xml>','text/xml'); | ||
var dom = new DOMParser().parseFromString('<xml xmlns="1" xmlns:a="2" a:test="3" ></xml>','text/xml'); | ||
var dom = new DOMParser().parseFromString('<xml xmlns="1" xmlns:a="2" a:test="3/">','text/xml'); | ||
var dom = new DOMParser().parseFromString('<xml xmlns="1" xmlns:a="2" a:test="3" />','text/xml'); | ||
} | ||
}).run(); |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
1290525
0
24
2211
1
1