summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/syntax/parsing-html-fragments
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/syntax/parsing-html-fragments')
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-1.css4
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-15-inverse.css4
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-15.css4
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-utf8.css4
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-001.html37
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-001.html.headers1
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-003.htmlbin0 -> 2624 bytes
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-004.htmlbin0 -> 2612 bytes
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-007.html37
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-007.html.headers1
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-009.html37
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-009.html.headers1
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-015.html35
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-015.html.headers1
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-016.html38
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-016.html.headers1
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-018.html38
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-018.html.headers1
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-030.html38
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-030.html.headers1
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-034.html39
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-034.html.headers1
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-037.html37
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-037.html.headers1
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-038.html38
-rw-r--r--testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-038.html.headers1
27 files changed, 400 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/.gitkeep b/testing/web-platform/tests/html/syntax/parsing-html-fragments/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/.gitkeep
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-1.css b/testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-1.css
new file mode 100644
index 000000000..956ec70e7
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-1.css
@@ -0,0 +1,4 @@
+@charset "utf-8";
+.test div.ýäè {
+ width: 100px;
+}
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-15-inverse.css b/testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-15-inverse.css
new file mode 100644
index 000000000..4a0285419
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-15-inverse.css
@@ -0,0 +1,4 @@
+@charset "utf-8";
+.test div#box.ÜÀÚ {
+ width: 100px;
+}
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-15.css b/testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-15.css
new file mode 100644
index 000000000..ec907a1a9
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-15.css
@@ -0,0 +1,4 @@
+@charset "utf-8";
+.test div.ÜÀÚ {
+ width: 100px;
+}
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-utf8.css b/testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-utf8.css
new file mode 100644
index 000000000..3fa2d5f47
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/support/encodingtests-utf8.css
@@ -0,0 +1,4 @@
+@charset "utf-8";
+.test div.ýäè {
+ width: 100px;
+}
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-001.html b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-001.html
new file mode 100644
index 000000000..a85682adf
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-001.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+ <title>HTTP charset</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://html.spec.whatwg.org/multipage/#the-input-byte-stream'>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<meta name='flags' content='http'>
+<style type='text/css'>
+.test div { width: 50px; }</style>
+<link rel="stylesheet" type="text/css" href="support/encodingtests-15.css">
+</head>
+<body>
+
+
+
+<div class='test'><div id='box' class='ýäè'>&#xA0;</div></div>
+
+
+<!--Notes:
+
+The test contains a div with a class name that contains the following sequence of bytes: 0xC3 0xBD 0xC3 0xA4 0xC3 0xA8. These represent different sequences of characters in ISO 8859-15, ISO 8859-1 and UTF-8. The external, UTF-8-encoded stylesheet contains a selector <code>.test div.&#x00C3;&#x0153;&#x00C3;&#x20AC;&#x00C3;&#x0161;</code>. This matches the sequence of bytes above when they are interpreted as ISO 8859-15. If the class name matches the selector then the test will pass.
+
+The only character encoding declaration for this HTML file is in the HTTP header, which sets the encoding to ISO 8859-15.
+
+-->
+<script>
+test(function() {
+assert_equals(document.getElementById('box').offsetWidth, 100);
+}, "The character encoding of a page can be set using the HTTP header charset declaration.");
+</script>
+
+<div id='log'></div>
+
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-001.html.headers b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-001.html.headers
new file mode 100644
index 000000000..3d9718c07
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-001.html.headers
@@ -0,0 +1 @@
+Content-Type: text/html; charset=iso-8859-15
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-003.html b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-003.html
new file mode 100644
index 000000000..5b3863b4c
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-003.html
Binary files differ
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-004.html b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-004.html
new file mode 100644
index 000000000..2041daff0
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-004.html
Binary files differ
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-007.html b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-007.html
new file mode 100644
index 000000000..03dd532b3
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-007.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-15"> <title>meta content attribute</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://html.spec.whatwg.org/multipage/#the-input-byte-stream'>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<meta name='flags' content='http'>
+<style type='text/css'>
+.test div { width: 50px; }</style>
+<link rel="stylesheet" type="text/css" href="support/encodingtests-15.css">
+</head>
+<body>
+
+
+
+<div class='test'><div id='box' class='ýäè'>&#xA0;</div></div>
+
+
+<!--Notes:
+
+The only character encoding declaration for this HTML file is in the content attribute of the meta element, which declares the encoding to be ISO 8859-15.
+
+The test contains a div with a class name that contains the following sequence of bytes: 0xC3 0xBD 0xC3 0xA4 0xC3 0xA8. These represent different sequences of characters in ISO 8859-15, ISO 8859-1 and UTF-8. The external, UTF-8-encoded stylesheet contains a selector <code>.test div.&#x00C3;&#x0153;&#x00C3;&#x20AC;&#x00C3;&#x0161;</code>. This matches the sequence of bytes above when they are interpreted as ISO 8859-15. If the class name matches the selector then the test will pass.
+
+-->
+<script>
+test(function() {
+assert_equals(document.getElementById('box').offsetWidth, 100);
+}, "The character encoding of the page can be set by a meta element with http-equiv and content attributes.");
+</script>
+
+<div id='log'></div>
+
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-007.html.headers b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-007.html.headers
new file mode 100644
index 000000000..156209f9c
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-007.html.headers
@@ -0,0 +1 @@
+Content-Type: text/html
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-009.html b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-009.html
new file mode 100644
index 000000000..138329283
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-009.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+ <meta charset="iso-8859-15"> <title>meta charset attribute</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://html.spec.whatwg.org/multipage/#the-input-byte-stream'>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<meta name='flags' content='http'>
+<style type='text/css'>
+.test div { width: 50px; }</style>
+<link rel="stylesheet" type="text/css" href="support/encodingtests-15.css">
+</head>
+<body>
+
+
+
+<div class='test'><div id='box' class='ýäè'>&#xA0;</div></div>
+
+
+<!--Notes:
+
+The only character encoding declaration for this HTML file is in the charset attribute of the meta element, which declares the encoding to be ISO 8859-15.
+
+The test contains a div with a class name that contains the following sequence of bytes: 0xC3 0xBD 0xC3 0xA4 0xC3 0xA8. These represent different sequences of characters in ISO 8859-15, ISO 8859-1 and UTF-8. The external, UTF-8-encoded stylesheet contains a selector <code>.test div.&#x00C3;&#x0153;&#x00C3;&#x20AC;&#x00C3;&#x0161;</code>. This matches the sequence of bytes above when they are interpreted as ISO 8859-15. If the class name matches the selector then the test will pass.
+
+-->
+<script>
+test(function() {
+assert_equals(document.getElementById('box').offsetWidth, 100);
+}, "The character encoding of the page can be set by a meta element with charset attribute.");
+</script>
+
+<div id='log'></div>
+
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-009.html.headers b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-009.html.headers
new file mode 100644
index 000000000..156209f9c
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-009.html.headers
@@ -0,0 +1 @@
+Content-Type: text/html
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-015.html b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-015.html
new file mode 100644
index 000000000..383c93b5e
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-015.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+ <title>No encoding declaration</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://html.spec.whatwg.org/multipage/#the-input-byte-stream'>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<meta name='flags' content='http'>
+<style type='text/css'>
+.test div { width: 50px; }</style>
+<link rel="stylesheet" type="text/css" href="support/encodingtests-utf8.css">
+</head>
+<body>
+
+
+
+<div class='test'><div id='box' class='ýäè'>&#xA0;</div></div>
+
+
+<!--Notes:
+
+The test on this page contains a div with a class name that contains the following sequence of bytes: 0xC3 0xBD 0xC3 0xA4 0xC3 0xA8. These represent different sequences of characters in ISO 8859-15, ISO 8859-1 and UTF-8. The external, UTF-8-encoded stylesheet contains a selector <code>.test div.&#x00FD;&#x00E4;&#x00E8;</code>. This matches the sequence of bytes above when they are interpreted as UTF-8. If the class name matches the selector then the test will pass.
+
+-->
+<script>
+test(function() {
+assert_equals(document.getElementById('box').offsetWidth, 100);
+}, "A page with no encoding information in HTTP, BOM, XML declaration or meta element will be treated as UTF-8.");
+</script>
+
+<div id='log'></div>
+
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-015.html.headers b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-015.html.headers
new file mode 100644
index 000000000..156209f9c
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-015.html.headers
@@ -0,0 +1 @@
+Content-Type: text/html
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-016.html b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-016.html
new file mode 100644
index 000000000..141ca3e56
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-016.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+ <meta http-equiv="content-type" content="text/html;charset=iso-8859-1" > <title>HTTP vs meta content</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://html.spec.whatwg.org/multipage/#the-input-byte-stream'>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<meta name='flags' content='http'>
+<style type='text/css'>
+.test div { width: 50px; }.test div { width: 90px; }
+</style>
+<link rel="stylesheet" type="text/css" href="support/encodingtests-15.css">
+</head>
+<body>
+
+
+
+<div class='test'><div id='box' class='ýäè'>&#xA0;</div></div>
+
+
+<!--Notes:
+
+The HTTP header attempts to set the character encoding to ISO 8859-15. The page contains an encoding declaration in a meta content attribute that attempts to set the character encoding to ISO 8859-1.
+
+The test contains a div with a class name that contains the following sequence of bytes: 0xC3 0xBD 0xC3 0xA4 0xC3 0xA8. These represent different sequences of characters in ISO 8859-15, ISO 8859-1 and UTF-8. The external, UTF-8-encoded stylesheet contains a selector <code>.test div.&#x00C3;&#x0153;&#x00C3;&#x20AC;&#x00C3;&#x0161;</code>. This matches the sequence of bytes above when they are interpreted as ISO 8859-15. If the class name matches the selector then the test will pass.
+
+-->
+<script>
+test(function() {
+assert_equals(document.getElementById('box').offsetWidth, 100);
+}, "The HTTP header has a higher precedence than an encoding declaration in a meta content attribute.");
+</script>
+
+<div id='log'></div>
+
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-016.html.headers b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-016.html.headers
new file mode 100644
index 000000000..3d9718c07
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-016.html.headers
@@ -0,0 +1 @@
+Content-Type: text/html; charset=iso-8859-15
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-018.html b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-018.html
new file mode 100644
index 000000000..9ee7510e5
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-018.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+ <meta charset="iso-8859-1" > <title>HTTP vs meta charset</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://html.spec.whatwg.org/multipage/#the-input-byte-stream'>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<meta name='flags' content='http'>
+<style type='text/css'>
+.test div { width: 50px; }.test div { width: 90px; }
+</style>
+<link rel="stylesheet" type="text/css" href="support/encodingtests-15.css">
+</head>
+<body>
+
+
+
+<div class='test'><div id='box' class='ýäè'>&#xA0;</div></div>
+
+
+<!--Notes:
+
+The HTTP header attempts to set the character encoding to ISO 8859-15. The page contains an encoding declaration in a meta charset attribute that attempts to set the character encoding to ISO 8859-1.
+
+The test contains a div with a class name that contains the following sequence of bytes: 0xC3 0xBD 0xC3 0xA4 0xC3 0xA8. These represent different sequences of characters in ISO 8859-15, ISO 8859-1 and UTF-8. The external, UTF-8-encoded stylesheet contains a selector <code>.test div.&#x00C3;&#x0153;&#x00C3;&#x20AC;&#x00C3;&#x0161;</code>. This matches the sequence of bytes above when they are interpreted as ISO 8859-15. If the class name matches the selector then the test will pass.
+
+-->
+<script>
+test(function() {
+assert_equals(document.getElementById('box').offsetWidth, 100);
+}, "The HTTP header has a higher precedence than an encoding declaration in a meta charset attribute.");
+</script>
+
+<div id='log'></div>
+
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-018.html.headers b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-018.html.headers
new file mode 100644
index 000000000..3d9718c07
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-018.html.headers
@@ -0,0 +1 @@
+Content-Type: text/html; charset=iso-8859-15
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-030.html b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-030.html
new file mode 100644
index 000000000..5f8519992
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-030.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+ <meta charset="iso-8859-15" ><meta http-equiv="content-type" content="text/html;charset=iso-8859-1" > <title>meta charset, then meta content</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://html.spec.whatwg.org/multipage/#the-input-byte-stream'>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<meta name='flags' content='http'>
+<style type='text/css'>
+.test div { width: 50px; }.test div { width: 90px; }
+</style>
+<link rel="stylesheet" type="text/css" href="support/encodingtests-15.css">
+</head>
+<body>
+
+
+
+<div class='test'><div id='box' class='ýäè'>&#xA0;</div></div>
+
+
+<!--Notes:
+
+The page contains an encoding declaration in a meta charset attribute that attempts to set the character encoding to ISO 8859-15, followed by a meta content attribute that tries to set the encoding to ISO 8859-1.
+
+The test contains a div with a class name that contains the following sequence of bytes: 0xC3 0xBD 0xC3 0xA4 0xC3 0xA8. These represent different sequences of characters in ISO 8859-15, ISO 8859-1 and UTF-8. The external, UTF-8-encoded stylesheet contains a selector <code>.test div.&#x00C3;&#x0153;&#x00C3;&#x20AC;&#x00C3;&#x0161;</code>. This matches the sequence of bytes above when they are interpreted as ISO 8859-15. If the class name matches the selector then the test will pass.
+
+-->
+<script>
+test(function() {
+assert_equals(document.getElementById('box').offsetWidth, 100);
+}, "An encoding declaration in a meta charset attribute has a higher precedence than a following encoding declaration in a meta charset attribute.");
+</script>
+
+<div id='log'></div>
+
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-030.html.headers b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-030.html.headers
new file mode 100644
index 000000000..156209f9c
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-030.html.headers
@@ -0,0 +1 @@
+Content-Type: text/html
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-034.html b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-034.html
new file mode 100644
index 000000000..f0b699792
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-034.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+ <title>HTTP vs UTF-8 BOM</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://html.spec.whatwg.org/multipage/#the-input-byte-stream'>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<meta name='flags' content='http'>
+<style type='text/css'>
+.test div { width: 50px; }</style>
+<link rel="stylesheet" type="text/css" href="support/encodingtests-utf8.css">
+</head>
+<body>
+
+
+
+<div class='test'><div id='box' class='ýäè'>&#xA0;</div></div>
+
+
+<!--Notes:
+
+The HTTP header attempts to set the character encoding to ISO 8859-15. The page starts with a UTF-8 signature.
+
+The test contains a div with a class name that contains the following sequence of bytes: 0xC3 0xBD 0xC3 0xA4 0xC3 0xA8. These represent different sequences of characters in ISO 8859-15, ISO 8859-1 and UTF-8. The external, UTF-8-encoded stylesheet contains a selector <code>.test div.&#x00FD;&#x00E4;&#x00E8;</code>. This matches the sequence of bytes above when they are interpreted as UTF-8. If the class name matches the selector then the test will pass.
+
+If the test is unsuccessful, the characters &#x00EF;&#x00BB;&#x00BF; should appear at the top of the page. These represent the bytes that make up the UTF-8 signature when encountered in the ISO 8859-15 encoding.
+
+-->
+<script>
+test(function() {
+assert_equals(document.getElementById('box').offsetWidth, 100);
+}, "A character encoding set in the HTTP header has lower precedence than the UTF-8 signature.");
+</script>
+
+<div id='log'></div>
+
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-034.html.headers b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-034.html.headers
new file mode 100644
index 000000000..3d9718c07
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-034.html.headers
@@ -0,0 +1 @@
+Content-Type: text/html; charset=iso-8859-15
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-037.html b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-037.html
new file mode 100644
index 000000000..1fcf157b2
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-037.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-15"> <title>UTF-8 BOM vs meta content</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://html.spec.whatwg.org/multipage/#the-input-byte-stream'>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<meta name='flags' content='http'>
+<style type='text/css'>
+.test div { width: 50px; }</style>
+<link rel="stylesheet" type="text/css" href="support/encodingtests-utf8.css">
+</head>
+<body>
+
+
+
+<div class='test'><div id='box' class='ýäè'>&#xA0;</div></div>
+
+
+<!--Notes:
+
+The page contains an encoding declaration in a meta content attribute that attempts to set the character encoding to ISO 8859-15, but the file starts with a UTF-8 signature.
+
+The test contains a div with a class name that contains the following sequence of bytes: 0xC3 0xBD 0xC3 0xA4 0xC3 0xA8. These represent different sequences of characters in ISO 8859-15, ISO 8859-1 and UTF-8. The external, UTF-8-encoded stylesheet contains a selector <code>.test div.&#x00FD;&#x00E4;&#x00E8;</code>. This matches the sequence of bytes above when they are interpreted as UTF-8. If the class name matches the selector then the test will pass.
+
+-->
+<script>
+test(function() {
+assert_equals(document.getElementById('box').offsetWidth, 100);
+}, "A page with a UTF-8 BOM will be recognized as UTF-8 even if the meta content attribute declares a different encoding.");
+</script>
+
+<div id='log'></div>
+
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-037.html.headers b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-037.html.headers
new file mode 100644
index 000000000..156209f9c
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-037.html.headers
@@ -0,0 +1 @@
+Content-Type: text/html
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-038.html b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-038.html
new file mode 100644
index 000000000..9432113a2
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-038.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html lang="en" >
+<head>
+ <meta charset="iso-8859-15"> <title>UTF-8 BOM vs meta charset</title>
+<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
+<link rel='help' href='https://html.spec.whatwg.org/multipage/#the-input-byte-stream'>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<meta name='flags' content='http'>
+<style type='text/css'>
+.test div { width: 50px; }.test div { width: 90px; }
+</style>
+<link rel="stylesheet" type="text/css" href="support/encodingtests-utf8.css">
+</head>
+<body>
+
+
+
+<div class='test'><div id='box' class='ýäè'>&#xA0;</div></div>
+
+
+<!--Notes:
+
+The page contains an encoding declaration in a meta charset attribute that attempts to set the character encoding to ISO 8859-15, but the file starts with a UTF-8 signature.
+
+The test contains a div with a class name that contains the following sequence of bytes: 0xC3 0xBD 0xC3 0xA4 0xC3 0xA8. These represent different sequences of characters in ISO 8859-15, ISO 8859-1 and UTF-8. The external, UTF-8-encoded stylesheet contains a selector <code>.test div.&#x00FD;&#x00E4;&#x00E8;</code>. This matches the sequence of bytes above when they are interpreted as UTF-8. If the class name matches the selector then the test will pass.
+
+-->
+<script>
+test(function() {
+assert_equals(document.getElementById('box').offsetWidth, 100);
+}, "A page with a UTF-8 BOM will be recognized as UTF-8 even if the meta charset attribute declares a different encoding.");
+</script>
+
+<div id='log'></div>
+
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-038.html.headers b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-038.html.headers
new file mode 100644
index 000000000..156209f9c
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-038.html.headers
@@ -0,0 +1 @@
+Content-Type: text/html