<html>
<head>
<script>
function print(message, color)
{
var paragraph = document.createElement("div");
paragraph.appendChild(document.createTextNode(message));
paragraph.style.fontFamily = "monospace";
if (color)
paragraph.style.color = color;
document.getElementById("console").appendChild(paragraph);
}
function shouldBe(a, b)
{
var evalA;
try {
evalA = eval(a);
} catch(e) {
evalA = e;
}
if (evalA == b)
print("PASS: " + a + " should be " + b + " and is.", "green");
else
print("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".", "red");
}
function test()
{
if (window.testRunner)
testRunner.dumpAsText();
shouldBe("document.body.style.background == 'green'", true);
shouldBe("document.getElementById('div1').style.background == ''", true);
shouldBe("document.getElementById('div2').style.background == '50% 50% blue'", true);
shouldBe("document.getElementById('div3').style.background == 'none repeat scroll rgb(255, 255, 255)'", true);
}
</script>
</head>
<body onload="test();" style="background: green; color:white">
<div id="div1" style="background-repeat: repeat-x, repeat-y; background-color:white"></div>
<div id="div2" style="background: 50% 50% blue"></div>
<div id="div3" style="background: rgb(255, 255, 255) none repeat scroll"></div>
<p>This page tests whether or not the background shorthand properly omits
initial values.
<hr>
<div id='console' style="background-color:white; border:2px solid black"></div>
</body>
</html>