diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/html/syntax/parsing-html-fragments | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/syntax/parsing-html-fragments')
26 files changed, 484 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/innerHTML-setter-default-namespace.xhtml b/testing/web-platform/tests/html/syntax/parsing-html-fragments/innerHTML-setter-default-namespace.xhtml new file mode 100644 index 0000000000..19f17f1e28 --- /dev/null +++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/innerHTML-setter-default-namespace.xhtml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<span xmlns="someNamespace" xmlns:html="http://www.w3.org/1999/xhtml"> + <html:span id="target"/> +</span> +<script> +<![CDATA[ + +test(() => { + const element = document.getElementById("target"); + element.innerHTML = '<b /><html:b />'; + assert_equals(element.firstChild.prefix, null); + assert_equals(element.firstChild.namespaceURI, "someNamespace"); + assert_equals(element.lastChild.prefix, 'html'); + assert_equals(element.lastChild.namespaceURI, "http://www.w3.org/1999/xhtml"); +}, "Setting innerHTML on a HTML element with a non-HTML namespace as the default namespace"); + +test(() => { + const element = document.getElementById("target"); + element.outerHTML = '<b /><html:b />'; + assert_equals(element.firstChild.prefix, null); + assert_equals(element.firstChild.namespaceURI, "someNamespace"); + assert_equals(element.lastChild.prefix, 'html'); + assert_equals(element.lastChild.namespaceURI, "http://www.w3.org/1999/xhtml"); +}, "Setting outerHTML on a HTML element with a non-HTML namespace as the default namespace"); + +]]> +</script> +</body> +</html> 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 0000000000..956ec70e71 --- /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 0000000000..4a02854197 --- /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 0000000000..ec907a1a94 --- /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 0000000000..3fa2d5f475 --- /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 0000000000..a85682adf9 --- /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='ýäè'> </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.ÜÀÚ</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 0000000000..3d9718c07b --- /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 Binary files differnew file mode 100644 index 0000000000..5b46a7f0f0 --- /dev/null +++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-003.html 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 Binary files differnew file mode 100644 index 0000000000..571d5bf8e8 --- /dev/null +++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-004.html 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 0000000000..03dd532b38 --- /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='ýäè'> </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.ÜÀÚ</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 0000000000..156209f9c8 --- /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 0000000000..1383292832 --- /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='ýäè'> </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.ÜÀÚ</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 0000000000..156209f9c8 --- /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-016.html b/testing/web-platform/tests/html/syntax/parsing-html-fragments/the-input-byte-stream-016.html new file mode 100644 index 0000000000..141ca3e56f --- /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='ýäè'> </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.ÜÀÚ</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 0000000000..3d9718c07b --- /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 0000000000..9ee7510e5a --- /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='ýäè'> </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.ÜÀÚ</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 0000000000..3d9718c07b --- /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 0000000000..5f85199928 --- /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='ýäè'> </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.ÜÀÚ</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 0000000000..156209f9c8 --- /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 0000000000..f0b699792e --- /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='ýäè'> </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.ýäè</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  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 0000000000..3d9718c07b --- /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 0000000000..1fcf157b23 --- /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='ýäè'> </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.ýäè</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 0000000000..156209f9c8 --- /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 0000000000..9432113a25 --- /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='ýäè'> </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.ýäè</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 0000000000..156209f9c8 --- /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 diff --git a/testing/web-platform/tests/html/syntax/parsing-html-fragments/tokenizer-modes-001.html b/testing/web-platform/tests/html/syntax/parsing-html-fragments/tokenizer-modes-001.html new file mode 100644 index 0000000000..d283274214 --- /dev/null +++ b/testing/web-platform/tests/html/syntax/parsing-html-fragments/tokenizer-modes-001.html @@ -0,0 +1,85 @@ +<!DOCTYPE html> +<html lang="en" > +<head> + <title>Tokenizer states</title> +<link rel='author' title='Henri Sivonen' href='mailto:hsivonen@hsivonen.fi'> +<link rel='help' href='https://html.spec.whatwg.org/#html-fragment-parsing-algorithm'> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<script> +test(function() { + var e = document.createElement("title"); + e.innerHTML = "</title><div>"; + assert_equals(e.getElementsByTagName("div").length, 0); + assert_equals(e.innerHTML, "</title><div>"); +}, "</title> should not break out of title."); + +test(function() { + var e = document.createElement("textarea"); + e.innerHTML = "</textarea><div>"; + assert_equals(e.getElementsByTagName("div").length, 0); + assert_equals(e.innerHTML, "</textarea><div>"); +}, "</textarea> should not break out of textarea."); + +test(function() { + var e = document.createElement("style"); + e.innerHTML = "</style><div>"; + assert_equals(e.getElementsByTagName("div").length, 0); + assert_equals(e.innerHTML, "</style><div>"); +}, "</style> should not break out of style."); + +test(function() { + var e = document.createElement("xmp"); + e.innerHTML = "</xmp><div>"; + assert_equals(e.getElementsByTagName("div").length, 0); + assert_equals(e.innerHTML, "</xmp><div>"); +}, "</xmp> should not break out of xmp."); + +test(function() { + var e = document.createElement("iframe"); + e.innerHTML = "</iframe><div>"; + assert_equals(e.getElementsByTagName("div").length, 0); + assert_equals(e.innerHTML, "</iframe><div>"); +}, "</iframe> should not break out of iframe."); + +test(function() { + var e = document.createElement("noembed"); + e.innerHTML = "</noembed><div>"; + assert_equals(e.getElementsByTagName("div").length, 0); + assert_equals(e.innerHTML, "</noembed><div>"); +}, "</noembed> should not break out of noembed."); + +test(function() { + var e = document.createElement("noframes"); + e.innerHTML = "</noframes><div>"; + assert_equals(e.getElementsByTagName("div").length, 0); + assert_equals(e.innerHTML, "</noframes><div>"); +}, "</noframes> should not break out of noframes."); + +test(function() { + var e = document.createElement("script"); + e.innerHTML = "<\/script><div>"; + assert_equals(e.getElementsByTagName("div").length, 0); + assert_equals(e.innerHTML, "<\/script><div>"); +}, "<\/script> should not break out of script."); + + +test(function() { + var e = document.createElement("noscript"); + e.innerHTML = "</noscript><div>"; + assert_equals(e.getElementsByTagName("div").length, 0); + assert_equals(e.innerHTML, "</noscript><div>"); +}, "</noscript> should not break out of noscript."); + +test(function() { + var e = document.createElement("plaintext"); + e.innerHTML = "</plaintext><div>"; + assert_equals(e.getElementsByTagName("div").length, 0); + assert_equals(e.innerHTML, "</plaintext><div>"); +}, "</plaintext> should not break out of plaintext."); + +</script> +</body> +</html> |