diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/conformance-checkers/html/elements/script/streams-demo-streaming-element-isvalid.html | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/conformance-checkers/html/elements/script/streams-demo-streaming-element-isvalid.html')
-rw-r--r-- | testing/web-platform/tests/conformance-checkers/html/elements/script/streams-demo-streaming-element-isvalid.html | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/testing/web-platform/tests/conformance-checkers/html/elements/script/streams-demo-streaming-element-isvalid.html b/testing/web-platform/tests/conformance-checkers/html/elements/script/streams-demo-streaming-element-isvalid.html new file mode 100644 index 0000000000..c9c70d5487 --- /dev/null +++ b/testing/web-platform/tests/conformance-checkers/html/elements/script/streams-demo-streaming-element-isvalid.html @@ -0,0 +1,60 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Streaming element demo</title> + +<script src="transforms/transform-stream-polyfill.js"></script> +<script src="transforms/text-encode-transform.js"></script> +<script src="tags/streaming-element.js"></script> +<script src="resources/highlight.pack.js"></script> +<script src="resources/web-animations.min.js"></script> +<script src="tags/view-source.js"></script> + +<link rel=stylesheet href="resources/common.css"> +<link rel=stylesheet href="resources/jank-meter.css"> +<link rel=stylesheet href="resources/commits.css"> + +<h1>Streaming element demo</h1> +<a id=back-to-index href=index.html>Back to demo index</a> +<view-source></view-source> + +<div id=buttons> + <button id="load">Load HTML stream</button> + <button id="reset">Reset</button> +</div> + +<div id=jank-meter>JANK METER</div> + +<streaming-element id=target></streaming-element> + +<script> +'use strict'; +const loadButton = document.querySelector('#load'); +const resetButton = document.querySelector('#reset'); +const targetDiv = document.querySelector('#target'); + +// BEGIN SOURCE TO VIEW +async function streamDirectlyIntoDOM() { + const response = await fetch('data/commits.include', + { + mode: 'same-origin', + headers: { + 'Cache-Control': 'no-cache, no-store' + } + }); + + await response.body + .pipeThrough(new TextDecoder()) + .pipeTo(targetDiv.writable); +} + +loadButton.onclick = () => { + loadButton.disabled = true; + streamDirectlyIntoDOM(); +}; +// END SOURCE TO VIEW + +resetButton.onclick = () => { + targetDiv.reset(); + loadButton.disabled = false; +}; +</script> |