Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions css/css-content/element-replacement-dynamic.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="utf-8">
<title>The content CSS attribute can replace an element's contents dynamically</title>
<link rel="author" title="Oriol Brufau" href="mailto:[email protected]" />
<link rel="match" href="element-replacement-ref.html" />
<link rel="help" href="https://drafts.csswg.org/css-content-3/#content-property" />
<meta name="assert" content"This test checks that the CSS content propertly can replace a normal element's contents when changed dynamically" />
<meta name="assert" content="This test checks that the CSS content propertly can replace a normal element's contents when changed dynamically" />

<script src="/common/reftest-wait.js"></script>
<script src="/common/rendering-utils.js"></script>

<style>
#target {
Expand All @@ -18,7 +22,8 @@
<div id="target">This text should not be visible</div>

<script>
const target = document.getElementById("target");
getComputedStyle(target).width;
target.className = "replaced";
waitForAtLeastOneFrame().then(() => {
document.getElementById("target").className = "replaced";
takeScreenshot();
});
</script>
17 changes: 17 additions & 0 deletions css/css-content/element-replacement-root-canvas-bg-from-body.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<title>When content CSS attribute can replace a document's root, the HTML body element's background does not become the canvas background</title>
<link rel="match" href="element-replacement-root-ref.html" />
<link rel="help" href="https://drafts.csswg.org/css-content-3/#content-property" />
<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#body-background" />
<meta name="assert" content="When the content CSS attribute replaces a document's root, its contents do not create boxes, so the HTML body element's background can't affect the canvas background." />

<style>
:root {
content: url('resources/rect.svg');
}
body {
background-color: aquamarine;
}
</style>

<p>This text should not be visible</p>
13 changes: 13 additions & 0 deletions css/css-content/element-replacement-root-canvas-bg-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<title>Reference for the content CSS attribute can replace a document's root</title>

<style>
:root {
background-color: aquamarine;
}
body {
margin: 0;
}
</style>

<img src="resources/rect.svg" />
15 changes: 15 additions & 0 deletions css/css-content/element-replacement-root-canvas-bg.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<title>When content CSS attribute can replace a document's root, its canvas still becomes the canvas background</title>
<link rel="match" href="element-replacement-root-canvas-bg-ref.html" />
<link rel="help" href="https://drafts.csswg.org/css-content-3/#content-property" />
<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#root-background" />
<meta name="assert" content="When the content CSS attribute replaces a document's root, it does not affect the fact that the root's background becomes the canvas background" />

<style>
:root {
content: url('resources/rect.svg');
background-color: aquamarine;
}
</style>

<p>This text should not be visible</p>
10 changes: 10 additions & 0 deletions css/css-content/element-replacement-root-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<title>Reference for the content CSS attribute can replace a document's root</title>

<style>
body {
margin: 0;
}
</style>

<img src="resources/rect.svg" />
13 changes: 13 additions & 0 deletions css/css-content/element-replacement-root.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<title>The content CSS attribute can replace a document's root</title>
<link rel="match" href="element-replacement-root-ref.html" />
<link rel="help" href="https://drafts.csswg.org/css-content-3/#content-property" />
<meta name="assert" content="This test checks that the CSS content propertly can replace the contents of a document's root" />

<style>
:root {
content: url('resources/rect.svg');
}
</style>

<p>This text should not be visible</p>