11cb0ef41Sopenharmony_ci<!DOCTYPE html> 21cb0ef41Sopenharmony_ci<meta charset="utf-8"> 31cb0ef41Sopenharmony_ci<title>Data URI parsing of fragments</title> 41cb0ef41Sopenharmony_ci<link rel="help" href="https://url.spec.whatwg.org/"> 51cb0ef41Sopenharmony_ci<meta name="assert" content="Fragments should not be included as part of a data URI's body"> 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci<script src="/resources/testharness.js"></script> 81cb0ef41Sopenharmony_ci<script src="/resources/testharnessreport.js"></script> 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci<iframe id="iframe"></iframe> 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ci<script> 131cb0ef41Sopenharmony_ciconst IFRAME_DATA_SRC = `data:text/html, 141cb0ef41Sopenharmony_ci <style>:target { color: green; }<\/style> 151cb0ef41Sopenharmony_ci <script>window.addEventListener('load', function() { 161cb0ef41Sopenharmony_ci const data = { 171cb0ef41Sopenharmony_ci foo_matches_target_selector: document.getElementById('foo').matches(':target'), 181cb0ef41Sopenharmony_ci body_html: document.body.innerHTML, 191cb0ef41Sopenharmony_ci }; 201cb0ef41Sopenharmony_ci parent.postMessage(data, '*'); 211cb0ef41Sopenharmony_ci });<\/script> 221cb0ef41Sopenharmony_ci <p id="foo">This should be the only visible text.</p>#foo`.replace('\n', ''); 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ciasync_test(function(t) { 251cb0ef41Sopenharmony_ci window.addEventListener("message", t.step_func_done(function(event) { 261cb0ef41Sopenharmony_ci assert_true(event.data.foo_matches_target_selector); 271cb0ef41Sopenharmony_ci assert_equals(event.data.body_html, 281cb0ef41Sopenharmony_ci '<p id="foo">This should be the only visible text.</p>'); 291cb0ef41Sopenharmony_ci })); 301cb0ef41Sopenharmony_ci 311cb0ef41Sopenharmony_ci const iframe = document.getElementById("iframe"); 321cb0ef41Sopenharmony_ci iframe.src = IFRAME_DATA_SRC; 331cb0ef41Sopenharmony_ci}); 341cb0ef41Sopenharmony_ci</script> 35