blob: 6f5c77c9335c294478bfc780210eba309a9e4230 [file] [log] [blame]
<html>
<head>
<script>
function log(message)
{
var item = document.createElement("li");
item.appendChild(document.createTextNode(message));
document.getElementById("console").appendChild(item);
}
function setInitialStyleForE()
{
var e = document.getElementById('e');
e.style.top = "0px";
e.style.bottom = "";
e.style.display = "none";
e.style.bottom = "1px";
}
function test()
{
if (window.testRunner)
testRunner.dumpAsText();
var e = document.getElementById('e');
setInitialStyleForE();
try {
e.style.display = "block";
log("Successfully set display to \"block\"; cssText is now: \"" + e.style.cssText + "\".");
} catch (exception) {
log("Got exception trying to set display to \"block\"; cssText is now: \"" + e.style.cssText + "\".");
}
setInitialStyleForE();
try {
e.style.display = "foobar";
log("Successfully set display to \"foobar\"; cssText is now: \"" + e.style.cssText + "\".");
} catch (exception) {
log("Got exception trying to set display to \"foobar\"; cssText is now: \"" + e.style.cssText + "\".");
}
setInitialStyleForE();
try {
e.style.display = "";
log("Successfully set display to \"\"; cssText is now: \"" + e.style.cssText + "\".");
} catch (exception) {
log("Got exception trying to set display to \"\"; cssText is now: \"" + e.style.cssText + "\".");
}
setInitialStyleForE();
try {
e.style.display = null;
log("Successfully set display to null; cssText is now: \"" + e.style.cssText + "\".");
} catch (exception) {
log("Got exception trying to set display to null; cssText is now: \"" + e.style.cssText + "\".");
}
setInitialStyleForE();
try {
e.style.setProperty("display", "block", "");
log("Successfully set display to \"block\" with setProperty; cssText is now: \"" + e.style.cssText + "\".");
} catch (exception) {
log("Got exception trying to set display to \"block\" with setProperty; cssText is now: \"" + e.style.cssText + "\".");
}
setInitialStyleForE();
try {
e.style.setProperty("display", "foobar", "");
log("Successfully set display to \"foobar\" with setProperty; cssText is now: \"" + e.style.cssText + "\".");
} catch (exception) {
log("Got exception trying to set display to \"foobar\" with setProperty; cssText is now: \"" + e.style.cssText + "\".");
}
setInitialStyleForE();
try {
e.style.setProperty("display", "", "");
log("Successfully set display to \"\" with setProperty; cssText is now: \"" + e.style.cssText + "\".");
} catch (exception) {
log("Got exception trying to set display to \"\" with setProperty; cssText is now: \"" + e.style.cssText + "\".");
}
setInitialStyleForE();
try {
e.style.setProperty("display", null, "");
log("Successfully set display to null with setProperty; cssText is now: \"" + e.style.cssText + "\".");
} catch (exception) {
log("Got exception trying to set display to null with setProperty; cssText is now: \"" + e.style.cssText + "\".");
}
}
</script>
</head>
<body onload="test();">
<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=7296">bug 7296</a>.</p>
<p>This test checks to see whether you get exceptions when setting a property with a "bad value".
Setting using JavaScript property syntax and with setProperty() should behave the same.</p>
<P>It is OK if the order of properties changes from the expected results - IE 6 and Firefox 2 don't agree on it anyway.</p>
<hr>
<p id="e">This is the test element.</p>
<hr>
<ol id="console"></ol>
</body>
</html>