Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005'

This commit is contained in:
WPT Sync Bot 2022-11-10 01:22:36 +00:00
parent ace9b32b1c
commit df68c4e5d1
15632 changed files with 514865 additions and 155000 deletions

View file

@ -2,22 +2,12 @@
<meta charset="utf-8">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="support/utils.js"></script>
<link rel=stylesheet href=stylesheet.py>
<link rel=stylesheet media="screen and (max-width:10px)" href=stylesheet.py?stylesNotMatchingEnvironment&delay=2>
<h1>Dominic Farolino</h1>
<script>
function styleExists(styleText) {
for (let styleRule of document.styleSheets) {
let currentStyleText = styleRule.cssRules["0"].cssText;
if (currentStyleText == styleText) {
return true;
}
}
return false;
}
test(() => {
const h1 = document.querySelector('h1');
const computedColor = getComputedStyle(h1).color;

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<title>Script-created render-blocking link stylesheet is not script-blocking</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/utils.js"></script>
<script>
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = 'stylesheet.py?delay=1';
link.blocking = 'render';
document.head.appendChild(link);
</script>
<h1>Some text</h1>
<script>
test(() => {
assert_false(styleExists("h1 { color: purple; }"),
'stylesheet should still be pending');
const h1 = document.querySelector('h1');
assert_equals(getComputedStyle(h1).color, 'rgb(0, 0, 0)');
});
</script>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<title>Script-created render-blocking style element is not script-blocking</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/utils.js"></script>
<script>
const style = document.createElement('style');
const sheet = document.createTextNode('@import url(stylesheet.py?delay=1);');
style.appendChild(sheet);
style.blocking = 'render';
document.head.appendChild(style);
</script>
<h1>Some text</h1>
<script>
test(() => {
assert_false(styleExists("h1 { color: purple; }"),
'stylesheet should still be pending');
const h1 = document.querySelector('h1');
assert_equals(getComputedStyle(h1).color, 'rgb(0, 0, 0)');
});
</script>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<title>Script-created link stylesheet is not script-blocking</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/utils.js"></script>
<script>
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = 'stylesheet.py?delay=1';
document.head.appendChild(link);
</script>
<h1>Some text</h1>
<script>
test(() => {
assert_false(styleExists("h1 { color: purple; }"),
'stylesheet should still be pending');
const h1 = document.querySelector('h1');
assert_equals(getComputedStyle(h1).color, 'rgb(0, 0, 0)');
});
</script>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<title>Script-created style element is not script-blocking</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/utils.js"></script>
<script>
const style = document.createElement('style');
const sheet = document.createTextNode('@import url(stylesheet.py?delay=1);');
style.appendChild(sheet);
document.head.appendChild(style);
</script>
<h1>Some text</h1>
<script>
test(() => {
assert_false(styleExists("h1 { color: purple; }"),
'stylesheet should still be pending');
const h1 = document.querySelector('h1');
assert_equals(getComputedStyle(h1).color, 'rgb(0, 0, 0)');
});
</script>

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<title>Style element is script-blocking when media matches</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/utils.js"></script>
<style>
@import url('stylesheet.py?delay=1');
</style>
<h1>Some text</h1>
<script>
test(() => {
assert_true(styleExists("h1 { color: purple; }"),
'script should be blocked until the stylesheet is loaded');
const h1 = document.querySelector('h1');
assert_equals(getComputedStyle(h1).color, 'rgb(128, 0, 128)');
});
</script>

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<title>Style element is not script-blocking when media doesn't match</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/utils.js"></script>
<style media="print">
@import url('stylesheet.py?delay=1');
</style>
<h1>Some text</h1>
<script>
test(() => {
assert_false(styleExists("h1 { color: purple; }"),
'stylesheet should still be pending');
const h1 = document.querySelector('h1');
assert_equals(getComputedStyle(h1).color, 'rgb(0, 0, 0)');
});
</script>

View file

@ -0,0 +1,20 @@
function styleExistsInSheet(styleText, sheet) {
for (let rule of sheet.cssRules) {
if (styleText == rule.cssText)
return true;
if (rule instanceof CSSImportRule) {
if (rule.styleSheet && styleExistsInSheet(styleText, rule.styleSheet))
return true;
}
}
return false;
}
function styleExists(styleText) {
for (let sheet of document.styleSheets) {
if (styleExistsInSheet(styleText, sheet))
return true;
}
return false;
}