Skip to content

Commit

Permalink
dom: fixing html for IE [#121 state:review]
Browse files Browse the repository at this point in the history
  • Loading branch information
jakearchibald committed Sep 18, 2009
1 parent c3437dd commit 4a4369a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/dom/dom.js
Expand Up @@ -2235,11 +2235,8 @@
var i = 0,
length = this.length;

if (arguments.length) {
for (; i < length; i++) {
this[i].innerHTML = newHtml;
}
return this;
if (newHtml !== undefined) {
return this.empty().append(newHtml);
}
return this[0] ? this[0].innerHTML : "";
},
Expand Down
15 changes: 14 additions & 1 deletion test/glow/dom/dom.js
Expand Up @@ -1041,7 +1041,7 @@ t.test("glow.dom.NodeList.clone()", function () {
});

t.test("glow.dom.NodeList.html()", function () {
t.expect(5);
t.expect(7);

var nodes = glow.dom.create("<div><span>first</span></div><div>second</div>");

Expand All @@ -1064,6 +1064,19 @@ t.test("glow.dom.NodeList.html()", function () {

t.equals((new glow.dom.NodeList()).html(), "", "Empty nodelist should return empty string");

var tableNode = glow.dom.create("<table class='madetable'></table>").appendTo("body")

// add a row
tableNode.html("<tr><td>first</td></tr>");

t.equals(tableNode.get('tr').length, 1, 'Table row added');

// clear table
tableNode.html("");

t.equals(tableNode.get('tr').length, 0, 'Table contents removed');

tableNode.destroy();
});

t.test("glow.dom.NodeList#append()", function () {
Expand Down

0 comments on commit 4a4369a

Please sign in to comment.