// Make sure to trigger the hashtable case by asking for enough elements
// by ID.
for (var i = 0; i < 256; ++i) { var x = document.getElementById(i);
}
// save off the document.getElementById function, since getting it as a
// property off the document it causes a content flush. var fun = document.getElementById;
// Slot for our initial element with id "content" var testNode;
function getCont() {
return fun.call(document, "content");
}
function testClone() {
// Test to make sure that if we have multiple nodes with the same ID in
// a document we don't forget about one of them when the other is
// removed. var newParent = $("display"); var node = testNode.cloneNode(true);
isnot(node, testNode, "Clone should be a different node");
newParent.appendChild(node);
// Check what getElementById returns, no flushing
is(getCont(), node, "Should be getting new node pre-flush 1");
// Trigger a layout flush, just in case. var itemHeight = newParent.offsetHeight/10;
// Check what getElementById returns now.
is(getCont(), node, "Should be getting new node post-flush 1");
clear(newParent);
// Check what getElementById returns, no flushing
is(getCont(), testNode, "Should be getting orig node pre-flush 2");
// Trigger a layout flush, just in case. var itemHeight = newParent.offsetHeight/10;
// Check what getElementById returns now.
is(getCont(), testNode, "Should be getting orig node post-flush 2");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.