Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE HTML>
<html>
<!--
-->
<meta charset="utf-8">
<title>Test for Bug 1020244 - Manipulate content created with the AnonymousContent API</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<div>
<div id="test-element" class="test-class" test="test">text content</div>
</div>
<script>
// Insert content
let chromeDocument = SpecialPowers.wrap(document);
let testElement = document.querySelector("div");
let anonymousContent = chromeDocument.insertAnonymousContent();
anonymousContent.root.appendChild(testElement.cloneNode(true));
// Test getting/setting text content.
is(anonymousContent.root.getElementById("test-element").textContent,
"text content", "Textcontent for the test element is correct");
let anonTestElement = anonymousContent.root.getElementById("test-element");
anonTestElement.textContent =
"updated text content";
is(anonTestElement.textContent,
"updated text content",
"Textcontent for the test element is correct after update");
let anim = anonTestElement.animate([
{ transform: 'translateY(0px)' },
{ transform: 'translateY(-300px)' }
], 2000);
is(anim.playState, "running", "Animation should be running");
anim.cancel();
is(anim.playState, "idle", "Animation should have stopped immediately");
chromeDocument.removeAnonymousContent(anonymousContent);
</script>