mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-16 12:52:46 +00:00
Base: Add a very simple test page for getComputedStyle()
This commit is contained in:
parent
0bcab60463
commit
caa9e1f622
48
Base/res/html/misc/computed-style.html
Normal file
48
Base/res/html/misc/computed-style.html
Normal file
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
#foo {
|
||||
color: magenta;
|
||||
}
|
||||
#invisible {
|
||||
display: none;
|
||||
color: blue;
|
||||
}
|
||||
#visible {
|
||||
display: block;
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id=foo>Some text</div>
|
||||
<div id=bar style="color: green">Other text</div>
|
||||
<div id=invisible>You cannot see me</div>
|
||||
<div id=visible>You CAN see me</div>
|
||||
<script>
|
||||
// #foo
|
||||
var foo = document.getElementById("foo");
|
||||
var fooStyle = window.getComputedStyle(foo);
|
||||
console.log(fooStyle.color);
|
||||
|
||||
// #bar
|
||||
var bar = document.getElementById("bar");
|
||||
var barStyle = bar.style;
|
||||
console.log(barStyle.color);
|
||||
|
||||
// #invisible
|
||||
var invisible = document.getElementById("invisible");
|
||||
var invisibleStyle = getComputedStyle(invisible);
|
||||
console.log(invisibleStyle.display)
|
||||
console.log(invisibleStyle.color)
|
||||
|
||||
// #visible
|
||||
var visible = document.getElementById("visible");
|
||||
var visibleStyle = getComputedStyle(visible);
|
||||
console.log(visibleStyle.display)
|
||||
console.log(visibleStyle.color)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -74,6 +74,8 @@
|
|||
|
||||
<h2>CSS</h2>
|
||||
<ul>
|
||||
<li><h3>CSSOM</h3></li>
|
||||
<li><a href="computed-style.html">Computed style</a></li>
|
||||
<li><h3>Selectors</h3></li>
|
||||
<li><a href="selectors.html">Selectors</a></li>
|
||||
<li><a href="attrselectors.html">Attribute selectors</a></li>
|
||||
|
|
Loading…
Reference in a new issue