blob: e67bfdfea67361cffb60060ce1545da6ed2f9a7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1020244
-->
<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"/>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1020244">Mozilla Bug 1020244</a>
<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>
|