<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<div id="test" style="color: red">
    <p style="color: green"></p>
    <p style="color: green"></p>
</div>
<script>

jsTestIsAsync = true;

description("This test checks that an element that shared its inline style with one or more other elements still retain that style after one of the sharing elements was destroyed.");

var testDiv = document.getElementById('test');
var pees = testDiv.getElementsByTagName('p');

testDiv.removeChild(pees[1])

setTimeout("callMeMaybe()", 10);
gc();

function callMeMaybe()
{
    var testDiv = document.getElementById('test');
    var pees = testDiv.getElementsByTagName('p');

    // Trigger a style recalc on pees[0].
    pees[0].style.background = 'white';

    computedStyle = getComputedStyle(pees[0]);
    shouldBe("computedStyle.color", "'rgb(0, 128, 0)'");
    finishJSTest();
}

</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
