diff --git a/package.json b/package.json index 06f8e64..08ee0f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmldom", - "version": "0.1.9", + "version": "0.1.10", "description": "A W3C Standard based DOMParser and XMLSerializer (DOM Level2 CORE). ", "keywords": [ "javascript", diff --git a/test/html/normalize.js b/test/html/normalize.js index fcb8b7b..c9f1bac 100644 --- a/test/html/normalize.js +++ b/test/html/normalize.js @@ -16,9 +16,14 @@ wows.describe('html normalizer').addBatch({ console.assert(dom == '
\u00a0\u00a9&nbsp&copy
',dom+'') + var dom = new DOMParser().parseFromString('','text/html'); + console.assert(dom == '',dom+'') }, 'attr': function () { - var dom = new DOMParser().parseFromString('
','text/html'); + var dom = new DOMParser().parseFromString('','text/html'); + console.assert(dom == '',dom+'') + + var dom = new DOMParser().parseFromString('
','text/html'); console.assert(dom == '
',dom+'') var dom = new DOMParser().parseFromString('
','text/html'); console.assert(dom == '
',dom+'') @@ -55,11 +60,20 @@ wows.describe('html normalizer').addBatch({ 'script': function () { var dom = new DOMParser().parseFromString('','text/html'); console.assert(dom == '',dom+'') + + var dom = new DOMParser().parseFromString('','text/xml'); + console.assert(dom == '',dom+'') + var dom = new DOMParser().parseFromString('','text/html'); console.assert(dom == '',dom+'') + }, 'textarea': function () { var dom = new DOMParser().parseFromString('','text/html'); console.assert(dom == '',dom+'') + + + var dom = new DOMParser().parseFromString('','text/xml'); + console.assert(dom == '',dom+'') } }).run(); \ No newline at end of file diff --git a/test/html/parse.js b/test/html/parse.js deleted file mode 100644 index df83e38..0000000 --- a/test/html/parse.js +++ /dev/null @@ -1,26 +0,0 @@ -var wows = require('vows'); -var assert = require('assert'); -var DOMParser = require('xmldom').DOMParser; -var XMLSerializer = require('xmldom').XMLSerializer; -var parser = new DOMParser(); -// Create a Test Suite -wows.describe('html Node Parse').addBatch({ - 'node': function () { - var dom = new DOMParser().parseFromString('','text/html'); - console.assert(dom == '',dom+'') - }, - 'attr': function () { - var dom = new DOMParser().parseFromString('','text/html'); - console.assert(dom == '',dom+'') - }, - 'script': function () { - var dom = new DOMParser().parseFromString('','text/html'); - console.assert(dom == '',dom+'') - var dom = new DOMParser().parseFromString('','text/html'); - console.assert(dom == '',dom+'') - }, - 'textarea': function () { - var dom = new DOMParser().parseFromString('','text/html'); - console.assert(dom == '',dom+'') - } -}).run(); \ No newline at end of file diff --git a/test/index.js b/test/index.js index cdf7d6f..a5683e5 100644 --- a/test/index.js +++ b/test/index.js @@ -33,7 +33,9 @@ function check(data,doc){ 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,6 +44,5 @@ require('./dom'); require('./parse-element'); require('./node'); require('./namespace'); -require('./html/parse'); require('./html/normalize'); //require('./big-file-performance');