<style>
.display-when-last-child { display: none; }
.display-when-last-child:last-child { display: block; }
</style>
<div>
<div class="display-when-last-child">PASS</div>
<div id="test"></div>
</div>
<script>
var test = document.getElementById('test');
test.parentElement.removeChild(test);
if (window.testRunner)
testRunner.dumpAsText();
</script>