Skip to content

Commit

Permalink
Dom: Allowing html to be set as number (this is a regression) [#150 s…
Browse files Browse the repository at this point in the history
…tate:review]
  • Loading branch information
jakearchibald committed Oct 21, 2009
1 parent ad52c9c commit 710f93a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dom/dom.js
Expand Up @@ -2503,7 +2503,7 @@

if (newHtml !== undefined) {
// not setting innerHTML, doesn't work in IE for elements like <table>
return this.empty().append(newHtml);
return this.empty().append( newHtml.toString() );
}
return this[0] ? this[0].innerHTML : "";
},
Expand Down
10 changes: 8 additions & 2 deletions test/glow/dom/dom.js
Expand Up @@ -1094,8 +1094,8 @@ t.test("glow.dom.NodeList.clone()", function () {
t.equals(clone[1].innerText, nodes[1].innerText, "clone duplicates text nodes");
});

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

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

Expand Down Expand Up @@ -1131,6 +1131,12 @@ t.test("glow.dom.NodeList.html()", function () {
t.equals(tableNode.get('tr').length, 0, 'Table contents removed');

tableNode.destroy();

// adding a number - should convert it to a string
var div = glow.dom.create('<div></div>');
div.html(1);
t.equals(div.html(), '1', 'Contents of div set');
div.destroy();
});

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

0 comments on commit 710f93a

Please sign in to comment.