Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from karfau/56/consistent-line-separators
fix: Convert all line separators to LF
- Loading branch information
Showing
16 changed files
with
1,086 additions
and
1,086 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
this.addScript('dom.js',['DOMImplementation','XMLSerializer']); | ||
this.addScript('dom-parser.js',['DOMHandler','DOMParser'], | ||
['DOMImplementation','XMLReader']); | ||
this.addScript('sax.js','XMLReader'); | ||
this.addScript('dom.js',['DOMImplementation','XMLSerializer']); | ||
this.addScript('dom-parser.js',['DOMHandler','DOMParser'], | ||
['DOMImplementation','XMLReader']); | ||
this.addScript('sax.js','XMLReader'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
var DOMParser = require('../../lib/dom-parser').DOMParser; | ||
require('./mock') | ||
//Compatibility | ||
{ | ||
var doc = new DOMParser().parseFromString("<xml/>",'text/xml'); | ||
var np = doc.__proto__.__proto__.__proto__; | ||
for(var n in np){ | ||
if(/_NODE$/.test(n)){ | ||
// console.log(n.replace(/_NODE$/,''),np[n]) | ||
np[n.replace(/_NODE$/,'')] = np[n]; | ||
} | ||
} | ||
|
||
} | ||
|
||
require.cache[require.resolve('node-o3-xml')] | ||
= require.cache[require.resolve('./mock')]; | ||
require('node-o3-xml').parseFromString = function(xml){ | ||
return new DOMParser().parseFromString(xml,'text/xml'); | ||
} | ||
require('node-o3-xml/test/test') | ||
var DOMParser = require('../../lib/dom-parser').DOMParser; | ||
require('./mock') | ||
//Compatibility | ||
{ | ||
var doc = new DOMParser().parseFromString("<xml/>",'text/xml'); | ||
var np = doc.__proto__.__proto__.__proto__; | ||
for(var n in np){ | ||
if(/_NODE$/.test(n)){ | ||
// console.log(n.replace(/_NODE$/,''),np[n]) | ||
np[n.replace(/_NODE$/,'')] = np[n]; | ||
} | ||
} | ||
|
||
} | ||
|
||
require.cache[require.resolve('node-o3-xml')] | ||
= require.cache[require.resolve('./mock')]; | ||
require('node-o3-xml').parseFromString = function(xml){ | ||
return new DOMParser().parseFromString(xml,'text/xml'); | ||
} | ||
require('node-o3-xml/test/test') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,65 @@ | ||
var wows = require('vows'); | ||
var DOMParser = require('../../lib/dom-parser').DOMParser; | ||
const assert = require('../assert') | ||
|
||
// Create a Test Suite | ||
wows.describe('XML attrs').addBatch({ | ||
"set attribute":function(){ | ||
var root = new DOMParser().parseFromString("<xml/>",'text/xml').documentElement; | ||
root.setAttribute('a','1'); | ||
assert(root.attributes[0].localName, 'a'); | ||
root.setAttribute('b',2); | ||
root.setAttribute('a',1); | ||
root.setAttribute('a',1); | ||
root.setAttribute('a',1); | ||
assert(root.attributes.length, 2); | ||
try { | ||
var c = root.ownerDocument.createElement('c'); | ||
c.setAttributeNode(root.attributes.item(0)); | ||
} catch (e) { | ||
assert(e.code, 10); | ||
return; | ||
} | ||
assert.fail('expected error but none was thrown'); | ||
}, | ||
"set ns attribute":function(){ | ||
var root = new DOMParser().parseFromString("<xml xmlns:a='a' xmlns:b='b' xmlns='e'><child/></xml>",'text/xml').documentElement; | ||
var child = root.firstChild | ||
child.setAttributeNS('a','a:a','1'); | ||
child.setAttributeNS('b','b:b','2'); | ||
child.setAttributeNS('b','b:a','1'); | ||
assert(child.attributes.length, 3, 'after adding 3', child); | ||
child.setAttribute('a',1); | ||
child.setAttributeNS('b','b:b','2'); | ||
assert(child.attributes.length, 4, 'after adding 4 and one with namespace'); | ||
try { | ||
var c = root.ownerDocument.createElement('c'); | ||
c.setAttributeNodeNS(root.attributes.item(0)); | ||
} catch (e) { | ||
assert(e.code, 10, 'wrong error code'); | ||
return; | ||
} | ||
assert.fail('expected error but none was thrown'); | ||
}, | ||
"override attribute":function(){ | ||
var root = new DOMParser().parseFromString("<xml xmlns:a='a' xmlns:b='b' xmlns='e'><child/></xml>",'text/xml').documentElement; | ||
root.setAttributeNS('a','a:a','1'); | ||
assert(root.attributes.length, 4); | ||
//not standart | ||
// root.firstChild.setAttributeNode(root.attributes[0]); | ||
// assert(root.attributes.length, 0); | ||
}, | ||
"attribute namespace":function(){ | ||
var root = new DOMParser().parseFromString("<xml xmlns:a='a' xmlns:b='b' a:b='e'></xml>",'text/xml').documentElement; | ||
assert(root.getAttributeNS("a", "b"), "e"); | ||
}, | ||
"override ns attribute":function(){ | ||
|
||
}, | ||
"set existed attribute":function(){ | ||
|
||
}, | ||
"set document existed attribute":function(){ | ||
|
||
} | ||
}).export(module); // Run it | ||
var wows = require('vows'); | ||
var DOMParser = require('../../lib/dom-parser').DOMParser; | ||
const assert = require('../assert') | ||
|
||
// Create a Test Suite | ||
wows.describe('XML attrs').addBatch({ | ||
"set attribute":function(){ | ||
var root = new DOMParser().parseFromString("<xml/>",'text/xml').documentElement; | ||
root.setAttribute('a','1'); | ||
assert(root.attributes[0].localName, 'a'); | ||
root.setAttribute('b',2); | ||
root.setAttribute('a',1); | ||
root.setAttribute('a',1); | ||
root.setAttribute('a',1); | ||
assert(root.attributes.length, 2); | ||
try { | ||
var c = root.ownerDocument.createElement('c'); | ||
c.setAttributeNode(root.attributes.item(0)); | ||
} catch (e) { | ||
assert(e.code, 10); | ||
return; | ||
} | ||
assert.fail('expected error but none was thrown'); | ||
}, | ||
"set ns attribute":function(){ | ||
var root = new DOMParser().parseFromString("<xml xmlns:a='a' xmlns:b='b' xmlns='e'><child/></xml>",'text/xml').documentElement; | ||
var child = root.firstChild | ||
child.setAttributeNS('a','a:a','1'); | ||
child.setAttributeNS('b','b:b','2'); | ||
child.setAttributeNS('b','b:a','1'); | ||
assert(child.attributes.length, 3, 'after adding 3', child); | ||
child.setAttribute('a',1); | ||
child.setAttributeNS('b','b:b','2'); | ||
assert(child.attributes.length, 4, 'after adding 4 and one with namespace'); | ||
try { | ||
var c = root.ownerDocument.createElement('c'); | ||
c.setAttributeNodeNS(root.attributes.item(0)); | ||
} catch (e) { | ||
assert(e.code, 10, 'wrong error code'); | ||
return; | ||
} | ||
assert.fail('expected error but none was thrown'); | ||
}, | ||
"override attribute":function(){ | ||
var root = new DOMParser().parseFromString("<xml xmlns:a='a' xmlns:b='b' xmlns='e'><child/></xml>",'text/xml').documentElement; | ||
root.setAttributeNS('a','a:a','1'); | ||
assert(root.attributes.length, 4); | ||
//not standart | ||
// root.firstChild.setAttributeNode(root.attributes[0]); | ||
// assert(root.attributes.length, 0); | ||
}, | ||
"attribute namespace":function(){ | ||
var root = new DOMParser().parseFromString("<xml xmlns:a='a' xmlns:b='b' a:b='e'></xml>",'text/xml').documentElement; | ||
assert(root.getAttributeNS("a", "b"), "e"); | ||
}, | ||
"override ns attribute":function(){ | ||
|
||
}, | ||
"set existed attribute":function(){ | ||
|
||
}, | ||
"set document existed attribute":function(){ | ||
|
||
} | ||
}).export(module); // Run it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
var wows = require('vows'); | ||
var XMLSerializer = require('../../lib/dom-parser').XMLSerializer; | ||
var DOMParser = require('../../lib/dom-parser').DOMParser; | ||
const assert = require('../assert') | ||
|
||
// Create a Test Suite | ||
wows.describe('XML Namespace Parse').addBatch({ | ||
'clone': function () { | ||
var doc1 = new DOMParser().parseFromString("<doc1 attr1='1' attr2='a2'>text1<child>text2</child></doc1>",'text/xml') | ||
var doc1s = new XMLSerializer().serializeToString(doc1); | ||
var n =doc1.cloneNode(true) | ||
assert(n, doc1s) | ||
}, | ||
'import': function () { | ||
var doc1 = new DOMParser().parseFromString("<doc2 attr='2'/>") | ||
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) | ||
assert(doc1, doc3+'') | ||
assert.isTrue(doc2 != doc3+'') | ||
} | ||
}).export(module); // Run it | ||
var wows = require('vows'); | ||
var XMLSerializer = require('../../lib/dom-parser').XMLSerializer; | ||
var DOMParser = require('../../lib/dom-parser').DOMParser; | ||
const assert = require('../assert') | ||
|
||
// Create a Test Suite | ||
wows.describe('XML Namespace Parse').addBatch({ | ||
'clone': function () { | ||
var doc1 = new DOMParser().parseFromString("<doc1 attr1='1' attr2='a2'>text1<child>text2</child></doc1>",'text/xml') | ||
var doc1s = new XMLSerializer().serializeToString(doc1); | ||
var n =doc1.cloneNode(true) | ||
assert(n, doc1s) | ||
}, | ||
'import': function () { | ||
var doc1 = new DOMParser().parseFromString("<doc2 attr='2'/>") | ||
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) | ||
assert(doc1, doc3+'') | ||
assert.isTrue(doc2 != doc3+'') | ||
} | ||
}).export(module); // Run it |
Oops, something went wrong.