- Notifications
You must be signed in to change notification settings - Fork 3.3k
/
Copy pathelement-replacement-dynamic.html
24 lines (21 loc) · 783 Bytes
/
element-replacement-dynamic.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!DOCTYPE html>
<metacharset="utf-8">
<title>The content CSS attribute can replace an element's contents dynamically</title>
<linkrel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com" />
<linkrel="match" href="element-replacement-ref.html" />
<linkrel="help" href="https://drafts.csswg.org/css-content-3/#content-property" />
<metaname="assert" content"This test checks that the CSS content propertly can replace a normal element's contents when changed dynamically" />
<style>
#target {
content: none;
}
#target.replaced {
content:url('resources/rect.svg');
}
</style>
<divid="target">This text should not be visible</div>
<script>
consttarget=document.getElementById("target");
getComputedStyle(target).width;
target.className="replaced";
</script>