fixed my empty frag logic, changed liveui tests back to original

This commit is contained in:
David Greenspan
2012-01-20 18:45:15 -08:00
committed by Geoff Schmidt
parent c2c903f3ef
commit 2116a9c239
2 changed files with 7 additions and 5 deletions

View File

@@ -173,7 +173,7 @@ _.extend(Meteor, (function() {
leadingWhitespaceKilled: (testDiv.firstChild.nodeType !== 3),
// IE may insert an empty tbody tag in a table.
tbodyInserted: testDiv.getElementsByTagName("tbody").length > 0,
tbodyInsertion: testDiv.getElementsByTagName("tbody").length > 0,
// IE loses some tags in some environments (requiring extra wrapper).
tagsLost: testDiv.getElementsByTagName("link").length == 0
@@ -216,7 +216,9 @@ _.extend(Meteor, (function() {
var doc = document; // node factory
var frag = doc.createDocumentFragment();
if (! rhtml.test(html)) {
if (! html.length) {
// empty, do nothing
} else if (! rhtml.test(html)) {
// Just text.
frag.appendChild(doc.createTextNode(html));
} else {
@@ -237,7 +239,7 @@ _.extend(Meteor, (function() {
container = container.lastChild;
}
if (quirks.tbodyInserted && ! rtbody.test(html)) {
if (quirks.tbodyInsertion && ! rtbody.test(html)) {
// Any tbody we find was created by the browser.
var tbodies = container.getElementsByTagName("tbody");
_.each(tbodies, function(n) {

View File

@@ -864,7 +864,7 @@ test("renderList - #each", function () {
onscreen.appendChild(Template.test_renderList_each());
document.body.appendChild(onscreen);
assert_frag("~Before0~Middle~Else~After~", onscreen);
assert_frag("~Before0<!---->~Middle~Else~After~", onscreen);
assert.length(_.keys(weather_listeners.here), 0);
c.insert({x: 2, name: "A"});
@@ -889,7 +889,7 @@ test("renderList - #each", function () {
assert.length(_.keys(weather_listeners.here), 1);
c.update({}, {$set: {x: 5}});
assert_frag("~Before0~Middle~Else~After~", onscreen);
assert_frag("~Before0<!---->Middle~Else~After~", onscreen);
assert.length(_.keys(weather_listeners.here), 1);
Meteor.flush();
assert.length(_.keys(weather_listeners.here), 0);