Skip to content

Commit

Permalink
Fixed the Document.innerHTML setter to parse HTML with double spaces …
Browse files Browse the repository at this point in the history
…correctly. Previously it flattened double spaces to no whitespace, breaking the parsing if an element name and its attributes were separate by double whitespace.
  • Loading branch information
tomtaylor authored and tmpvar committed Jun 27, 2010
1 parent 4de3e0d commit 4c13c98
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lib/jsdom/browser/htmltodom.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ var HtmlToDom = function(parser){
html +='';
}

// jos3000: not sure why this is here to clean up whitespace...
html = html.replace(/\n/gm, '');
html = html.replace(/ /gm, '');

var parsed = parser.ParseHtml(html);

for (var i = 0; i < parsed.length; i++) {
Expand Down
14 changes: 14 additions & 0 deletions test/browser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,19 @@ exports.tests = {

assertSame("original and processed", head.innerHTML, styleHtml);

},
parse_doublespacetags : function() {
var doc = new browser.Document();

var html = '<html><body class="testing" /></html>';

exception = false;
try {
doc.innerHTML = html;
}
catch(ex) {
exception = true;
}
assertFalse("setValue_throws_INVALID_CHARACTER_ERR", exception);
}
};

0 comments on commit 4c13c98

Please sign in to comment.