/** Test for cloning of CSS property values (including 'inherit', 'initial' and 'unset') **/ var test_queue = []; variframe = document.getElementById("iframe");
SimpleTest.waitForExplicitFinish();
for (var prop in gCSSProperties) {
let info = gCSSProperties[prop];
function iframe_loaded(event)
{
if (event.target != iframe)
return;
var start_ser = []; var start_compute = []; var test_cs = []; var wrappedFrame = SpecialPowers.wrap(iframe); var ifdoc = wrappedFrame.contentDocument; var ifwin = wrappedFrame.contentWindow;
for (let idx = 0; idx < test_queue.length; ++idx) { var current_item = test_queue[idx]; var info = gCSSProperties[current_item.prop];
var test = ifdoc.getElementById("test" + idx); var cur_cs = ifwin.getComputedStyle(test);
test_cs.push(cur_cs); var cur_ser = ifdoc.styleSheets[0].cssRules[3*idx+2].style.getPropertyValue(current_item.prop);
if (cur_ser == "") {
isnot(cur_ser, "", "serialization should be nonempty for " +
current_item.prop + ": " + current_item.value);
}
start_ser.push(cur_ser);
var cur_compute = get_computed_value(cur_cs, current_item.prop);
if (cur_compute == "") {
isnot(cur_compute, "", "computed value should be nonempty for " +
current_item.prop + ": " + current_item.value);
}
start_compute.push(cur_compute);
}
// In case the above access didn't force a clone already (though it
// currently does), clone the second style sheet's inner and then
// remove the first.
ifdoc.styleSheets[1].insertRule("#nonexistent { color: red }", 0); var firstlink = ifdoc.getElementsByTagName("link")[0];
firstlink.remove();
// Force a flush
ifdoc.body.style.display="none"; var ow = ifdoc.body.offsetWidth;
ifdoc.body.style.display="";
for (let idx = 0; idx < test_queue.length; ++idx) { var current_item = test_queue[idx]; var info = gCSSProperties[current_item.prop];
var end_ser =
ifdoc.styleSheets[0].cssRules[3*idx+3].style.getPropertyValue(current_item.prop);
is(end_ser, start_ser[idx], "serialization should match when cloning " +
current_item.prop + ": " + current_item.value);
var end_compute = get_computed_value(test_cs[idx], current_item.prop);
// Output computed values only when the test failed.
// Computed values may be very long.
if (end_compute == start_compute[idx]) {
ok(true, "computed values should match when cloning " +
current_item.prop + ": " + current_item.value);
} else {
is(end_compute, start_compute[idx], "computed values should match when cloning " +
current_item.prop + ": " + current_item.value);
}
}
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>
Messung V0.5
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
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.