summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/selection/script-and-style-elements.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/selection/script-and-style-elements.html
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/selection/script-and-style-elements.html')
-rw-r--r--testing/web-platform/tests/selection/script-and-style-elements.html37
1 files changed, 37 insertions, 0 deletions
diff --git a/testing/web-platform/tests/selection/script-and-style-elements.html b/testing/web-platform/tests/selection/script-and-style-elements.html
new file mode 100644
index 0000000000..b75665917d
--- /dev/null
+++ b/testing/web-platform/tests/selection/script-and-style-elements.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<meta charset=utf-8>
+<title>Selection: STYLE and SCRIPT elements should be included in Selection.toString() if they are display!=none</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+window.onload = function() {
+ test(function() {
+ var selection = window.getSelection();
+ var p1 = document.getElementById("p1");
+
+ var range = document.createRange();
+ test_block_script();
+ range.selectNode(p1);
+ selection.addRange(range);
+ assert_equals(selection.toString().replace(/\r\n/g, "\n"), '\nstyle { display:block; color: green; } script { color: blue; }\nfunction test_block_script() { let pre = document.createElement("pre"); pre.append(document.createTextNode("PASS")); document.getElementById("p1").append(pre); }\n\nPASS');
+ });
+};
+</script>
+<div id=log></div>
+<div id="p1">
+<style style="display:none">#not_included{}</style>
+<style>
+ style { display:block; color: green; }
+ script { color: blue; }
+</style>
+<script>function not_included(){}</script>
+<script style="display:block">
+function test_block_script() {
+ let pre = document.createElement("pre");
+ pre.append(document.createTextNode("PASS"));
+ document.getElementById("p1").append(pre);
+}
+</script>
+</div>
+</body>
+</html>