Skip to content

Instantly share code, notes, and snippets.

@ekashida
Forked from sdesai/gist:6002726
Created July 16, 2013 00:38
Show Gist options
  • Save ekashida/6004822 to your computer and use it in GitHub Desktop.
Save ekashida/6004822 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Computed values of scoped CSS</title>
</head>
<body>
<div>
This text should be visible. It should not have a green background color.
</div>
<div>
<style scoped>
.hidden {
display: none;
}
div {
background: green;
}
</style>
<div id="testme" class="hidden">
This text should not be visible. It should have a green background color.
</div>
<script>
var testme = document.getElementById('testme'),
computed = window.getComputedStyle(testme);
alert('display: ' + computed.display + ' background-color: ' + computed['background-color']);
</script>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment