summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/tools/third_party/html5lib
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/tools/third_party/html5lib
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/tools/third_party/html5lib')
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/.appveyor.yml31
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/.coveragerc8
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/.gitignore85
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/.prospector.yaml21
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/.pylintrc10
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/.pytest.expect1322
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/.travis.yml32
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/AUTHORS.rst66
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/CHANGES.rst359
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/CONTRIBUTING.rst60
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/LICENSE20
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/MANIFEST.in10
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/README.rst151
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/bench_html.py57
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/bench_wpt.py45
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/README.md8
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/html.html5000
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/LICENSE.md11
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/README.md52
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/001.html3
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/background-origin-007-ref.html18
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/background_shorthand_css_relative_url.html24
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/beforeunload-on-history-back-1.html5
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/euckr-encode-form.html52
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/frame-ancestors-self-allow.html16
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/grouping-dl.html30
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/heavy-styling-005.html15
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/htb-ltr-ltr.html74
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/idbindex_get8.htm27
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/idlharness.html34
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/li-type-unsupported-ref.html13
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/moz-css21-float-page-break-inside-avoid-6.html19
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/shape-outside-content-box-002.html66
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/worker-constructor.https.html86
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/2d.composite.image.destination-over.html33
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/align-content-wrap-002.html108
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/big5_chars_extra.html1
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/fetch.http.html143
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/filter-turbulence-invalid-001.html51
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/grid-auto-fill-rows-001.html184
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/image-orientation-from-image-content-images-ref.html86
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/masonry-item-placement-006.html149
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/moz-css21-table-page-break-inside-avoid-2.html29
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/position-sticky-table-th-bottom-ref.html62
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/pre-float-001.html36
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/resize-004.html20
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/test-plan.src.html1616
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/toBlob.png.html17
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/will-change-abspos-cb-001.html30
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/debug-info.py37
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/doc/Makefile177
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/doc/changes.rst3
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/doc/conf.py123
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.filters.rst58
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.rst38
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.treeadapters.rst20
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.treebuilders.rst42
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.treewalkers.rst50
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/doc/index.rst22
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/doc/license.rst4
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/doc/make.bat242
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/doc/modules.rst7
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/doc/movingparts.rst165
-rwxr-xr-xtesting/web-platform/tests/tools/third_party/html5lib/flake8-run.sh9
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/__init__.py35
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/_ihatexml.py289
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/_inputstream.py918
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/_tokenizer.py1735
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/__init__.py5
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py40
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/py.py67
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/_utils.py159
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/constants.py2946
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/__init__.py0
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/alphabeticalattributes.py29
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/base.py12
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/inject_meta_charset.py73
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/lint.py93
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/optionaltags.py207
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/sanitizer.py916
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/whitespace.py38
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/html5parser.py2795
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/serializer.py409
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/__init__.py1
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/conftest.py108
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/sanitizer-testdata/tests1.dat433
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/sanitizer.py51
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/core.test395
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/injectmeta.test350
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/optionaltags.test3254
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/options.test334
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/whitespace.test198
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/support.py199
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_alphabeticalattributes.py78
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_encoding.py117
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_meta.py41
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_optionaltags_filter.py7
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_parser2.py94
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_sanitizer.py133
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_serializer.py226
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_stream.py325
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_tokenizer2.py66
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_treeadapters.py40
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_treewalkers.py205
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_whitespace_filter.py125
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/tokenizer.py253
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/tokenizertotree.py69
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/tree_construction.py205
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/us-ascii.html3
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/utf-8-bom.html3
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/treeadapters/__init__.py30
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/treeadapters/genshi.py54
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/treeadapters/sax.py50
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/__init__.py88
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/base.py417
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py239
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/etree.py343
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/etree_lxml.py392
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/__init__.py154
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/base.py252
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/dom.py43
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/etree.py131
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/etree_lxml.py215
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/genshi.py69
-rwxr-xr-xtesting/web-platform/tests/tools/third_party/html5lib/parse.py236
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/pytest.ini17
-rwxr-xr-xtesting/web-platform/tests/tools/third_party/html5lib/requirements-install.sh15
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/requirements-optional.txt13
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/requirements-test.txt10
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/requirements.txt2
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/setup.cfg11
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/setup.py127
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/tox.ini20
-rw-r--r--testing/web-platform/tests/tools/third_party/html5lib/utils/entities.py101
134 files changed, 32500 insertions, 0 deletions
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/.appveyor.yml b/testing/web-platform/tests/tools/third_party/html5lib/.appveyor.yml
new file mode 100644
index 0000000000..984e2b7fa5
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/.appveyor.yml
@@ -0,0 +1,31 @@
+# To activate, change the Appveyor settings to use `.appveyor.yml`.
+environment:
+ global:
+ PATH: "C:\\Python27\\Scripts\\;%PATH%"
+ PYTEST_COMMAND: "coverage run -m pytest"
+ matrix:
+ - TOXENV: py27-base
+ - TOXENV: py27-optional
+ - TOXENV: py33-base
+ - TOXENV: py33-optional
+ - TOXENV: py34-base
+ - TOXENV: py34-optional
+ - TOXENV: py35-base
+ - TOXENV: py35-optional
+ - TOXENV: py36-base
+ - TOXENV: py36-optional
+
+install:
+ - git submodule update --init --recursive
+ - python -m pip install tox codecov
+
+build: off
+
+test_script:
+ - tox
+
+after_test:
+ - python debug-info.py
+
+on_success:
+ - codecov
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/.coveragerc b/testing/web-platform/tests/tools/third_party/html5lib/.coveragerc
new file mode 100644
index 0000000000..6facf35239
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/.coveragerc
@@ -0,0 +1,8 @@
+[run]
+branch = True
+source = html5lib
+
+[paths]
+source =
+ html5lib
+ .tox/*/lib/python*/site-packages/html5lib
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/.gitignore b/testing/web-platform/tests/tools/third_party/html5lib/.gitignore
new file mode 100644
index 0000000000..ecd62df31b
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/.gitignore
@@ -0,0 +1,85 @@
+# Copyright (c) 2014 GitHub, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*,cover
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+
+# Sphinx documentation
+doc/_build/
+
+# PyBuilder
+target/
+
+# Generated by parse.py -p
+stats.prof
+
+# IDE
+.idea
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/.prospector.yaml b/testing/web-platform/tests/tools/third_party/html5lib/.prospector.yaml
new file mode 100644
index 0000000000..7e8efe1a62
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/.prospector.yaml
@@ -0,0 +1,21 @@
+strictness: veryhigh
+doc-warnings: false
+test-warnings: false
+
+max-line-length: 139
+
+requirements:
+ - requirements.txt
+ - requirements-test.txt
+ - requirements-optional.txt
+
+ignore-paths:
+ - parse.py
+ - utils/
+
+python-targets:
+ - 2
+ - 3
+
+mccabe:
+ run: false
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/.pylintrc b/testing/web-platform/tests/tools/third_party/html5lib/.pylintrc
new file mode 100644
index 0000000000..ea74d5db3f
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/.pylintrc
@@ -0,0 +1,10 @@
+[MASTER]
+ignore=tests
+
+[MESSAGES CONTROL]
+# messages up to fixme should probably be fixed somehow
+disable = redefined-builtin,attribute-defined-outside-init,anomalous-backslash-in-string,no-self-use,redefined-outer-name,bad-continuation,wrong-import-order,superfluous-parens,no-member,duplicate-code,super-init-not-called,abstract-method,property-on-old-class,wrong-import-position,no-name-in-module,no-init,bad-mcs-classmethod-argument,bad-classmethod-argument,fixme,invalid-name,import-error,too-few-public-methods,too-many-ancestors,too-many-arguments,too-many-boolean-expressions,too-many-branches,too-many-instance-attributes,too-many-locals,too-many-lines,too-many-public-methods,too-many-return-statements,too-many-statements,missing-docstring,line-too-long,locally-disabled,locally-enabled,bad-builtin,deprecated-lambda
+
+[FORMAT]
+max-line-length=139
+single-line-if-stmt=no
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/.pytest.expect b/testing/web-platform/tests/tools/third_party/html5lib/.pytest.expect
new file mode 100644
index 0000000000..0fa326f035
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/.pytest.expect
@@ -0,0 +1,1322 @@
+pytest-expect file v1
+(2, 7, 11, 'final', 0)
+b'html5lib/tests/test_encoding.py::test_encoding::[110]': FAIL
+b'html5lib/tests/test_encoding.py::test_encoding::[111]': FAIL
+u'html5lib/tests/testdata/tokenizer/test2.test::0::dataState': FAIL
+u'html5lib/tests/testdata/tokenizer/test3.test::228::dataState': FAIL
+u'html5lib/tests/testdata/tokenizer/test3.test::231::dataState': FAIL
+u'html5lib/tests/testdata/tokenizer/test3.test::232::dataState': FAIL
+u'html5lib/tests/testdata/tokenizer/test3.test::234::dataState': FAIL
+u'html5lib/tests/testdata/tokenizer/test3.test::235::dataState': FAIL
+u'html5lib/tests/testdata/tokenizer/test3.test::237::dataState': FAIL
+u'html5lib/tests/testdata/tokenizer/test3.test::240::dataState': FAIL
+u'html5lib/tests/testdata/tokenizer/test3.test::241::dataState': FAIL
+u'html5lib/tests/testdata/tokenizer/test3.test::243::dataState': FAIL
+u'html5lib/tests/testdata/tokenizer/test3.test::244::dataState': FAIL
+u'html5lib/tests/testdata/tokenizer/test3.test::246::dataState': FAIL
+u'html5lib/tests/testdata/tokenizer/test3.test::258::dataState': FAIL
+u'html5lib/tests/testdata/tokenizer/test3.test::656::dataState': FAIL
+u'html5lib/tests/testdata/tree-construction/adoption01.dat::17::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/adoption01.dat::17::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/adoption01.dat::17::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/adoption01.dat::17::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/adoption01.dat::17::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/adoption01.dat::17::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/adoption01.dat::17::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/adoption01.dat::17::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::0::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::0::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::0::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::0::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::0::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::0::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::0::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::0::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::18::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::18::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::18::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::18::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::18::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::18::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::18::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::18::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::19::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::19::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::19::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::19::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::19::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::19::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::19::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::19::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::1::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::1::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::1::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::1::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::1::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::1::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::1::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::1::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::22::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::22::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::22::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::22::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::22::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::22::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::22::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::22::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::23::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::23::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::23::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::23::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::23::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::23::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::23::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::23::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::26::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::26::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::26::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::26::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::26::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::26::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::26::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::26::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::27::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::27::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::27::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::27::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::27::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::27::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::27::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::27::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::2::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::2::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::2::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::2::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::2::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::2::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::2::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::2::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::30::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::30::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::30::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::30::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::30::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::30::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::30::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::30::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::31::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::31::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::31::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::31::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::31::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::31::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::31::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::31::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::34::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::34::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::34::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::34::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::34::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::34::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::34::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::34::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::35::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::35::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::35::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::35::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::35::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::35::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::35::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::35::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::38::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::38::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::38::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::38::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::38::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::38::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::38::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::38::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::39::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::39::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::39::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::39::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::39::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::39::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::39::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::39::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::3::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::3::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::3::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::3::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::3::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::3::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::3::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::3::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::40::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::40::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::40::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::40::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::40::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::40::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::40::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::40::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::41::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::41::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::41::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::41::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::41::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::41::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::41::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::41::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::47::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::47::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::47::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::47::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::47::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::47::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::47::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::47::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::48::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::48::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::48::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::48::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::48::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::48::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::48::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/foreign-fragment.dat::48::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::0::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::0::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::0::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::0::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::0::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::0::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::0::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::0::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::1::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::1::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::1::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::1::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::1::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::1::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::1::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::1::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::2::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::2::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::2::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::2::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::2::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::2::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::2::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::2::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::3::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::3::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::3::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::3::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::3::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::3::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::3::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/isindex.dat::3::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::3::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::3::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::3::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::3::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::3::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::3::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::3::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::3::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::4::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::4::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::4::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::4::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::4::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::4::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::4::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::4::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::5::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::5::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::5::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::5::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::5::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::5::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::5::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::5::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/namespace-sensitivity.dat::0::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/namespace-sensitivity.dat::0::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/namespace-sensitivity.dat::0::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/namespace-sensitivity.dat::0::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/namespace-sensitivity.dat::0::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/namespace-sensitivity.dat::0::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/namespace-sensitivity.dat::0::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/namespace-sensitivity.dat::0::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::0::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::0::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::0::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::0::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::0::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::0::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::0::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::0::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::10::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::10::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::10::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::10::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::10::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::10::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::10::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::10::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::12::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::12::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::12::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::12::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::12::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::12::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::12::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::12::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::15::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::15::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::15::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::15::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::15::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::15::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::15::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::15::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::17::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::17::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::17::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::17::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::17::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::17::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::17::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::17::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::1::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::1::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::1::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::1::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::1::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::1::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::1::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::1::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::20::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::20::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::20::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::20::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::20::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::20::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::20::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::20::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::2::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::2::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::2::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::2::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::2::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::2::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::2::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::2::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::3::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::3::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::3::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::3::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::3::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::3::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::3::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::3::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::5::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::5::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::5::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::5::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::5::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::5::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::5::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::5::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::7::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::7::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::7::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::7::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::7::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::7::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::7::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/ruby.dat::7::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/adoption01.dat::0::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/adoption01.dat::0::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/adoption01.dat::0::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/adoption01.dat::0::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/adoption01.dat::0::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/adoption01.dat::0::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/adoption01.dat::0::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/adoption01.dat::0::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/ark.dat::0::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/ark.dat::0::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/ark.dat::0::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/ark.dat::0::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/ark.dat::0::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/ark.dat::0::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/ark.dat::0::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/ark.dat::0::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::0::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::0::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::0::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::0::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::0::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::0::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::0::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::0::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::1::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::1::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::1::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::1::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::1::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::1::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::1::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/scripted/webkit01.dat::1::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::0::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::0::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::0::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::0::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::0::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::0::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::0::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::0::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::100::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::100::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::100::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::100::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::100::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::100::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::100::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::100::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::101::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::101::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::101::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::101::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::101::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::101::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::101::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::101::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::102::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::102::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::102::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::102::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::102::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::102::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::102::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::102::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::103::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::103::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::103::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::103::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::103::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::103::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::103::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::103::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::104::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::104::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::104::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::104::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::104::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::104::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::104::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::104::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::105::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::105::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::105::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::105::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::105::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::105::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::105::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::105::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::106::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::106::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::106::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::106::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::106::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::106::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::106::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::106::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::107::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::107::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::107::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::107::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::107::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::107::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::107::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::107::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::10::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::10::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::10::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::10::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::10::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::10::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::10::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::10::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::11::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::11::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::11::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::11::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::11::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::11::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::11::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::11::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::12::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::12::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::12::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::12::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::12::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::12::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::12::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::12::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::13::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::13::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::13::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::13::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::13::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::13::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::13::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::13::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::14::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::14::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::14::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::14::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::14::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::14::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::14::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::14::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::15::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::15::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::15::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::15::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::15::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::15::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::15::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::15::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::16::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::16::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::16::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::16::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::16::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::16::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::16::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::16::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::17::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::17::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::17::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::17::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::17::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::17::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::17::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::17::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::18::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::18::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::18::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::18::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::18::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::18::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::18::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::18::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::19::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::19::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::19::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::19::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::19::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::19::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::19::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::19::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::1::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::1::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::1::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::1::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::1::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::1::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::1::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::1::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::20::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::20::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::20::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::20::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::20::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::20::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::20::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::20::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::21::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::21::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::21::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::21::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::21::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::21::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::21::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::21::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::22::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::22::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::22::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::22::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::22::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::22::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::22::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::22::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::23::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::23::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::23::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::23::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::23::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::23::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::23::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::23::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::24::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::24::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::24::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::24::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::24::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::24::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::24::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::24::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::25::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::25::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::25::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::25::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::25::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::25::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::25::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::25::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::26::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::26::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::26::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::26::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::26::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::26::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::26::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::26::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::27::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::27::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::27::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::27::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::27::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::27::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::27::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::27::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::28::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::28::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::28::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::28::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::28::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::28::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::28::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::28::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::29::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::29::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::29::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::29::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::29::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::29::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::29::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::29::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::2::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::2::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::2::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::2::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::2::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::2::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::2::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::2::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::30::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::30::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::30::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::30::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::30::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::30::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::30::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::30::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::31::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::31::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::31::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::31::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::31::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::31::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::31::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::31::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::32::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::32::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::32::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::32::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::32::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::32::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::32::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::32::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::33::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::33::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::33::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::33::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::33::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::33::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::33::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::33::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::34::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::34::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::34::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::34::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::34::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::34::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::34::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::34::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::35::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::35::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::35::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::35::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::35::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::35::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::35::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::35::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::36::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::36::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::36::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::36::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::36::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::36::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::36::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::36::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::37::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::37::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::37::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::37::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::37::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::37::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::37::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::37::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::38::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::38::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::38::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::38::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::38::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::38::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::38::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::38::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::3::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::3::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::3::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::3::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::3::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::3::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::3::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::3::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::40::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::40::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::40::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::40::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::40::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::40::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::40::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::40::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::41::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::41::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::41::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::41::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::41::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::41::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::41::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::41::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::42::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::42::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::42::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::42::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::42::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::42::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::42::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::42::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::43::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::43::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::43::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::43::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::43::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::43::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::43::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::43::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::44::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::44::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::44::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::44::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::44::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::44::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::44::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::44::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::45::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::45::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::45::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::45::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::45::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::45::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::45::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::45::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::46::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::46::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::46::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::46::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::46::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::46::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::46::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::46::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::47::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::47::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::47::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::47::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::47::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::47::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::47::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::47::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::48::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::48::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::48::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::48::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::48::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::48::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::48::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::48::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::49::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::49::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::49::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::49::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::49::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::49::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::49::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::49::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::4::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::4::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::4::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::4::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::4::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::4::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::4::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::4::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::50::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::50::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::50::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::50::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::50::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::50::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::50::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::50::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::51::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::51::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::51::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::51::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::51::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::51::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::51::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::51::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::52::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::52::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::52::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::52::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::52::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::52::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::52::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::52::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::53::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::53::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::53::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::53::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::53::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::53::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::53::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::53::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::54::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::54::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::54::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::54::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::54::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::54::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::54::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::54::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::55::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::55::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::55::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::55::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::55::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::55::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::55::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::55::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::56::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::56::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::56::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::56::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::56::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::56::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::56::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::56::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::57::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::57::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::57::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::57::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::57::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::57::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::57::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::57::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::58::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::58::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::58::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::58::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::58::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::58::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::58::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::58::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::59::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::59::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::59::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::59::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::59::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::59::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::59::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::59::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::5::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::5::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::5::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::5::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::5::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::5::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::5::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::5::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::60::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::60::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::60::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::60::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::60::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::60::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::60::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::60::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::61::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::61::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::61::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::61::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::61::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::61::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::61::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::61::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::62::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::62::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::62::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::62::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::62::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::62::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::62::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::62::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::63::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::63::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::63::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::63::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::63::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::63::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::63::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::63::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::64::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::64::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::64::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::64::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::64::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::64::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::64::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::64::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::65::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::65::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::65::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::65::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::65::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::65::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::65::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::65::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::66::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::66::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::66::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::66::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::66::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::66::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::66::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::66::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::67::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::67::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::67::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::67::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::67::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::67::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::67::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::67::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::68::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::68::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::68::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::68::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::68::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::68::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::68::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::68::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::69::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::69::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::69::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::69::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::69::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::69::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::69::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::69::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::6::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::6::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::6::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::6::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::6::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::6::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::6::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::6::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::70::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::70::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::70::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::70::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::70::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::70::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::70::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::70::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::71::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::71::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::71::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::71::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::71::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::71::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::71::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::71::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::72::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::72::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::72::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::72::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::72::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::72::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::72::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::72::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::73::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::73::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::73::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::73::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::73::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::73::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::73::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::73::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::74::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::74::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::74::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::74::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::74::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::74::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::74::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::74::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::75::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::75::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::75::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::75::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::75::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::75::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::75::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::75::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::76::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::76::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::76::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::76::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::76::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::76::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::76::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::76::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::77::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::77::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::77::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::77::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::77::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::77::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::77::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::77::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::78::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::78::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::78::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::78::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::78::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::78::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::78::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::78::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::79::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::79::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::79::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::79::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::79::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::79::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::79::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::79::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::80::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::80::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::80::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::80::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::80::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::80::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::80::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::80::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::81::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::81::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::81::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::81::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::81::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::81::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::81::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::81::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::82::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::82::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::82::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::82::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::82::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::82::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::82::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::82::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::83::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::83::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::83::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::83::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::83::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::83::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::83::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::83::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::84::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::84::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::84::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::84::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::84::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::84::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::84::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::84::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::85::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::85::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::85::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::85::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::85::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::85::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::85::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::85::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::86::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::86::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::86::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::86::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::86::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::86::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::86::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::86::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::87::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::87::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::87::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::87::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::87::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::87::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::87::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::87::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::88::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::88::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::88::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::88::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::88::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::88::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::88::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::88::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::89::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::89::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::89::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::89::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::89::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::89::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::89::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::89::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::8::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::8::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::8::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::8::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::8::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::8::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::8::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::8::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::90::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::90::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::90::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::90::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::90::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::90::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::90::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::90::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::91::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::91::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::91::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::91::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::91::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::91::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::91::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::91::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::92::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::92::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::92::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::92::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::92::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::92::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::92::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::92::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::93::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::93::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::93::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::93::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::93::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::93::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::93::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::93::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::94::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::94::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::94::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::94::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::94::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::94::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::94::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::94::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::95::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::95::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::95::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::95::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::95::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::95::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::95::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::95::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::96::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::96::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::96::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::96::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::96::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::96::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::96::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::96::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::97::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::97::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::97::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::97::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::97::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::97::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::97::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::97::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::98::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::98::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::98::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::98::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::98::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::98::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::98::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::98::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::99::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::99::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::99::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::99::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::99::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::99::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::99::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::99::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::9::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::9::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::9::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::9::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::9::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::9::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::9::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/template.dat::9::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::2::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::2::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::2::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::2::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::2::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::2::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::2::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::2::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::4::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::4::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::4::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::4::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::4::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::4::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::4::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::4::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::5::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::5::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::5::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::5::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::5::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::5::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::5::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::5::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::6::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::6::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::6::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::6::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::6::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::6::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::6::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests11.dat::6::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::14::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::14::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::14::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::14::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::14::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::14::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::14::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::14::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::17::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::17::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::17::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::17::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::17::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::17::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::17::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::17::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::7::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::7::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::7::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::7::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::7::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::7::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::7::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests19.dat::7::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::6::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::6::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::6::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::6::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::6::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::6::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::6::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::6::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::7::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::7::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::7::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::7::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::7::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::7::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::7::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests2.dat::7::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests25.dat::7::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests25.dat::7::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests25.dat::7::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests25.dat::7::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests25.dat::7::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests25.dat::7::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/tests25.dat::7::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/tests25.dat::7::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::14::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::14::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::14::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::14::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::14::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::14::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::14::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::14::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::15::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::15::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::15::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::15::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::15::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::15::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::15::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::15::lxml::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::16::DOM::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::16::DOM::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::16::ElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::16::ElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::16::cElementTree::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::16::cElementTree::parser::void-namespace': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::16::lxml::parser::namespaced': FAIL
+u'html5lib/tests/testdata/tree-construction/webkit02.dat::16::lxml::parser::void-namespace': FAIL
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/.travis.yml b/testing/web-platform/tests/tools/third_party/html5lib/.travis.yml
new file mode 100644
index 0000000000..5727e0947e
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/.travis.yml
@@ -0,0 +1,32 @@
+language: python
+python:
+ - "pypy"
+ - "3.6"
+ - "3.5"
+ - "3.4"
+ - "3.3"
+ - "2.7"
+
+sudo: false
+
+cache: pip
+
+env:
+ global:
+ - PYTEST_COMMAND="coverage run -m pytest"
+ matrix:
+ - TOXENV=optional
+ - TOXENV=base
+ - TOXENV=six19-optional
+
+install:
+ - pip install tox codecov
+
+script:
+ - tox
+
+after_script:
+ - python debug-info.py
+
+after_success:
+ - codecov
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/AUTHORS.rst b/testing/web-platform/tests/tools/third_party/html5lib/AUTHORS.rst
new file mode 100644
index 0000000000..904013908d
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/AUTHORS.rst
@@ -0,0 +1,66 @@
+Credits
+=======
+
+``html5lib`` is written and maintained by:
+
+- James Graham
+- Sam Sneddon
+- Åukasz Langa
+- Will Kahn-Greene
+
+
+Patches and suggestions
+-----------------------
+(In chronological order, by first commit:)
+
+- Anne van Kesteren
+- Lachlan Hunt
+- lantis63
+- Sam Ruby
+- Thomas Broyer
+- Tim Fletcher
+- Mark Pilgrim
+- Ryan King
+- Philip Taylor
+- Edward Z. Yang
+- fantasai
+- Philip Jägenstedt
+- Ms2ger
+- Mohammad Taha Jahangir
+- Andy Wingo
+- Andreas Madsack
+- Karim Valiev
+- Juan Carlos Garcia Segovia
+- Mike West
+- Marc DM
+- Simon Sapin
+- Michael[tm] Smith
+- Ritwik Gupta
+- Marc Abramowitz
+- Tony Lopes
+- lilbludevil
+- Kevin
+- Drew Hubl
+- Austin Kumbera
+- Jim Baker
+- Jon Dufresne
+- Donald Stufft
+- Alex Gaynor
+- Nik Nyby
+- Jakub Wilk
+- Sigmund Cherem
+- Gabi Davar
+- Florian Mounier
+- neumond
+- Vitalik Verhovodov
+- Kovid Goyal
+- Adam Chainz
+- John Vandenberg
+- Eric Amorde
+- Benedikt Morbach
+- Jonathan Vanasco
+- Tom Most
+- Ville Skyttä
+- Hugo van Kemenade
+- Mark Vasilkov
+
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/CHANGES.rst b/testing/web-platform/tests/tools/third_party/html5lib/CHANGES.rst
new file mode 100644
index 0000000000..fcb22475cd
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/CHANGES.rst
@@ -0,0 +1,359 @@
+Change Log
+----------
+
+1.1
+~~~
+
+UNRELEASED
+
+Breaking changes:
+
+* Drop support for Python 3.3. (#358)
+* Drop support for Python 3.4. (#421)
+
+Deprecations:
+
+* Deprecate the ``html5lib`` sanitizer (``html5lib.serialize(sanitize=True)`` and
+ ``html5lib.filters.sanitizer``). We recommend users migrate to `Bleach
+ <https://github.com/mozilla/bleach>`. Please let us know if Bleach doesn't suffice for your
+ use. (#443)
+
+Other changes:
+
+* Try to import from ``collections.abc`` to remove DeprecationWarning and ensure
+ ``html5lib`` keeps working in future Python versions. (#403)
+* Drop optional ``datrie`` dependency. (#442)
+
+
+1.0.1
+~~~~~
+
+Released on December 7, 2017
+
+Breaking changes:
+
+* Drop support for Python 2.6. (#330) (Thank you, Hugo, Will Kahn-Greene!)
+* Remove ``utils/spider.py`` (#353) (Thank you, Jon Dufresne!)
+
+Features:
+
+* Improve documentation. (#300, #307) (Thank you, Jon Dufresne, Tom Most,
+ Will Kahn-Greene!)
+* Add iframe seamless boolean attribute. (Thank you, Ritwik Gupta!)
+* Add itemscope as a boolean attribute. (#194) (Thank you, Jonathan Vanasco!)
+* Support Python 3.6. (#333) (Thank you, Jon Dufresne!)
+* Add CI support for Windows using AppVeyor. (Thank you, John Vandenberg!)
+* Improve testing and CI and add code coverage (#323, #334), (Thank you, Jon
+ Dufresne, John Vandenberg, Sam Sneddon, Will Kahn-Greene!)
+* Semver-compliant version number.
+
+Bug fixes:
+
+* Add support for setuptools < 18.5 to support environment markers. (Thank you,
+ John Vandenberg!)
+* Add explicit dependency for six >= 1.9. (Thank you, Eric Amorde!)
+* Fix regexes to work with Python 3.7 regex adjustments. (#318, #379) (Thank
+ you, Benedikt Morbach, Ville Skyttä, Mark Vasilkov!)
+* Fix alphabeticalattributes filter namespace bug. (#324) (Thank you, Will
+ Kahn-Greene!)
+* Include license file in generated wheel package. (#350) (Thank you, Jon
+ Dufresne!)
+* Fix annotation-xml typo. (#339) (Thank you, Will Kahn-Greene!)
+* Allow uppercase hex chararcters in CSS colour check. (#377) (Thank you,
+ Komal Dembla, Hugo!)
+
+
+1.0
+~~~
+
+Released and unreleased on December 7, 2017. Badly packaged release.
+
+
+0.999999999/1.0b10
+~~~~~~~~~~~~~~~~~~
+
+Released on July 15, 2016
+
+* Fix attribute order going to the tree builder to be document order
+ instead of reverse document order(!).
+
+
+0.99999999/1.0b9
+~~~~~~~~~~~~~~~~
+
+Released on July 14, 2016
+
+* **Added ordereddict as a mandatory dependency on Python 2.6.**
+
+* Added ``lxml``, ``genshi``, ``datrie``, ``charade``, and ``all``
+ extras that will do the right thing based on the specific
+ interpreter implementation.
+
+* Now requires the ``mock`` package for the testsuite.
+
+* Cease supporting DATrie under PyPy.
+
+* **Remove PullDOM support, as this hasn't ever been properly
+ tested, doesn't entirely work, and as far as I can tell is
+ completely unused by anyone.**
+
+* Move testsuite to ``py.test``.
+
+* **Fix #124: move to webencodings for decoding the input byte stream;
+ this makes html5lib compliant with the Encoding Standard, and
+ introduces a required dependency on webencodings.**
+
+* **Cease supporting Python 3.2 (in both CPython and PyPy forms).**
+
+* **Fix comments containing double-dash with lxml 3.5 and above.**
+
+* **Use scripting disabled by default (as we don't implement
+ scripting).**
+
+* **Fix #11, avoiding the XSS bug potentially caused by serializer
+ allowing attribute values to be escaped out of in old browser versions,
+ changing the quote_attr_values option on serializer to take one of
+ three values, "always" (the old True value), "legacy" (the new option,
+ and the new default), and "spec" (the old False value, and the old
+ default).**
+
+* **Fix #72 by rewriting the sanitizer to apply only to treewalkers
+ (instead of the tokenizer); as such, this will require amending all
+ callers of it to use it via the treewalker API.**
+
+* **Drop support of charade, now that chardet is supported once more.**
+
+* **Replace the charset keyword argument on parse and related methods
+ with a set of keyword arguments: override_encoding, transport_encoding,
+ same_origin_parent_encoding, likely_encoding, and default_encoding.**
+
+* **Move filters._base, treebuilder._base, and treewalkers._base to .base
+ to clarify their status as public.**
+
+* **Get rid of the sanitizer package. Merge sanitizer.sanitize into the
+ sanitizer.htmlsanitizer module and move that to sanitizer. This means
+ anyone who used sanitizer.sanitize or sanitizer.HTMLSanitizer needs no
+ code changes.**
+
+* **Rename treewalkers.lxmletree to .etree_lxml and
+ treewalkers.genshistream to .genshi to have a consistent API.**
+
+* Move a whole load of stuff (inputstream, ihatexml, trie, tokenizer,
+ utils) to be underscore prefixed to clarify their status as private.
+
+
+0.9999999/1.0b8
+~~~~~~~~~~~~~~~
+
+Released on September 10, 2015
+
+* Fix #195: fix the sanitizer to drop broken URLs (it threw an
+ exception between 0.9999 and 0.999999).
+
+
+0.999999/1.0b7
+~~~~~~~~~~~~~~
+
+Released on July 7, 2015
+
+* Fix #189: fix the sanitizer to allow relative URLs again (as it did
+ prior to 0.9999/1.0b5).
+
+
+0.99999/1.0b6
+~~~~~~~~~~~~~
+
+Released on April 30, 2015
+
+* Fix #188: fix the sanitizer to not throw an exception when sanitizing
+ bogus data URLs.
+
+
+0.9999/1.0b5
+~~~~~~~~~~~~
+
+Released on April 29, 2015
+
+* Fix #153: Sanitizer fails to treat some attributes as URLs. Despite how
+ this sounds, this has no known security implications. No known version
+ of IE (5.5 to current), Firefox (3 to current), Safari (6 to current),
+ Chrome (1 to current), or Opera (12 to current) will run any script
+ provided in these attributes.
+
+* Pass error message to the ParseError exception in strict parsing mode.
+
+* Allow data URIs in the sanitizer, with a whitelist of content-types.
+
+* Add support for Python implementations that don't support lone
+ surrogates (read: Jython). Fixes #2.
+
+* Remove localization of error messages. This functionality was totally
+ unused (and untested that everything was localizable), so we may as
+ well follow numerous browsers in not supporting translating technical
+ strings.
+
+* Expose treewalkers.pprint as a public API.
+
+* Add a documentEncoding property to HTML5Parser, fix #121.
+
+
+0.999
+~~~~~
+
+Released on December 23, 2013
+
+* Fix #127: add work-around for CPython issue #20007: .read(0) on
+ http.client.HTTPResponse drops the rest of the content.
+
+* Fix #115: lxml treewalker can now deal with fragments containing, at
+ their root level, text nodes with non-ASCII characters on Python 2.
+
+
+0.99
+~~~~
+
+Released on September 10, 2013
+
+* No library changes from 1.0b3; released as 0.99 as pip has changed
+ behaviour from 1.4 to avoid installing pre-release versions per
+ PEP 440.
+
+
+1.0b3
+~~~~~
+
+Released on July 24, 2013
+
+* Removed ``RecursiveTreeWalker`` from ``treewalkers._base``. Any
+ implementation using it should be moved to
+ ``NonRecursiveTreeWalker``, as everything bundled with html5lib has
+ for years.
+
+* Fix #67 so that ``BufferedStream`` to correctly returns a bytes
+ object, thereby fixing any case where html5lib is passed a
+ non-seekable RawIOBase-like object.
+
+
+1.0b2
+~~~~~
+
+Released on June 27, 2013
+
+* Removed reordering of attributes within the serializer. There is now
+ an ``alphabetical_attributes`` option which preserves the previous
+ behaviour through a new filter. This allows attribute order to be
+ preserved through html5lib if the tree builder preserves order.
+
+* Removed ``dom2sax`` from DOM treebuilders. It has been replaced by
+ ``treeadapters.sax.to_sax`` which is generic and supports any
+ treewalker; it also resolves all known bugs with ``dom2sax``.
+
+* Fix treewalker assertions on hitting bytes strings on
+ Python 2. Previous to 1.0b1, treewalkers coped with mixed
+ bytes/unicode data on Python 2; this reintroduces this prior
+ behaviour on Python 2. Behaviour is unchanged on Python 3.
+
+
+1.0b1
+~~~~~
+
+Released on May 17, 2013
+
+* Implementation updated to implement the `HTML specification
+ <http://www.whatwg.org/specs/web-apps/current-work/>`_ as of 5th May
+ 2013 (`SVN <http://svn.whatwg.org/webapps/>`_ revision r7867).
+
+* Python 3.2+ supported in a single codebase using the ``six`` library.
+
+* Removed support for Python 2.5 and older.
+
+* Removed the deprecated Beautiful Soup 3 treebuilder.
+ ``beautifulsoup4`` can use ``html5lib`` as a parser instead. Note that
+ since it doesn't support namespaces, foreign content like SVG and
+ MathML is parsed incorrectly.
+
+* Removed ``simpletree`` from the package. The default tree builder is
+ now ``etree`` (using the ``xml.etree.cElementTree`` implementation if
+ available, and ``xml.etree.ElementTree`` otherwise).
+
+* Removed the ``XHTMLSerializer`` as it never actually guaranteed its
+ output was well-formed XML, and hence provided little of use.
+
+* Removed default DOM treebuilder, so ``html5lib.treebuilders.dom`` is no
+ longer supported. ``html5lib.treebuilders.getTreeBuilder("dom")`` will
+ return the default DOM treebuilder, which uses ``xml.dom.minidom``.
+
+* Optional heuristic character encoding detection now based on
+ ``charade`` for Python 2.6 - 3.3 compatibility.
+
+* Optional ``Genshi`` treewalker support fixed.
+
+* Many bugfixes, including:
+
+ * #33: null in attribute value breaks XML AttValue;
+
+ * #4: nested, indirect descendant, <button> causes infinite loop;
+
+ * `Google Code 215
+ <http://code.google.com/p/html5lib/issues/detail?id=215>`_: Properly
+ detect seekable streams;
+
+ * `Google Code 206
+ <http://code.google.com/p/html5lib/issues/detail?id=206>`_: add
+ support for <video preload=...>, <audio preload=...>;
+
+ * `Google Code 205
+ <http://code.google.com/p/html5lib/issues/detail?id=205>`_: add
+ support for <video poster=...>;
+
+ * `Google Code 202
+ <http://code.google.com/p/html5lib/issues/detail?id=202>`_: Unicode
+ file breaks InputStream.
+
+* Source code is now mostly PEP 8 compliant.
+
+* Test harness has been improved and now depends on ``nose``.
+
+* Documentation updated and moved to https://html5lib.readthedocs.io/.
+
+
+0.95
+~~~~
+
+Released on February 11, 2012
+
+
+0.90
+~~~~
+
+Released on January 17, 2010
+
+
+0.11.1
+~~~~~~
+
+Released on June 12, 2008
+
+
+0.11
+~~~~
+
+Released on June 10, 2008
+
+
+0.10
+~~~~
+
+Released on October 7, 2007
+
+
+0.9
+~~~
+
+Released on March 11, 2007
+
+
+0.2
+~~~
+
+Released on January 8, 2007
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/CONTRIBUTING.rst b/testing/web-platform/tests/tools/third_party/html5lib/CONTRIBUTING.rst
new file mode 100644
index 0000000000..8c5e198535
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/CONTRIBUTING.rst
@@ -0,0 +1,60 @@
+Contributing
+============
+
+Pull requests are more than welcome — both to the library and to the
+documentation. Some useful information:
+
+- We aim to follow PEP 8 in the library, but ignoring the
+ 79-character-per-line limit, instead following a soft limit of 99,
+ but allowing lines over this where it is the readable thing to do.
+
+- We aim to follow PEP 257 for all docstrings, and make them properly
+ parseable by Sphinx while generating API documentation.
+
+- We keep ``pyflakes`` reporting no errors or warnings at all times.
+
+- We keep the master branch passing all tests at all times on all
+ supported versions.
+
+`Travis CI <https://travis-ci.org/html5lib/html5lib-python/>`_ is run
+against all pull requests and should enforce all of the above.
+
+We use `Opera Critic <https://critic.hoppipolla.co.uk/>`_ as an external
+code-review tool, which uses your GitHub login to authenticate. You'll
+get email notifications for issues raised in the review.
+
+
+Patch submission guidelines
+---------------------------
+
+- **Create a new Git branch specific to your change.** Do not put
+ multiple fixes/features in the same pull request. If you find an
+ unrelated bug, create a distinct branch and submit a separate pull
+ request for the bugfix. This makes life much easier for maintainers
+ and will speed up merging your patches.
+
+- **Write a test** whenever possible. Following existing tests is often
+ easiest, and a good way to tell whether the feature you're modifying
+ is easily testable.
+
+- **Make sure documentation is updated.** Keep docstrings current, and
+ if necessary, update the Sphinx documentation in ``doc/``.
+
+- **Add a changelog entry** at the top of ``CHANGES.rst`` following
+ existing entries' styles.
+
+- **Run tests with tox** if possible, to make sure your changes are
+ compatible with all supported Python versions.
+
+- **Squash commits** before submitting the pull request so that a single
+ commit contains the entire change, and only that change (see the first
+ bullet).
+
+- **Don't rebase after creating the pull request.** Merge with upstream,
+ if necessary, and use ``git commit --fixup`` for fixing issues raised
+ in a Critic review or by a failing Travis build. The reviewer will
+ squash and rebase your pull request while accepting it. Even though
+ GitHub won't recognize the pull request as accepted, the squashed
+ commits will properly specify you as the author.
+
+- **Attribute yourself** in ``AUTHORS.rst``.
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/LICENSE b/testing/web-platform/tests/tools/third_party/html5lib/LICENSE
new file mode 100644
index 0000000000..c87fa7a000
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2006-2013 James Graham and other contributors
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/MANIFEST.in b/testing/web-platform/tests/tools/third_party/html5lib/MANIFEST.in
new file mode 100644
index 0000000000..4b3ffe3ed9
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/MANIFEST.in
@@ -0,0 +1,10 @@
+include LICENSE
+include AUTHORS.rst
+include CHANGES.rst
+include README.rst
+include requirements*.txt
+include .pytest.expect
+include tox.ini
+include pytest.ini
+graft html5lib/tests/testdata
+recursive-include html5lib/tests *.py
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/README.rst b/testing/web-platform/tests/tools/third_party/html5lib/README.rst
new file mode 100644
index 0000000000..d367905da0
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/README.rst
@@ -0,0 +1,151 @@
+html5lib
+========
+
+.. image:: https://travis-ci.org/html5lib/html5lib-python.svg?branch=master
+ :target: https://travis-ci.org/html5lib/html5lib-python
+
+
+html5lib is a pure-python library for parsing HTML. It is designed to
+conform to the WHATWG HTML specification, as is implemented by all major
+web browsers.
+
+
+Usage
+-----
+
+Simple usage follows this pattern:
+
+.. code-block:: python
+
+ import html5lib
+ with open("mydocument.html", "rb") as f:
+ document = html5lib.parse(f)
+
+or:
+
+.. code-block:: python
+
+ import html5lib
+ document = html5lib.parse("<p>Hello World!")
+
+By default, the ``document`` will be an ``xml.etree`` element instance.
+Whenever possible, html5lib chooses the accelerated ``ElementTree``
+implementation (i.e. ``xml.etree.cElementTree`` on Python 2.x).
+
+Two other tree types are supported: ``xml.dom.minidom`` and
+``lxml.etree``. To use an alternative format, specify the name of
+a treebuilder:
+
+.. code-block:: python
+
+ import html5lib
+ with open("mydocument.html", "rb") as f:
+ lxml_etree_document = html5lib.parse(f, treebuilder="lxml")
+
+When using with ``urllib2`` (Python 2), the charset from HTTP should be
+pass into html5lib as follows:
+
+.. code-block:: python
+
+ from contextlib import closing
+ from urllib2 import urlopen
+ import html5lib
+
+ with closing(urlopen("http://example.com/")) as f:
+ document = html5lib.parse(f, transport_encoding=f.info().getparam("charset"))
+
+When using with ``urllib.request`` (Python 3), the charset from HTTP
+should be pass into html5lib as follows:
+
+.. code-block:: python
+
+ from urllib.request import urlopen
+ import html5lib
+
+ with urlopen("http://example.com/") as f:
+ document = html5lib.parse(f, transport_encoding=f.info().get_content_charset())
+
+To have more control over the parser, create a parser object explicitly.
+For instance, to make the parser raise exceptions on parse errors, use:
+
+.. code-block:: python
+
+ import html5lib
+ with open("mydocument.html", "rb") as f:
+ parser = html5lib.HTMLParser(strict=True)
+ document = parser.parse(f)
+
+When you're instantiating parser objects explicitly, pass a treebuilder
+class as the ``tree`` keyword argument to use an alternative document
+format:
+
+.. code-block:: python
+
+ import html5lib
+ parser = html5lib.HTMLParser(tree=html5lib.getTreeBuilder("dom"))
+ minidom_document = parser.parse("<p>Hello World!")
+
+More documentation is available at https://html5lib.readthedocs.io/.
+
+
+Installation
+------------
+
+html5lib works on CPython 2.7+, CPython 3.5+ and PyPy. To install:
+
+.. code-block:: bash
+
+ $ pip install html5lib
+
+The goal is to support a (non-strict) superset of the versions that `pip
+supports
+<https://pip.pypa.io/en/stable/installing/#python-and-os-compatibility>`_.
+
+Optional Dependencies
+---------------------
+
+The following third-party libraries may be used for additional
+functionality:
+
+- ``lxml`` is supported as a tree format (for both building and
+ walking) under CPython (but *not* PyPy where it is known to cause
+ segfaults);
+
+- ``genshi`` has a treewalker (but not builder); and
+
+- ``chardet`` can be used as a fallback when character encoding cannot
+ be determined.
+
+
+Bugs
+----
+
+Please report any bugs on the `issue tracker
+<https://github.com/html5lib/html5lib-python/issues>`_.
+
+
+Tests
+-----
+
+Unit tests require the ``pytest`` and ``mock`` libraries and can be
+run using the ``py.test`` command in the root directory.
+
+Test data are contained in a separate `html5lib-tests
+<https://github.com/html5lib/html5lib-tests>`_ repository and included
+as a submodule, thus for git checkouts they must be initialized::
+
+ $ git submodule init
+ $ git submodule update
+
+If you have all compatible Python implementations available on your
+system, you can run tests on all of them using the ``tox`` utility,
+which can be found on PyPI.
+
+
+Questions?
+----------
+
+There's a mailing list available for support on Google Groups,
+`html5lib-discuss <http://groups.google.com/group/html5lib-discuss>`_,
+though you may get a quicker response asking on IRC in `#whatwg on
+irc.freenode.net <http://wiki.whatwg.org/wiki/IRC>`_.
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/bench_html.py b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/bench_html.py
new file mode 100644
index 0000000000..cfe53c6733
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/bench_html.py
@@ -0,0 +1,57 @@
+import io
+import os
+import sys
+
+import pyperf
+
+sys.path[0:0] = [os.path.join(os.path.dirname(__file__), "..")]
+import html5lib # noqa: E402
+
+
+def bench_parse(fh, treebuilder):
+ fh.seek(0)
+ html5lib.parse(fh, treebuilder=treebuilder, useChardet=False)
+
+
+def bench_serialize(loops, fh, treebuilder):
+ fh.seek(0)
+ doc = html5lib.parse(fh, treebuilder=treebuilder, useChardet=False)
+
+ range_it = range(loops)
+ t0 = pyperf.perf_counter()
+
+ for loops in range_it:
+ html5lib.serialize(doc, tree=treebuilder, encoding="ascii", inject_meta_charset=False)
+
+ return pyperf.perf_counter() - t0
+
+
+BENCHMARKS = ["parse", "serialize"]
+
+
+def add_cmdline_args(cmd, args):
+ if args.benchmark:
+ cmd.append(args.benchmark)
+
+
+if __name__ == "__main__":
+ runner = pyperf.Runner(add_cmdline_args=add_cmdline_args)
+ runner.metadata["description"] = "Run benchmarks based on Anolis"
+ runner.argparser.add_argument("benchmark", nargs="?", choices=BENCHMARKS)
+
+ args = runner.parse_args()
+ if args.benchmark:
+ benchmarks = (args.benchmark,)
+ else:
+ benchmarks = BENCHMARKS
+
+ with open(os.path.join(os.path.dirname(__file__), "data", "html.html"), "rb") as fh:
+ source = io.BytesIO(fh.read())
+
+ if "parse" in benchmarks:
+ for tb in ("etree", "dom", "lxml"):
+ runner.bench_func("html_parse_%s" % tb, bench_parse, source, tb)
+
+ if "serialize" in benchmarks:
+ for tb in ("etree", "dom", "lxml"):
+ runner.bench_time_func("html_serialize_%s" % tb, bench_serialize, source, tb)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/bench_wpt.py b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/bench_wpt.py
new file mode 100644
index 0000000000..d5da006984
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/bench_wpt.py
@@ -0,0 +1,45 @@
+import io
+import os
+import sys
+
+import pyperf
+
+sys.path[0:0] = [os.path.join(os.path.dirname(__file__), "..")]
+import html5lib # noqa: E402
+
+
+def bench_html5lib(fh):
+ fh.seek(0)
+ html5lib.parse(fh, treebuilder="etree", useChardet=False)
+
+
+def add_cmdline_args(cmd, args):
+ if args.benchmark:
+ cmd.append(args.benchmark)
+
+
+BENCHMARKS = {}
+for root, dirs, files in os.walk(os.path.join(os.path.dirname(os.path.abspath(__file__)), "data", "wpt")):
+ for f in files:
+ if f.endswith(".html"):
+ BENCHMARKS[f[: -len(".html")]] = os.path.join(root, f)
+
+
+if __name__ == "__main__":
+ runner = pyperf.Runner(add_cmdline_args=add_cmdline_args)
+ runner.metadata["description"] = "Run parser benchmarks from WPT"
+ runner.argparser.add_argument("benchmark", nargs="?", choices=sorted(BENCHMARKS))
+
+ args = runner.parse_args()
+ if args.benchmark:
+ benchmarks = (args.benchmark,)
+ else:
+ benchmarks = sorted(BENCHMARKS)
+
+ for bench in benchmarks:
+ name = "wpt_%s" % bench
+ path = BENCHMARKS[bench]
+ with open(path, "rb") as fh:
+ fh2 = io.BytesIO(fh.read())
+
+ runner.bench_func(name, bench_html5lib, fh2)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/README.md b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/README.md
new file mode 100644
index 0000000000..5b896cbb7c
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/README.md
@@ -0,0 +1,8 @@
+The files in this data are derived from:
+
+ * `html.html`: from [html](http://github.com/whatwg/html), revision
+ 77db356a293f2b152b648c836b6989d17afe42bb. This is the first 5000 lines of `source`. (This is
+ representative of the input to [Anolis](https://bitbucket.org/ms2ger/anolis/); first 5000 lines
+ chosen to make it parse in a reasonable time.)
+
+ * `wpt`: see `wpt/README.md`.
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/html.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/html.html
new file mode 100644
index 0000000000..d2bb1be745
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/html.html
@@ -0,0 +1,5000 @@
+<!-- EDITOR NOTES -*- mode: Text; fill-column: 100 -*-
+ !
+ ! Adding a new element involves editing the following sections:
+ ! - section for the element itself
+ ! - descriptions of the element's categories
+ ! - images/content-venn.svg
+ ! - syntax, if it's void or otherwise special
+ ! - parser, if it's not phrasing-level
+ ! - rendering
+ ! - obsolete section
+ ! - element, attribute, content model, and interface indexes
+ ! - adding it to the section with ARIA mappings
+ !
+ !-->
+
+<!--
+ ! http://lists.w3.org/Archives/Public/www-archive/2014Apr/0034.html
+ !-->
+
+<!--START complete--><!--START dev-html-->
+<!DOCTYPE html>
+<!--SET FINGERPRINT=<span title="fingerprinting vector" class="fingerprint"><img src="images/fingerprint.png" alt="(This is a fingerprinting vector.)" width=46 height=64></span>-->
+<html lang="en-GB-x-hixie" class="big">
+ <head>
+ <title>HTML Standard</title>
+ <script>
+ var loadTimer = new Date();
+ var current_revision = "r" + "$Revision: 1 $".substr(11);
+ current_revision = current_revision.substr(0, current_revision.length - 2);
+ var last_known_revision = current_revision;
+ function F( /* varargs... */) {
+ var fragment = document.createDocumentFragment();
+ for (var index = 0; index < arguments.length; index += 1) {
+ if (arguments[index] instanceof Array) {
+ fragment.appendChild(F.apply(this, arguments[index]));
+ } else if (typeof arguments[index] == 'string') {
+ fragment.appendChild(document.createTextNode(arguments[index]));
+ } else {
+ fragment.appendChild(arguments[index]);
+ }
+ }
+ return fragment;
+ }
+ function E(name, /* optional */ attributes /*, varargs... */) {
+ var element = document.createElement(name);
+ var index = 1;
+ if ((arguments.length > 1) && (typeof attributes != 'string') &&
+ (!(attributes instanceof Node)) && (!(attributes instanceof Array))) {
+ for (var attName in attributes) {
+ if (typeof attributes[attName] == 'boolean') {
+ if (attributes[attName])
+ element.setAttribute(attName, '');
+ } else if (typeof attributes[attName] == 'function') {
+ element[attName] = attributes[attName];
+ } else {
+ element.setAttribute(attName, attributes[attName]);
+ }
+ }
+ index = 2;
+ }
+ for (; index < arguments.length; index += 1) {
+ if (arguments[index] instanceof Array) {
+ element.appendChild(F.apply(this, arguments[index]));
+ } else if (typeof arguments[index] == 'string') {
+ element.appendChild(document.createTextNode(arguments[index]));
+ } else {
+ element.appendChild(arguments[index]);
+ }
+ }
+ return element;
+ }
+ function getCookie(name) {
+ var params = location.search.substr(1).split("&");
+ for (var index = 0; index < params.length; index++) {
+ if (params[index] == name)
+ return "1";
+ var data = params[index].split("=");
+ if (data[0] == name)
+ return unescape(data[1]);
+ }
+ var cookies = document.cookie.split("; ");
+ for (var index = 0; index < cookies.length; index++) {
+ var data = cookies[index].split("=");
+ if (data[0] == name)
+ return unescape(data[1]);
+ }
+ return null;
+ }
+ var currentAlert;
+ var currentAlertTimeout;
+ function showAlert(s, href) {
+ if (!currentAlert) {
+ currentAlert = document.createElement('div');
+ currentAlert.id = 'alert';
+ var x = document.createElement('button');
+ x.textContent = '\u2573';
+ x.onclick = closeAlert2;
+ currentAlert.appendChild(x);
+ currentAlert.appendChild(document.createElement('span'));
+ currentAlert.onmousemove = function () {
+ clearTimeout(currentAlertTimeout);
+ currentAlert.className = '';
+ currentAlertTimeout = setTimeout(closeAlert, 10000);
+ }
+ document.body.appendChild(currentAlert);
+ } else {
+ clearTimeout(currentAlertTimeout);
+ currentAlert.className = '';
+ }
+ currentAlert.lastChild.textContent = '';
+ currentAlert.lastChild.appendChild(F(s));
+ if (href) {
+ var link = document.createElement('a');
+ link.href = href;
+ link.textContent = href;
+ currentAlert.lastChild.appendChild(F(' ', link));
+ }
+ currentAlertTimeout = setTimeout(closeAlert, 10000);
+ }
+ function closeAlert() {
+ clearTimeout(currentAlertTimeout);
+ if (currentAlert) {
+ currentAlert.className = 'closed';
+ currentAlertTimeout = setTimeout(closeAlert2, 3000);
+ }
+ }
+ function closeAlert2() {
+ clearTimeout(currentAlertTimeout);
+ if (currentAlert) {
+ currentAlert.parentNode.removeChild(currentAlert);
+ currentAlert = null;
+ }
+ }
+ window.addEventListener('keydown', function (event) {
+ if (event.keyCode == 27) {
+ if (currentAlert)
+ closeAlert2();
+ } else {
+ closeAlert();
+ }
+ }, false);
+ window.addEventListener('scroll', function (event) {
+ closeAlert();
+ }, false);
+ function load(script) {
+ var e = document.createElement('script');
+ e.setAttribute('src', '//www.whatwg.org/specs/web-apps/current-work/' + script);
+ document.body.appendChild(e);
+ }
+
+ var startedInit = 0;
+ function init() {
+ startedInit = 1;
+ if (location.search == '?slow-browser')
+ return;
+ load('reviewer.js');
+ if (document.documentElement.className == "big" || document.documentElement.className == "big split index")
+ load('toc.js');
+ load('updater.js');
+ load('dfn.js');
+ load('status.js');
+ if (getCookie('profile') == '1')
+ document.getElementsByTagName('h2')[0].textContent += '; load: ' + (new Date() - loadTimer) + 'ms';
+ }
+ if (document.documentElement.className == "")
+ setTimeout(function () {
+ if (!startedInit)
+ showAlert("Too slow? Try reading the multipage copy of the spec instead:", "http://whatwg.org/html");
+ }, 6000);
+
+ window.addEventListener('keypress', function (event) {
+ if ((event.which == 114) && (event.metaKey)) {
+ if (!confirm('Are you sure you want to reload this page?'))
+ event.preventDefault();
+ }
+ }, false);
+
+ </script>
+ <link rel="stylesheet" href="//www.whatwg.org/style/specification">
+ <link rel="icon" href="//www.whatwg.org/images/icon">
+ <style>
+ .proposal { border: blue solid; padding: 1em; }
+ .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
+ #updatesStatus { display: none; z-index: 10; }
+ #updatesStatus.relevant { display: block; position: fixed; right: 1em; top: 1em; padding: 0.5em; font: bold small sans-serif; min-width: 25em; width: 30%; max-width: 40em; height: auto; border: ridge 4px gray; background: #EEEEEE; color: black; }
+ div.head .logo { width: 11em; margin-bottom: 20em; }
+
+ #configUI { position: absolute; z-index: 20; top: auto; right: 0; width: 11em; padding: 0 0.5em 0 0.5em; font-size: small; background: gray; background: rgba(32,32,32,0.9); color: white; border-radius: 1em 0 0 1em; -moz-border-radius: 1em 0 0 1em; }
+ #configUI p { margin: 0.75em 0; padding: 0.3em; }
+ #configUI p label { display: block; }
+ #configUI #updateUI, #configUI .loginUI { text-align: center; }
+ #configUI input[type=button] { display: block; margin: auto; }
+ #configUI :link, #configUI :visited { color: white; }
+ #configUI :link:hover, #configUI :visited:hover { background: transparent; }
+
+ #alert { position: fixed; top: 20%; left: 20%; right: 20%; font-size: 2em; padding: 0.5em; z-index: 40; background: gray; background: rgba(32,32,32,0.9); color: white; border-radius: 1em; -moz-border-radius: 1em; -webkit-transition: opacity 1s linear; }
+ #alert.closed { opacity: 0; }
+ #alert button { position: absolute; top: -1em; right: 2em; border-radius: 1em 1em 0 0; border: none; line-height: 0.9; color: white; background: rgb(64,64,64); font-size: 0.6em; font-weight: 900; cursor: pointer; }
+ #alert :link, #alert :visited { color: white; }
+ #alert :link:hover, #alert :visited:hover { background: transparent; }
+ @media print { #configUI { display: none; } }
+
+ .rfc2119 { font-variant: small-caps; text-shadow: 0 0 0.5em yellow; position: static; }
+ .rfc2119::after { position: absolute; left: 0; width: 25px; text-align: center; color: yellow; text-shadow: 0.075em 0.075em 0.2em black; }
+ .rfc2119.m\ust::after { content: '\2605'; }
+ .rfc2119.s\hould::after { content: '\2606'; }
+ [hidden] { display: none; }
+
+ .fingerprint { float: right; }
+
+ .applies thead th > * { display: block; }
+ .applies thead code { display: block; }
+ .applies td { text-align: center; }
+ .applies .yes { background: yellow; }
+
+ .matrix, .matrix td { border: hidden; text-align: right; }
+ .matrix { margin-left: 2em; }
+
+ .vertical-summary-table tr > th[rowspan="2"]:first-child + th,
+ .vertical-summary-table tr > td[rowspan="2"]:first-child + td { border-bottom: hidden; }
+
+ .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
+ .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
+ .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
+
+ td.eg { border-width: thin; text-align: center; }
+
+ #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
+ #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
+ #table-example-1 caption { padding-bottom: 0.5em; }
+ #table-example-1 thead, #table-example-1 tbody { border: none; }
+ #table-example-1 th, #table-example-1 td { border: solid thin; }
+ #table-example-1 th { font-weight: normal; }
+ #table-example-1 td { border-style: none solid; vertical-align: top; }
+ #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
+ #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
+ #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
+ #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
+ #table-example-1 tbody td:first-child::after { content: leader(". "); }
+ #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
+ #table-example-1 tbody td:first-child + td { width: 10em; }
+ #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
+ #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
+
+ .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
+ .apple-table-examples * { font-family: "Times", serif; }
+ .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
+ .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
+ .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
+ .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
+ .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
+ .apple-table-examples td { text-align: right; vertical-align: top; }
+ .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
+ .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
+ .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
+ .apple-table-examples sup { line-height: 0; }
+
+ .three-column-nowrap tr > td:first-child,
+ .three-column-nowrap tr > td:first-child + td,
+ .three-column-nowrap tr > td:first-child + td + td { white-space: nowrap; }
+
+ .details-example img { vertical-align: top; }
+
+ #base64-table {
+ white-space: nowrap;
+ font-size: 0.6em;
+ column-width: 6em;
+ column-count: 5;
+ column-gap: 1em;
+ -moz-column-width: 6em;
+ -moz-column-count: 5;
+ -moz-column-gap: 1em;
+ -webkit-column-width: 6em;
+ -webkit-column-count: 5;
+ -webkit-column-gap: 1em;
+ }
+ #base64-table thead { display: none; }
+ #base64-table * { border: none; }
+ #base64-table tbody td:first-child:after { content: ':'; }
+ #base64-table tbody td:last-child { text-align: right; }
+
+ #named-character-references-table {
+ white-space: nowrap;
+ font-size: 0.6em;
+ column-width: 30em;
+ column-gap: 1em;
+ -moz-column-width: 30em;
+ -moz-column-gap: 1em;
+ -webkit-column-width: 30em;
+ -webkit-column-gap: 1em;
+ }
+ #named-character-references-table > table > tbody > tr > td:first-child + td,
+ #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
+ #named-character-references-table > table > tbody > tr > td:last-child:hover > span { position: absolute; top: auto; left: auto; margin-left: 0.5em; line-height: 1.2; font-size: 5em; border: outset; padding: 0.25em 0.5em; background: white; width: 1.25em; height: auto; text-align: center; }
+ #named-character-references-table > table > tbody > tr#entity-CounterClockwiseContourIntegral > td:first-child { font-size: 0.5em; }
+
+ .glyph.control { color: red; }
+
+ @font-face {
+ font-family: 'Essays1743';
+ src: url('//www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743.ttf');
+ }
+ @font-face {
+ font-family: 'Essays1743';
+ font-weight: bold;
+ src: url('//www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Bold.ttf');
+ }
+ @font-face {
+ font-family: 'Essays1743';
+ font-style: italic;
+ src: url('//www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Italic.ttf');
+ }
+ @font-face {
+ font-family: 'Essays1743';
+ font-style: italic;
+ font-weight: bold;
+ src: url('//www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-BoldItalic.ttf');
+ }
+ </style>
+ <link rel="stylesheet" href="status.css">
+ </head>
+ <body onload="init()">
+ <header class="head with-buttons" id="head">
+ <p><a href="//www.whatwg.org/" class="logo"><img width="101" height="101" alt="WHATWG" src="/images/logo"></a></p>
+ <hgroup>
+ <h1 class="allcaps">HTML</h1>
+ <h2 class="no-num no-toc">Living Standard &mdash; Last Updated <span class="pubdate">[DATE: 01 Jan 1901]</span></h2>
+ </hgroup>
+ <div>
+ <div>
+ <a href="//whatwg.org/html"><span><strong>Multipage Version</strong> <code>whatwg.org/html</code></span></a>
+ <a href="//whatwg.org/c"><span><strong>One-Page Version</strong> <code>whatwg.org/c</code></span></a>
+ <a href="//whatwg.org/pdf"><span><strong>PDF Version</strong> <code>whatwg.org/pdf</code></span></a>
+ <a href="http://developers.whatwg.org/"><span><strong>Developer Version</strong> <code>developers.whatwg.org</code></span></a>
+ </div>
+ <div>
+ <a class="misc" href="//whatwg.org/faq"><span><strong>FAQ</strong> <code>whatwg.org/faq</code></span></a>
+ <a class="misc" href="http://validator.whatwg.org/"><span><strong>Validators</strong> <code>validator.whatwg.org</code></span></a>
+ </div>
+ <div>
+ <a class="comms" href="//www.whatwg.org/mailing-list"><span><strong>Join our Mailing List</strong> <code>whatwg@whatwg.org</code></span></a>
+ <a class="comms" href="http://wiki.whatwg.org/wiki/IRC"><span><strong>Join us on IRC</strong> <code>#whatwg on Freenode</code></span></a>
+ <a class="comms" href="http://forums.whatwg.org/"><span><strong>Join our Forums</strong> <code>forums.whatwg.org</code></span></a>
+ </div>
+ <div>
+ <!--<a class="changes" href="http://svn.whatwg.org/webapps"><span><strong>SVN Repository</strong> <code>svn.whatwg.org/webapps</code></span></a>-->
+ <a class="changes" href="http://html5.org/tools/web-apps-tracker"><span><strong>Change Log</strong> <code>html5.org's tracker</code></span></a>
+ <a class="changes" href="http://twitter.com/WHATWG"><span><strong>Twitter Updates</strong> <code>@WHATWG</code></span></a>
+ </div>
+ <div>
+ <a class="feedback" href="https://www.w3.org/Bugs/Public/buglist.cgi?bug_status=UNCONFIRMED&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED&amp;component=HTML&amp;product=WHATWG"><span><strong>View Open Bugs</strong> <code>filed in Bugzilla</code></span></a>
+ <a class="feedback" href="//www.whatwg.org/newbug"><span><strong>File a Bug</strong> <code>whatwg.org/newbug</code></span></a>
+ <a class="feedback" href="http://ian.hixie.ch/+"><span><strong>E-mail the Editor</strong> <code>ian@hixie.ch</code></span></a>
+ </div>
+ </div>
+ </header>
+
+ <hr>
+
+ <div id="configUI"></div>
+
+ <h2 class="no-num no-toc" id="contents">Table of contents</h2>
+ <!--toc-->
+
+ <hr>
+
+<!--
+ <pre class="idl">
+ interface Screen { }; // CSSOM
+ interface URL { }; // URL API
+ interface Blob { }; // File API
+ interface File : Blob { }; // File API
+ interface FileList { }; // File API
+ interface WebGLRenderingContext { }; // WebGL
+ interface XMLDocument { }; // DOM
+ interface HTMLCollection { }; // DOM
+ interface DOMTokenList { }; // DOM
+ interface DOMSettableTokenList { attribute any value; }; // DOM
+ interface SVGMatrix { }; // SVG
+ // fake interfaces that map to JS object types:
+ interface ArrayBuffer { };
+ interface Int8Array { };
+ interface Uint8Array { };
+ interface Uint8ClampedArray { };
+ interface Int16Array { };
+ interface Uint16Array { };
+ interface Int32Array { };
+ interface Uint32Array { };
+ interface Float32Array { };
+ interface Float64Array { };
+ interface Uint8ClampedArray { };
+ </pre>
+-->
+
+ <h2 id="introduction">Introduction</h2>
+
+ <div class="nodev">
+
+ <h3 id="abstract">Where does this specification fit?</h3>
+
+ <p>This specification defines a big part of the Web platform, in lots of detail. Its place in the
+ Web platform specification stack relative to other specifications can be best summed up as
+ follows:</p>
+
+ <p><img src="images/abstract.png" width="398" height="359" alt="It consists of everything else, above such core technologies as HTTP, URI/IRIs, DOM, XML, Unicode, and ECMAScript; below presentation-layer technologies like CSS and the NPAPI; and to the side of technologies like Geolocation, SVG, MathML, and XHR."></p>
+
+ </div>
+
+
+ <h3 id="is-this-html5?">Is this HTML5?</h3>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>In short: Yes.</p>
+
+ <p>In more length: The term "HTML5" is widely used as a buzzword to refer to modern Web
+ technologies, many of which (though by no means all) are developed at the WHATWG. This document is
+ one such; others are available from <a href="http://www.whatwg.org/specs/">the WHATWG
+ specification index</a>.</p>
+
+ <p class="note">Although we have asked them to stop doing so, the W3C also republishes some parts
+ of this specification as separate documents. There are numerous differences between this
+ specification and the W3C forks; some minor, some major. Unfortunately these are not currently
+ accurately documented anywhere, so there is no way to know which are intentional and which are
+ not.</p>
+
+
+ <h3>Background</h3>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>HTML is the World Wide Web's core markup language. Originally, HTML was primarily designed as a
+ language for semantically describing scientific documents. Its general design, however, has
+ enabled it to be adapted, over the subsequent years, to describe a number of other types of
+ documents and even applications.</p>
+
+
+ <h3>Audience</h3>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>This specification is intended for authors of documents and scripts that use the features
+ defined in this specification<span class="nodev">, implementors of tools that operate on pages that
+ use the features defined in this specification, and individuals wishing to establish the
+ correctness of documents or implementations with respect to the requirements of this
+ specification</span>.</p>
+
+ <p>This document is probably not suited to readers who do not already have at least a passing
+ familiarity with Web technologies, as in places it sacrifices clarity for precision, and brevity
+ for completeness. More approachable tutorials and authoring guides can provide a gentler
+ introduction to the topic.</p>
+
+ <p>In particular, familiarity with the basics of DOM is necessary for a complete understanding of
+ some of the more technical parts of this specification. An understanding of Web IDL, HTTP, XML,
+ Unicode, character encodings, JavaScript, and CSS will also be helpful in places but is not
+ essential.</p>
+
+
+ <h3>Scope</h3>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>This specification is limited to providing a semantic-level markup language and associated
+ semantic-level scripting APIs for authoring accessible pages on the Web ranging from static
+ documents to dynamic applications.</p>
+
+ <p>The scope of this specification does not include providing mechanisms for media-specific
+ customization of presentation (although default rendering rules for Web browsers are included at
+ the end of this specification, and several mechanisms for hooking into CSS are provided as part of
+ the language).</p>
+
+ <p>The scope of this specification is not to describe an entire operating system. In particular,
+ hardware configuration software, image manipulation tools, and applications that users would be
+ expected to use with high-end workstations on a daily basis are out of scope. In terms of
+ applications, this specification is targeted specifically at applications that would be expected
+ to be used by users on an occasional basis, or regularly but from disparate locations, with low
+ CPU requirements. Examples of such applications include online purchasing systems, searching
+ systems, games (especially multiplayer online games), public telephone books or address books,
+ communications software (e-mail clients, instant messaging clients, discussion software), document
+ editing software, etc.</p>
+
+
+ <h3>History</h3>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>For its first five years (1990-1995), HTML went through a number of revisions and experienced a
+ number of extensions, primarily hosted first at CERN, and then at the IETF.</p>
+
+ <p>With the creation of the W3C, HTML's development changed venue again. A first abortive attempt
+ at extending HTML in 1995 known as HTML 3.0 then made way to a more pragmatic approach known as
+ HTML 3.2, which was completed in 1997. HTML4 quickly followed later that same year.</p>
+
+ <p>The following year, the W3C membership decided to stop evolving HTML and instead begin work on
+ an XML-based equivalent, called XHTML. <!-- http://www.w3.org/MarkUp/future/#summary --> This
+ effort started with a reformulation of HTML4 in XML, known as XHTML 1.0, which added no new
+ features except the new serialisation, and which was completed in 2000. After XHTML 1.0, the W3C's
+ focus turned to making it easier for other working groups to extend XHTML, under the banner of
+ XHTML Modularization. In parallel with this, the W3C also worked on a new language that was not
+ compatible with the earlier HTML and XHTML languages, calling it XHTML2.</p>
+
+ <p>Around the time that HTML's evolution was stopped in 1998, parts of the API for HTML developed
+ by browser vendors were specified and published under the name DOM Level 1 (in 1998) and DOM Level
+ 2 Core and DOM Level 2 HTML (starting in 2000 and culminating in 2003). These efforts then petered
+ out, with some DOM Level 3 specifications published in 2004 but the working group being closed
+ before all the Level 3 drafts were completed.</p>
+
+ <p>In 2003, the publication of XForms, a technology which was positioned as the next generation of
+ Web forms, sparked a renewed interest in evolving HTML itself, rather than finding replacements
+ for it. This interest was borne from the realization that XML's deployment as a Web technology was
+ limited to entirely new technologies (like RSS and later Atom), rather than as a replacement for
+ existing deployed technologies (like HTML).</p>
+
+ <p>A proof of concept to show that it was possible to extend HTML4's forms to provide many of the
+ features that XForms 1.0 introduced, without requiring browsers to implement rendering engines
+ that were incompatible with existing HTML Web pages, was the first result of this renewed
+ interest. At this early stage, while the draft was already publicly available, and input was
+ already being solicited from all sources, the specification was only under Opera Software's
+ copyright.</p>
+
+ <p>The idea that HTML's evolution should be reopened was tested at a W3C workshop in 2004, where
+ some of the principles that underlie the HTML5 work (described below), as well as the
+ aforementioned early draft proposal covering just forms-related features, were presented to the
+ W3C jointly by Mozilla and Opera. The proposal was rejected on the grounds that the proposal
+ conflicted with the previously chosen direction for the Web's evolution; the W3C staff and
+ membership voted to continue developing XML-based replacements instead.</p>
+
+ <p>Shortly thereafter, Apple, Mozilla, and Opera jointly announced their intent to continue
+ working on the effort under the umbrella of a new venue called the WHATWG. A public mailing list
+ was created, and the draft was moved to the WHATWG site. The copyright was subsequently amended to
+ be jointly owned by all three vendors, and to allow reuse of the specification.</p>
+
+ <p>The WHATWG was based on several core principles, in particular that technologies need to be
+ backwards compatible, that specifications and implementations need to match even if this means
+ changing the specification rather than the implementations, and that specifications need to be
+ detailed enough that implementations can achieve complete interoperability without
+ reverse-engineering each other.</p>
+
+ <p>The latter requirement in particular required that the scope of the HTML5 specification include
+ what had previously been specified in three separate documents: HTML4, XHTML1, and DOM2 HTML. It
+ also meant including significantly more detail than had previously been considered the norm.</p>
+
+ <p>In 2006, the W3C indicated an interest to participate in the development of HTML5 after all,
+ and in 2007 formed a working group chartered to work with the WHATWG on the development of the
+ HTML5 specification. Apple, Mozilla, and Opera allowed the W3C to publish the specification under
+ the W3C copyright, while keeping a version with the less restrictive license on the WHATWG
+ site.</p>
+
+ <p>For a number of years, both groups then worked together. In 2011, however, the groups came to
+ the conclusion that they had different goals: the W3C wanted to publish a "finished" version of
+ "HTML5", while the WHATWG wanted to continue working on a Living Standard for HTML, continuously
+ maintaining the specification rather than freezing it in a state with known problems, and adding
+ new features as needed to evolve the platform.</p>
+
+ <p>Since then, the WHATWG has been working on this specification (amongst others), and the W3C has
+ been copying fixes made by the WHATWG into their fork of the document, as well as making other
+ changes, some intentional and some not, with no documentation listing or explaining the
+ differences.</p>
+
+
+
+ <h3>Design notes</h3>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>It must be admitted that many aspects of HTML appear at first glance to be nonsensical and
+ inconsistent.</p>
+
+ <p>HTML, its supporting DOM APIs, as well as many of its supporting technologies, have been
+ developed over a period of several decades by a wide array of people with different priorities
+ who, in many cases, did not know of each other's existence.</p>
+
+ <p>Features have thus arisen from many sources, and have not always been designed in especially
+ consistent ways. Furthermore, because of the unique characteristics of the Web, implementation
+ bugs have often become de-facto, and now de-jure, standards, as content is often unintentionally
+ written in ways that rely on them before they can be fixed.</p>
+
+ <p>Despite all this, efforts have been made to adhere to certain design goals. These are described
+ in the next few subsections.</p>
+
+
+
+ <h4>Serializability of script execution</h4>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>To avoid exposing Web authors to the complexities of multithreading, the HTML and DOM APIs are
+ designed such that no script can ever detect the simultaneous execution of other scripts. Even
+ with <span data-x="Worker">workers</span>, the intent is that the behavior of implementations can
+ be thought of as completely serializing the execution of all scripts in all <span data-x="browsing
+ context">browsing contexts</span>.</p>
+
+ <p class="note">The <code
+ data-x="dom-navigator-yieldForStorageUpdates">navigator.yieldForStorageUpdates()</code> method, in
+ this model, is equivalent to allowing other scripts to run while the calling script is
+ blocked.</p>
+
+
+
+ <h4>Compliance with other specifications</h4>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>This specification interacts with and relies on a wide variety of other specifications. In
+ certain circumstances, unfortunately, conflicting needs have led to this specification violating
+ the requirements of these other specifications. Whenever this has occurred, the transgressions
+ have each been noted as a "<dfn>willful violation</dfn>", and the reason for the violation has
+ been noted.</p>
+
+
+
+ <h4>Extensibility</h4>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>HTML has a wide array of extensibility mechanisms that can be used for adding semantics in a
+ safe manner:</p>
+
+ <ul>
+
+ <li><p>Authors can use the <code data-x="attr-class">class</code> attribute to extend elements,
+ effectively creating their own elements, while using the most applicable existing "real" HTML
+ element, so that browsers and other tools that don't know of the extension can still support it
+ somewhat well. This is the tack used by microformats, for example.</p></li>
+
+ <li><p>Authors can include data for inline client-side scripts or server-side site-wide scripts
+ to process using the <code data-x="attr-data-*">data-*=""</code> attributes. These are guaranteed
+ to never be touched by browsers, and allow scripts to include data on HTML elements that scripts
+ can then look for and process.</p></li>
+
+ <li><p>Authors can use the <code data-x="meta">&lt;meta name="" content=""></code> mechanism to
+ include page-wide metadata by registering <span data-x="concept-meta-extensions">extensions to
+ the predefined set of metadata names</span>.</p></li>
+
+ <li><p>Authors can use the <code data-x="attr-hyperlink-rel">rel=""</code> mechanism to annotate
+ links with specific meanings by registering <span data-x="concept-rel-extensions">extensions to
+ the predefined set of link types</span>. This is also used by microformats.</p></li>
+
+ <li><p>Authors can embed raw data using the <code data-x="script">&lt;script type=""></code>
+ mechanism with a custom type, for further handling by inline or server-side scripts.</p></li>
+
+ <li><p>Authors can create <span data-x="plugin">plugins</span> and invoke them using the
+ <code>embed</code> element. This is how Flash works.</p></li>
+
+ <li><p>Authors can extend APIs using the JavaScript prototyping mechanism. This is widely used by
+ script libraries, for instance.</p></li>
+
+ <li><p>Authors can use the microdata feature (the <code
+ data-x="attr-itemscope">itemscope=""</code> and <code data-x="attr-itemprop">itemprop=""</code>
+ attributes) to embed nested name-value pairs of data to be shared with other applications and
+ sites.</p></li>
+
+ </ul>
+
+
+
+
+ <h3>HTML vs XHTML</h3>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>This specification defines an abstract language for describing documents and applications, and
+ some APIs for interacting with in-memory representations of resources that use this language.</p>
+
+ <p>The in-memory representation is known as "DOM HTML", or "the DOM" for short.</p>
+
+ <p>There are various concrete syntaxes that can be used to transmit resources that use this
+ abstract language, two of which are defined in this specification.</p>
+
+ <p>The first such concrete syntax is the HTML syntax. This is the format suggested for most
+ authors. It is compatible with most legacy Web browsers. If a document is transmitted with the
+ <code>text/html</code> <span>MIME type</span>, then it will be processed as an HTML document by
+ Web browsers. This specification defines the latest HTML syntax, known simply as "HTML".</p>
+
+ <p>The second concrete syntax is the XHTML syntax, which is an application of XML. When a document
+ is transmitted with an <span>XML MIME type</span>, such as <code>application/xhtml+xml</code>,
+ then it is treated as an XML document by Web browsers, to be parsed by an XML processor. Authors
+ are reminded that the processing for XML and HTML differs; in particular, even minor syntax errors
+ will prevent a document labeled as XML from being rendered fully, whereas they would be ignored in
+ the HTML syntax. This specification defines the latest XHTML syntax, known simply as "XHTML".</p>
+
+ <p>The DOM, the HTML syntax, and the XHTML syntax cannot all represent the same content. For
+ example, namespaces cannot be represented using the HTML syntax, but they are supported in the DOM
+ and in the XHTML syntax. Similarly, documents that use the <code>noscript</code> feature can be
+ represented using the HTML syntax, but cannot be represented with the DOM or in the XHTML syntax.
+ Comments that contain the string "<code data-x="">--&gt;</code>" can only be represented in the
+ DOM, not in the HTML and XHTML syntaxes.</p>
+
+
+ <h3>Structure of this specification</h3>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>This specification is divided into the following major sections:</p>
+
+ <dl>
+
+
+ <dt><a href="#introduction">Introduction</a></dt>
+
+ <dd>Non-normative materials providing a context for the HTML standard.</dd>
+
+
+ <dt><a href="#infrastructure">Common infrastructure</a></dt>
+
+ <dd>The conformance classes, algorithms, definitions, and the common underpinnings of the rest of
+ the specification.</dd>
+
+
+ <dt><a href="#dom">Semantics, structure, and APIs of HTML documents</a></dt>
+
+ <dd>Documents are built from elements. These elements form a tree using the DOM. This section
+ defines the features of this DOM, as well as introducing the features common to all elements, and
+ the concepts used in defining elements.</dd>
+
+
+ <dt><a href="#semantics">The elements of HTML</a></dt>
+
+ <dd>Each element has a predefined meaning, which is explained in this section. Rules for authors
+ on how to use the element<span class="nodev">, along with user agent requirements for how to
+ handle each element,</span> are also given. This includes large signature features of HTML such
+ as video playback and subtitles, form controls and form submission, and a 2D graphics API known
+ as the HTML canvas.</dd>
+
+
+ <dt><a href="#microdata">Microdata</a></dt>
+
+ <dd>This specification introduces a mechanism for adding machine-readable annotations to
+ documents, so that tools can extract trees of name-value pairs from the document. This section
+ describes this mechanism<span class="nodev"> and some algorithms that can be used to convert HTML
+ documents into other formats</span>. This section also defines some sample Microdata vocabularies
+ for contact information, calendar events, and licensing works.</dd>
+
+
+ <dt><a href="#editing">User interaction</a></dt>
+
+ <dd>HTML documents can provide a number of mechanisms for users to interact with and modify
+ content, which are described in this section, such as how focus works, and drag-and-drop.</dd>
+
+
+ <dt><a href="#browsers">Loading Web pages</a></dt>
+
+ <dd>HTML documents do not exist in a vacuum &mdash; this section defines many of the features
+ that affect environments that deal with multiple pages, such as Web browsers and offline
+ caching of Web applications.</dd>
+
+
+ <dt><a href="#webappapis">Web application APIs</a></dt>
+
+ <dd>This section introduces basic features for scripting of applications in HTML.</dd>
+
+
+ <dt><a href="#workers">Web workers</a></dt>
+
+ <dd>This section defines an API for background threads in JavaScript.</dd>
+
+
+ <dt><a href="#comms">The communication APIs</a></dt>
+
+ <dd>This section describes some mechanisms that applications written in HTML can use to
+ communicate with other applications from different domains running on the same client. It also
+ introduces a server-push event stream mechanism known as Server Sent Events or
+ <code>EventSource</code>, and a two-way full-duplex socket protocol for scripts known as Web
+ Sockets.
+
+ </dd>
+
+
+ <dt><a href="#webstorage">Web storage</a></dt>
+
+ <dd>This section defines a client-side storage mechanism based on name-value pairs.</dd>
+
+
+ <dt><a href="#syntax">The HTML syntax</a></dt>
+ <dt><a href="#xhtml">The XHTML syntax</a></dt>
+
+ <dd>All of these features would be for naught if they couldn't be represented in a serialized
+ form and sent to other people, and so these sections define the syntaxes of HTML and XHTML<span
+ class="nodev">, along with rules for how to parse content using those syntaxes</span>.</dd>
+
+
+ <dt><a href="#rendering">Rendering</a></dt>
+
+ <dd>This section defines the default rendering rules for Web browsers.</dd>
+
+
+ </dl>
+
+ <p>There are also some appendices, listing <a href="#obsolete">obsolete features</a> and <a
+ href="#iana">IANA considerations</a>, and several indices.</p>
+
+
+
+ <h4>How to read this specification</h4>
+
+ <p>This specification should be read like all other specifications. First, it should be read
+ cover-to-cover, multiple times. Then, it should be read backwards at least once. Then it should be
+ read by picking random sections from the contents list and following all the cross-references.</p>
+
+ <p>As described in the conformance requirements section below, this specification describes
+ conformance criteria for a variety of conformance classes. In particular, there are conformance
+ requirements that apply to <em>producers</em>, for example authors and the documents they create,
+ and there are conformance requirements that apply to <em>consumers</em>, for example Web browsers.
+ They can be distinguished by what they are requiring: a requirement on a producer states what is
+ allowed, while a requirement on a consumer states how software is to act.</p>
+
+ <div class="example">
+
+ <p>For example, "the <code data-x="">foo</code> attribute's value must be a <span>valid
+ integer</span>" is a requirement on producers, as it lays out the allowed values; in contrast,
+ the requirement "the <code data-x="">foo</code> attribute's value must be parsed using the
+ <span>rules for parsing integers</span>" is a requirement on consumers, as it describes how to
+ process the content.</p>
+
+ </div>
+
+ <p><strong>Requirements on producers have no bearing whatsoever on consumers.</strong></p>
+
+ <div class="example">
+
+ <p>Continuing the above example, a requirement stating that a particular attribute's value is
+ constrained to being a <span>valid integer</span> emphatically does <em>not</em> imply anything
+ about the requirements on consumers. It might be that the consumers are in fact required to treat
+ the attribute as an opaque string, completely unaffected by whether the value conforms to the
+ requirements or not. It might be (as in the previous example) that the consumers are required to
+ parse the value using specific rules that define how invalid (non-numeric in this case) values
+ are to be processed.</p>
+
+ </div>
+
+
+
+ <h4>Typographic conventions</h4>
+
+ <p>This is a definition, requirement, or explanation.</p>
+
+ <p class="note">This is a note.</p>
+
+ <p class="example">This is an example.</p>
+
+ <p class="&#x0058;&#x0058;&#x0058;">This is an open issue.</p>
+
+ <p class="warning">This is a warning.</p>
+
+ <pre class="idl extract">interface <dfn data-x="">Example</dfn> {
+ // this is an IDL definition
+};</pre>
+
+ <dl class="domintro">
+
+ <dt><var data-x="">variable</var> = <var data-x="">object</var> . <code data-x="">method</code>( [ <var data-x="">optionalArgument</var> ] )</dt>
+
+ <dd>
+
+ <p>This is a note to authors describing the usage of an interface.</p>
+
+ </dd>
+
+ </dl>
+
+ <pre class="css">/* this is a CSS fragment */</pre>
+
+ <p>The defining instance of a term is marked up like <dfn data-x="x-this">this</dfn>. Uses of that
+ term are marked up like <span data-x="x-this">this</span> or like <i data-x="x-this">this</i>.</p>
+
+ <p>The defining instance of an element, attribute, or API is marked up like <dfn
+ data-x="x-that"><code>this</code></dfn>. References to that element, attribute, or API are marked
+ up like <code data-x="x-that">this</code>.</p>
+
+ <p>Other code fragments are marked up <code data-x="">like this</code>.</p>
+
+ <p>Variables are marked up like <var data-x="">this</var>.</p>
+
+ <p>In an algorithm, steps in <span data-x="synchronous section">synchronous sections</span> are
+ marked with &#x231B;.</p>
+
+ <p>In some cases, requirements are given in the form of lists with conditions and corresponding
+ requirements. In such cases, the requirements that apply to a condition are always the first set
+ of requirements that follow the condition, even in the case of there being multiple sets of
+ conditions for those requirements. Such cases are presented as follows:</p>
+
+ <dl class="switch">
+
+ <dt>This is a condition
+ <dt>This is another condition
+ <dd>This is the requirement that applies to the conditions above.
+
+ <dt>This is a third condition
+ <dd>This is the requirement that applies to the third condition.
+
+ </dl>
+
+
+
+ <h3 id="fingerprint">Privacy concerns</h3>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>Some features of HTML trade user convenience for a measure of user privacy.</p>
+
+ <p>In general, due to the Internet's architecture, a user can be distinguished from another by the
+ user's IP address. IP addresses do not perfectly match to a user; as a user moves from device to
+ device, or from network to network, their IP address will change; similarly, NAT routing, proxy
+ servers, and shared computers enable packets that appear to all come from a single IP address to
+ actually map to multiple users. Technologies such as onion routing can be used to further
+ anonymise requests so that requests from a single user at one node on the Internet appear to come
+ from many disparate parts of the network.</p>
+
+ <p>However, the IP address used for a user's requests is not the only mechanism by which a user's
+ requests could be related to each other. Cookies, for example, are designed specifically to enable
+ this, and are the basis of most of the Web's session features that enable you to log into a site
+ with which you have an account.</p>
+
+ <p>There are other mechanisms that are more subtle. Certain characteristics of a user's system can
+ be used to distinguish groups of users from each other; by collecting enough such information, an
+ individual user's browser's "digital fingerprint" can be computed, which can be as good, if not
+ better, as an IP address in ascertaining which requests are from the same user.</p>
+
+ <p>Grouping requests in this manner, especially across multiple sites, can be used for both benign
+ (and even arguably positive) purposes, as well as for malevolent purposes. An example of a
+ reasonably benign purpose would be determining whether a particular person seems to prefer sites
+ with dog illustrations as opposed to sites with cat illustrations (based on how often they visit
+ the sites in question) and then automatically using the preferred illustrations on subsequent
+ visits to participating sites. Malevolent purposes, however, could include governments combining
+ information such as the person's home address (determined from the addresses they use when getting
+ driving directions on one site) with their apparent political affiliations (determined by
+ examining the forum sites that they participate in) to determine whether the person should be
+ prevented from voting in an election.</p>
+
+ <p>Since the malevolent purposes can be remarkably evil, user agent implementors are encouraged to
+ consider how to provide their users with tools to minimise leaking information that could be used
+ to fingerprint a user.</p>
+
+ <p>Unfortunately, as the first paragraph in this section implies, sometimes there is great benefit
+ to be derived from exposing the very information that can also be used for fingerprinting
+ purposes, so it's not as easy as simply blocking all possible leaks. For instance, the ability to
+ log into a site to post under a specific identity requires that the user's requests be
+ identifiable as all being from the same user, more or less by definition. More subtly, though,
+ information such as how wide text is, which is necessary for many effects that involve drawing
+ text onto a canvas (e.g. any effect that involves drawing a border around the text) also leaks
+ information that can be used to group a user's requests. (In this case, by potentially exposing,
+ via a brute force search, which fonts a user has installed, information which can vary
+ considerably from user to user.)</p>
+
+ <p>Features in this specification which can be <dfn data-x="fingerprinting vector">used to
+ fingerprint the user</dfn> are marked as this paragraph is.
+ <!--INSERT FINGERPRINT-->
+ </p>
+
+ <p>Other features in the platform can be used for the same purpose, though, including, though not
+ limited to:</p>
+
+ <ul>
+
+ <li>The exact list of which features a user agents supports.</li>
+
+ <li>The maximum allowed stack depth for recursion in script.</li>
+
+ <li>Features that describe the user's environment, like Media Queries and the <code>Screen</code>
+ object. <a href="#refsMQ">[MQ]</a> <a href="#refsCSSOMVIEW">[CSSOMVIEW]</a></li>
+
+ <li>The user's time zone.</li>
+
+ </ul>
+
+
+
+ <h3>A quick introduction to HTML</h3>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>A basic HTML document looks like this:</p>
+
+ <pre id="intro-early-example">&lt;!DOCTYPE html>
+&lt;html>
+ &lt;head>
+ &lt;title>Sample page&lt;/title>
+ &lt;/head>
+ &lt;body>
+ &lt;h1>Sample page&lt;/h1>
+ &lt;p>This is a &lt;a href="demo.html">simple&lt;/a> sample.&lt;/p>
+ &lt;!-- this is a comment -->
+ &lt;/body>
+&lt;/html></pre>
+
+ <p>HTML documents consist of a tree of elements and text. Each element is denoted in the source by
+ a <span data-x="syntax-start-tag">start tag</span>, such as "<code data-x="">&lt;body></code>", and
+ an <span data-x="syntax-end-tag">end tag</span>, such as "<code data-x="">&lt;/body></code>".
+ (Certain start tags and end tags can in certain cases be <span
+ data-x="syntax-tag-omission">omitted</span> and are implied by other tags.)</p>
+
+ <p>Tags have to be nested such that elements are all completely within each other, without
+ overlapping:</p>
+
+ <pre class="bad">&lt;p>This is &lt;em>very &lt;strong>wrong&lt;/em>!&lt;/strong>&lt;/p></pre>
+ <pre>&lt;p>This &lt;em>is &lt;strong>correct&lt;/strong>.&lt;/em>&lt;/p></pre>
+
+ <p>This specification defines a set of elements that can be used in HTML, along with rules about
+ the ways in which the elements can be nested.</p>
+
+ <p>Elements can have attributes, which control how the elements work. In the example below, there
+ is a <span>hyperlink</span>, formed using the <code>a</code> element and its <code
+ data-x="attr-hyperlink-href">href</code> attribute:</p>
+
+ <pre>&lt;a href="demo.html">simple&lt;/a></pre>
+
+ <p><span data-x="syntax-attributes">Attributes</span> are placed inside the start tag, and consist
+ of a <span data-x="syntax-attribute-name">name</span> and a <span
+ data-x="syntax-attribute-value">value</span>, separated by an "<code data-x="">=</code>" character.
+ The attribute value can remain <a href="#unquoted">unquoted</a> if it doesn't contain <span
+ data-x="space character">space characters</span> or any of <code data-x="">"</code> <code
+ data-x="">'</code> <code data-x="">`</code> <code data-x="">=</code> <code data-x="">&lt;</code> or
+ <code data-x="">&gt;</code>. Otherwise, it has to be quoted using either single or double quotes.
+ The value, along with the "<code data-x="">=</code>" character, can be omitted altogether if the
+ value is the empty string.</p>
+
+ <pre>&lt;!-- empty attributes -->
+&lt;input name=address disabled>
+&lt;input name=address disabled="">
+
+&lt;!-- attributes with a value -->
+&lt;input name=address maxlength=200>
+&lt;input name=address maxlength='200'>
+&lt;input name=address maxlength="200"></pre>
+
+ <p>HTML user agents (e.g. Web browsers) then <i>parse</i> this markup, turning it into a DOM
+ (Document Object Model) tree. A DOM tree is an in-memory representation of a document.</p>
+
+ <p>DOM trees contain several kinds of nodes, in particular a <code>DocumentType</code> node,
+ <code>Element</code> nodes, <code>Text</code> nodes, <code>Comment</code> nodes, and in some cases
+ <code>ProcessingInstruction</code> nodes.</p>
+
+ <p>The <a href="#intro-early-example">markup snippet at the top of this section</a> would be
+ turned into the following DOM tree:</p>
+
+ <ul class="domTree"><li class="t10">DOCTYPE: <code data-x="">html</code></li><li class="t1"><code>html</code><ul><li class="t1"><code>head</code><ul><li class="t3"><code>#text</code>: <span data-x="">&#x23CE;&#x2423;&#x2423;</span></li><li class="t1"><code>title</code><ul><li class="t3"><code>#text</code>: <span data-x="">Sample page</span></li></ul></li><li class="t3"><code>#text</code>: <span data-x="">&#x23CE;&#x2423;</span></li></ul></li><li class="t3"><code>#text</code>: <span data-x="">&#x23CE;&#x2423;</span></li><li class="t1"><code>body</code><ul><li class="t3"><code>#text</code>: <span data-x="">&#x23CE;&#x2423;&#x2423;</span></li><li class="t1"><code>h1</code><ul><li class="t3"><code>#text</code>: <span data-x="">Sample page</span></li></ul></li><li class="t3"><code>#text</code>: <span data-x="">&#x23CE;&#x2423;&#x2423;</span></li><li class="t1"><code>p</code><ul><li class="t3"><code>#text</code>: <span data-x="">This is a <!--grammar-check-override--></span></li><li class="t1"><code>a</code> <span data-x="" class="t2"><code class="attribute name">href</code>="<code class="attribute value">demo.html</code>"</span><ul><li class="t3"><code>#text</code>: <span data-x="">simple</span></li></ul></li><li class="t3"><code>#text</code>: <span data-x=""> sample.</span></li></ul></li><li class="t3"><code>#text</code>: <span data-x="">&#x23CE;&#x2423;&#x2423;</span></li><li class="t8"><code>#comment</code>: <span data-x=""> this is a comment </span></li><li class="t3"><code>#text</code>: <span data-x="">&#x23CE;&#x2423;&#x23CE;</span></li></ul></li></ul></li></ul>
+
+ <p>The <span>root element</span> of this tree is the <code>html</code> element, which is the
+ element always found at the root of HTML documents. It contains two elements, <code>head</code>
+ and <code>body</code>, as well as a <code>Text</code> node between them.</p>
+
+ <p>There are many more <code>Text</code> nodes in the DOM tree than one would initially expect,
+ because the source contains a number of spaces (represented here by "&#x2423;") and line breaks
+ ("&#x23CE;") that all end up as <code>Text</code> nodes in the DOM. However, for historical
+ reasons not all of the spaces and line breaks in the original markup appear in the DOM. In
+ particular, all the whitespace before <code>head</code> start tag ends up being dropped silently,
+ and all the whitespace after the <code>body</code> end tag ends up placed at the end of the
+ <code>body</code>.</p>
+
+ <p>The <code>head</code> element contains a <code>title</code> element, which itself contains a
+ <code>Text</code> node with the text "Sample page". Similarly, the <code>body</code> element
+ contains an <code>h1</code> element, a <code>p</code> element, and a comment.</p>
+
+ <hr>
+
+ <p>This DOM tree can be manipulated from scripts in the page. Scripts (typically in JavaScript)
+ are small programs that can be embedded using the <code>script</code> element or using <span>event
+ handler content attributes</span>. For example, here is a form with a script that sets the value
+ of the form's <code>output</code> element to say "Hello World":</p>
+
+ <pre>&lt;<span>form</span> <span data-x="attr-form-name">name</span>="main">
+ Result: &lt;<span>output</span> <span data-x="attr-fe-name">name</span>="result">&lt;/output>
+ &lt;<span>script</span>>
+ <span data-x="Document">document</span>.<span data-x="dom-document-forms">forms</span>.main.<span data-x="dom-form-elements">elements</span>.result.<span data-x="dom-output-value">value</span> = 'Hello World';
+ &lt;/script>
+&lt;/form></pre>
+
+ <p>Each element in the DOM tree is represented by an object, and these objects have APIs so that
+ they can be manipulated. For instance, a link (e.g. the <code>a</code> element in the tree above)
+ can have its "<code data-x="attr-hyperlink-href">href</code>" attribute changed in several
+ ways:</p>
+
+ <pre>var a = <span data-x="Document">document</span>.<span data-x="dom-document-links">links</span>[0]; // obtain the first link in the document
+a.<span data-x="dom-url-href">href</span> = 'sample.html'; // change the destination URL of the link
+a.<span data-x="dom-url-protocol">protocol</span> = 'https'; // change just the scheme part of the URL
+a.setAttribute('href', 'http://example.com/'); // change the content attribute directly</pre>
+
+ <p>Since DOM trees are used as the way to represent HTML documents when they are processed and
+ presented by implementations (especially interactive implementations like Web browsers), this
+ specification is mostly phrased in terms of DOM trees, instead of the markup described above.</p>
+
+ <hr>
+
+ <p>HTML documents represent a media-independent description of interactive content. HTML documents
+ might be rendered to a screen, or through a speech synthesiser, or on a braille display. To
+ influence exactly how such rendering takes place, authors can use a styling language such as
+ CSS.</p>
+
+ <p>In the following example, the page has been made yellow-on-blue using CSS.</p>
+
+ <pre>&lt;!DOCTYPE html>
+&lt;html>
+ &lt;head>
+ &lt;title>Sample styled page&lt;/title>
+ &lt;style>
+ body { background: navy; color: yellow; }
+ &lt;/style>
+ &lt;/head>
+ &lt;body>
+ &lt;h1>Sample styled page&lt;/h1>
+ &lt;p>This page is just a demo.&lt;/p>
+ &lt;/body>
+&lt;/html></pre>
+
+ <p>For more details on how to use HTML, authors are encouraged to consult tutorials and guides.
+ Some of the examples included in this specification might also be of use, but the novice author is
+ cautioned that this specification, by necessity, defines the language with a level of detail that
+ might be difficult to understand at first.</p>
+
+
+
+<!--ADD-TOPIC:Security-->
+ <h4>Writing secure applications with HTML</h4>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>When HTML is used to create interactive sites, care needs to be taken to avoid introducing
+ vulnerabilities through which attackers can compromise the integrity of the site itself or of the
+ site's users.</p>
+
+ <p>A comprehensive study of this matter is beyond the scope of this document, and authors are
+ strongly encouraged to study the matter in more detail. However, this section attempts to provide
+ a quick introduction to some common pitfalls in HTML application development.</p>
+
+ <p>The security model of the Web is based on the concept of "origins", and correspondingly many of
+ the potential attacks on the Web involve cross-origin actions. <a
+ href="#refsORIGIN">[ORIGIN]</a></p>
+
+ <dl>
+
+ <dt>Not validating user input</dt>
+ <dt>Cross-site scripting (XSS)</dt>
+ <dt>SQL injection</dt>
+
+ <dd>
+
+ <p>When accepting untrusted input, e.g. user-generated content such as text comments, values in
+ URL parameters, messages from third-party sites, etc, it is imperative that the data be
+ validated before use, and properly escaped when displayed. Failing to do this can allow a
+ hostile user to perform a variety of attacks, ranging from the potentially benign, such as
+ providing bogus user information like a negative age, to the serious, such as running scripts
+ every time a user looks at a page that includes the information, potentially propagating the
+ attack in the process, to the catastrophic, such as deleting all data in the server.</p>
+
+ <p>When writing filters to validate user input, it is imperative that filters always be
+ whitelist-based, allowing known-safe constructs and disallowing all other input. Blacklist-based
+ filters that disallow known-bad inputs and allow everything else are not secure, as not
+ everything that is bad is yet known (for example, because it might be invented in the
+ future).</p>
+
+ <div class="example">
+
+ <p>For example, suppose a page looked at its URL's query string to determine what to display,
+ and the site then redirected the user to that page to display a message, as in:</p>
+
+ <pre>&lt;ul>
+ &lt;li>&lt;a href="message.cgi?say=Hello">Say Hello&lt;/a>
+ &lt;li>&lt;a href="message.cgi?say=Welcome">Say Welcome&lt;/a>
+ &lt;li>&lt;a href="message.cgi?say=Kittens">Say Kittens&lt;/a>
+&lt;/ul></pre>
+
+ <p>If the message was just displayed to the user without escaping, a hostile attacker could
+ then craft a URL that contained a script element:</p>
+
+ <pre>http://example.com/message.cgi?say=%3Cscript%3Ealert%28%27Oh%20no%21%27%29%3C/script%3E</pre>
+
+ <p>If the attacker then convinced a victim user to visit this page, a script of the attacker's
+ choosing would run on the page. Such a script could do any number of hostile actions, limited
+ only by what the site offers: if the site is an e-commerce shop, for instance, such a script
+ could cause the user to unknowingly make arbitrarily many unwanted purchases.</p>
+
+ <p>This is called a cross-site scripting attack.</p>
+
+ </div>
+
+ <p>There are many constructs that can be used to try to trick a site into executing code. Here
+ are some that authors are encouraged to consider when writing whitelist filters:</p>
+
+ <ul>
+
+ <li>When allowing harmless-seeming elements like <code>img</code>, it is important to whitelist
+ any provided attributes as well. If one allowed all attributes then an attacker could, for
+ instance, use the <code data-x="handler-onload">onload</code> attribute to run arbitrary
+ script.</li>
+
+ <li>When allowing URLs to be provided (e.g. for links), the scheme of each URL also needs to be
+ explicitly whitelisted, as there are many schemes that can be abused. The most prominent
+ example is "<code data-x="javascript-protocol">javascript:</code>", but user agents can
+ implement (and indeed, have historically implemented) others.</li> <!-- IE had vbscript:,
+ Netscape had livescript:, etc. -->
+
+ <li>Allowing a <code>base</code> element to be inserted means any <code>script</code> elements
+ in the page with relative links can be hijacked, and similarly that any form submissions can
+ get redirected to a hostile site.</li>
+
+ </ul>
+
+ </dd>
+
+
+ <dt>Cross-site request forgery (CSRF)</dt>
+
+ <dd>
+
+ <p>If a site allows a user to make form submissions with user-specific side-effects, for example
+ posting messages on a forum under the user's name, making purchases, or applying for a passport,
+ it is important to verify that the request was made by the user intentionally, rather than by
+ another site tricking the user into making the request unknowingly.</p>
+
+ <p>This problem exists because HTML forms can be submitted to other origins.</p>
+
+ <p>Sites can prevent such attacks by populating forms with user-specific hidden tokens, or by
+ checking <code data-x="http-origin">Origin</code> headers on all requests.</p>
+
+ </dd>
+
+
+
+ <dt>Clickjacking</dt>
+
+ <dd>
+
+ <p>A page that provides users with an interface to perform actions that the user might not wish
+ to perform needs to be designed so as to avoid the possibility that users can be tricked into
+ activating the interface.</p>
+
+ <p>One way that a user could be so tricked is if a hostile site places the victim site in a
+ small <code>iframe</code> and then convinces the user to click, for instance by having the user
+ play a reaction game. Once the user is playing the game, the hostile site can quickly position
+ the iframe under the mouse cursor just as the user is about to click, thus tricking the user
+ into clicking the victim site's interface.</p>
+
+ <p>To avoid this, sites that do not expect to be used in frames are encouraged to only enable
+ their interface if they detect that they are not in a frame (e.g. by comparing the <code
+ data-x="dom-window">window</code> object to the value of the <code data-x="dom-top">top</code>
+ attribute).</p>
+
+ </dd>
+
+ </dl>
+<!--REMOVE-TOPIC:Security-->
+
+
+ <h4>Common pitfalls to avoid when using the scripting APIs</h4>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>Scripts in HTML have "run-to-completion" semantics, meaning that the browser will generally run
+ the script uninterrupted before doing anything else, such as firing further events or continuing
+ to parse the document.</p>
+
+ <p>On the other hand, parsing of HTML files happens asynchronously and incrementally, meaning that
+ the parser can pause at any point to let scripts run. This is generally a good thing, but it does
+ mean that authors need to be careful to avoid hooking event handlers after the events could have
+ possibly fired.</p>
+
+ <p>There are two techniques for doing this reliably: use <span>event handler content
+ attributes</span>, or create the element and add the event handlers in the same script. The latter
+ is safe because, as mentioned earlier, scripts are run to completion before further events can
+ fire.</p>
+
+ <div class="example">
+
+ <p>One way this could manifest itself is with <code>img</code> elements and the <code
+ data-x="event-load">load</code> event. The event could fire as soon as the element has been
+ parsed, especially if the image has already been cached (which is common).</p>
+
+ <p>Here, the author uses the <code data-x="handler-onload">onload</code> handler on an
+ <code>img</code> element to catch the <code data-x="event-load">load</code> event:</p>
+
+ <pre>&lt;img src="games.png" alt="Games" onload="gamesLogoHasLoaded(event)"></pre>
+
+ <p>If the element is being added by script, then so long as the event handlers are added in the
+ same script, the event will still not be missed:</p>
+
+ <pre>&lt;script>
+ var img = new Image();
+ img.src = 'games.png';
+ img.alt = 'Games';
+ img.onload = gamesLogoHasLoaded;
+ // img.addEventListener('load', gamesLogoHasLoaded, false); // would work also
+&lt;/script></pre>
+
+ <p>However, if the author first created the <code>img</code> element and then in a separate
+ script added the event listeners, there's a chance that the <code data-x="event-load">load</code>
+ event would be fired in between, leading it to be missed:</p>
+
+ <pre class="bad">&lt;!-- Do not use this style, it has a race condition! -->
+ &lt;img id="games" src="games.png" alt="Games">
+ &lt;!-- the 'load' event might fire here while the parser is taking a
+ break, in which case you will not see it! -->
+ &lt;script>
+ var img = document.getElementById('games');
+ img.onload = gamesLogoHasLoaded; // might never fire!
+ &lt;/script></pre>
+
+ </div>
+
+
+
+ <h4>How to catch mistakes when writing HTML: validators and conformance checkers</h4>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>Authors are encouraged to make use of conformance checkers (also known as <i>validators</i>) to
+ catch common mistakes. The WHATWG maintains a list of such tools at: <a
+ href="http://validator.whatwg.org/">http://validator.whatwg.org/</a></p>
+
+
+
+ <h3>Conformance requirements for authors</h3>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>Unlike previous versions of the HTML specification, this specification defines in some detail
+ the required processing for invalid documents as well as valid documents.</p> <!-- This has led to
+ some questioning the purpose of conformance criteria: if there is no ambiguity in how something
+ will be processed, why disallow it? -->
+
+ <p>However, even though the processing of invalid content is in most cases well-defined,
+ conformance requirements for documents are still important: in practice, interoperability (the
+ situation in which all implementations process particular content in a reliable and identical or
+ equivalent way) is not the only goal of document conformance requirements. This section details
+ some of the more common reasons for still distinguishing between a conforming document and one
+ with errors.</p>
+
+
+ <h4>Presentational markup</h4>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>The majority of presentational features from previous versions of HTML are no longer allowed.
+ Presentational markup in general has been found to have a number of problems:</p>
+
+ <dl>
+
+ <dt>The use of presentational elements leads to poorer accessibility</dt>
+
+ <dd>
+
+ <p>While it is possible to use presentational markup in a way that provides users of assistive
+ technologies (ATs) with an acceptable experience (e.g. using ARIA), doing so is significantly
+ more difficult than doing so when using semantically-appropriate markup. Furthermore, even using
+ such techniques doesn't help make pages accessible for non-AT non-graphical users, such as users
+ of text-mode browsers.</p>
+
+ <p>Using media-independent markup, on the other hand, provides an easy way for documents to be
+ authored in such a way that they work for more users (e.g. text browsers).</p>
+
+ </dd>
+
+
+ <dt>Higher cost of maintenance</dt>
+
+ <dd>
+
+ <p>It is significantly easier to maintain a site written in such a way that the markup is
+ style-independent. For example, changing the colour of a site that uses
+ <code>&lt;font&nbsp;color=""></code> throughout requires changes across the entire site, whereas
+ a similar change to a site based on CSS can be done by changing a single file.</p>
+
+ </dd>
+
+
+ <dt>Larger document sizes</dt>
+
+ <dd>
+
+ <p>Presentational markup tends to be much more redundant, and thus results in larger document
+ sizes.</p>
+
+ </dd>
+
+ </dl>
+
+ <p>For those reasons, presentational markup has been removed from HTML in this version. This
+ change should not come as a surprise; HTML4 deprecated presentational markup many years ago and
+ provided a mode (HTML4 Transitional) to help authors move away from presentational markup; later,
+ XHTML 1.1 went further and obsoleted those features altogether.</p>
+
+ <p>The only remaining presentational markup features in HTML are the <code
+ data-x="attr-style">style</code> attribute and the <code>style</code> element. Use of the <code
+ data-x="attr-style">style</code> attribute is somewhat discouraged in production environments, but
+ it can be useful for rapid prototyping (where its rules can be directly moved into a separate
+ style sheet later) and for providing specific styles in unusual cases where a separate style sheet
+ would be inconvenient. Similarly, the <code>style</code> element can be useful in syndication or
+ for page-specific styles, but in general an external style sheet is likely to be more convenient
+ when the styles apply to multiple pages.</p>
+
+ <p>It is also worth noting that some elements that were previously presentational have been
+ redefined in this specification to be media-independent: <code>b</code>, <code>i</code>,
+ <code>hr</code>, <code>s</code>, <code>small</code>, and <code>u</code>.</p>
+
+
+ <h4>Syntax errors</h4>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>The syntax of HTML is constrained to avoid a wide variety of problems.</p>
+
+ <dl>
+
+ <dt>Unintuitive error-handling behavior</dt>
+
+ <dd>
+
+ <p>Certain invalid syntax constructs, when parsed, result in DOM trees that are highly
+ unintuitive.</p>
+
+ <div class="example">
+
+ <p>For example, the following markup fragment results in a DOM with an <code>hr</code> element
+ that is an <em>earlier</em> sibling of the corresponding <code>table</code> element:</p>
+
+ <pre class="bad">&lt;table>&lt;hr>...</pre>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Errors with optional error recovery</dt>
+
+ <dd>
+
+ <p>To allow user agents to be used in controlled environments without having to implement the
+ more bizarre and convoluted error handling rules, user agents are permitted to fail whenever
+ encountering a <span>parse error</span>.</p>
+
+ </dd>
+
+
+ <dt>Errors where the error-handling behavior is not compatible with streaming user agents</dt>
+
+ <dd>
+
+ <p>Some error-handling behavior, such as the behavior for the <code
+ data-x="">&lt;table>&lt;hr>...</code> example mentioned above, are incompatible with streaming
+ user agents (user agents that process HTML files in one pass, without storing state). To avoid
+ interoperability problems with such user agents, any syntax resulting in such behavior is
+ considered invalid.</p>
+
+ </dd>
+
+
+ <dt>Errors that can result in infoset coercion</dt>
+
+ <dd>
+
+ <p>When a user agent based on XML is connected to an HTML parser, it is possible that certain
+ invariants that XML enforces, such as comments never containing two consecutive hyphens, will be
+ violated by an HTML file. Handling this can require that the parser coerce the HTML DOM into an
+ XML-compatible infoset. Most syntax constructs that require such handling are considered
+ invalid.</p>
+
+ </dd>
+
+
+ <dt>Errors that result in disproportionally poor performance</dt>
+
+ <dd>
+
+ <p>Certain syntax constructs can result in disproportionally poor performance. To discourage the
+ use of such constructs, they are typically made non-conforming.</p>
+
+ <div class="example">
+
+ <p>For example, the following markup results in poor performance, since all the unclosed
+ <code>i</code> elements have to be reconstructed in each paragraph, resulting in progressively
+ more elements in each paragraph:</p>
+
+ <pre class="bad">&lt;p>&lt;i>He dreamt.
+&lt;p>&lt;i>He dreamt that he ate breakfast.
+&lt;p>&lt;i>Then lunch.
+&lt;p>&lt;i>And finally dinner.</pre>
+
+ <p>The resulting DOM for this fragment would be:</p>
+
+ <ul class="domTree"><li class="t1"><code>p</code><ul><li class="t1"><code>i</code><ul><li class="t3"><code>#text</code>: <span data-x="">He dreamt.</span></li></ul></li></ul></li><li class="t1"><code>p</code><ul><li class="t1"><code>i</code><ul><li class="t1"><code>i</code><ul><li class="t3"><code>#text</code>: <span data-x="">He dreamt that he ate breakfast.</span></li></ul></li></ul></li></ul></li><li class="t1"><code>p</code><ul><li class="t1"><code>i</code><ul><li class="t1"><code>i</code><ul><li class="t1"><code>i</code><ul><li class="t3"><code>#text</code>: <span data-x="">Then lunch.</span></li></ul></li></ul></li></ul></li></ul></li><li class="t1"><code>p</code><ul><li class="t1"><code>i</code><ul><li class="t1"><code>i</code><ul><li class="t1"><code>i</code><ul><li class="t1"><code>i</code><ul><li class="t3"><code>#text</code>: <span data-x="">And finally dinner.</span></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Errors involving fragile syntax constructs</dt>
+
+ <dd>
+
+ <p>There are syntax constructs that, for historical reasons, are relatively fragile. To help
+ reduce the number of users who accidentally run into such problems, they are made
+ non-conforming.</p>
+
+ <div class="example">
+
+ <p>For example, the parsing of certain named character references in attributes happens even
+ with the closing semicolon being omitted. It is safe to include an ampersand followed by
+ letters that do not form a named character reference, but if the letters are changed to a
+ string that <em>does</em> form a named character reference, they will be interpreted as that
+ character instead.</p>
+
+ <p>In this fragment, the attribute's value is "<code data-x="">?bill&amp;ted</code>":</p>
+
+ <pre class="bad">&lt;a href="?bill&amp;ted">Bill and Ted&lt;/a></pre>
+
+ <p>In the following fragment, however, the attribute's value is actually "<code
+ data-x="">?art&copy;</code>", <em>not</em> the intended "<code data-x="">?art&amp;copy</code>",
+ because even without the final semicolon, "<code data-x="">&amp;copy</code>" is handled the same
+ as "<code data-x="">&amp;copy;</code>" and thus gets interpreted as "<code
+ data-x="">&copy;</code>":</p>
+
+ <pre class="bad">&lt;a href="?art&amp;copy">Art and Copy&lt;/a></pre>
+
+ <p>To avoid this problem, all named character references are required to end with a semicolon,
+ and uses of named character references without a semicolon are flagged as errors.</p>
+
+ <p>Thus, the correct way to express the above cases is as
+ follows:</p>
+
+ <pre>&lt;a href="?bill&amp;ted">Bill and Ted&lt;/a> &lt;!-- &amp;ted is ok, since it's not a named character reference --></pre>
+ <pre>&lt;a href="?art&amp;amp;copy">Art and Copy&lt;/a> &lt;!-- the &amp; has to be escaped, since &amp;copy <em>is</em> a named character reference --></pre>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Errors involving known interoperability problems in legacy user agents</dt>
+
+ <dd>
+
+ <p>Certain syntax constructs are known to cause especially subtle or serious problems in legacy
+ user agents, and are therefore marked as non-conforming to help authors avoid them.</p>
+
+ <div class="example">
+
+ <p>For example, this is why the U+0060 GRAVE ACCENT character (`) is not allowed in unquoted
+ attributes. In certain legacy user agents, <!-- namely IE --> it is sometimes treated as a
+ quote character.</p>
+
+ </div>
+
+ <div class="example">
+
+ <p>Another example of this is the DOCTYPE, which is required to trigger <span>no-quirks
+ mode</span>, because the behavior of legacy user agents in <span>quirks mode</span> is often
+ largely undocumented.</p>
+
+ </div>
+
+ </dd>
+
+
+<!--ADD-TOPIC:Security-->
+ <dt>Errors that risk exposing authors to security attacks</dt>
+
+ <dd>
+
+ <p>Certain restrictions exist purely to avoid known security problems.</p>
+
+ <div class="example">
+
+ <p>For example, the restriction on using UTF-7 exists purely to avoid authors falling prey to a
+ known cross-site-scripting attack using UTF-7. <a href="#refsUTF7">[UTF7]</a></p>
+
+ </div>
+
+ </dd>
+<!--REMOVE-TOPIC:Security-->
+
+
+ <dt>Cases where the author's intent is unclear</dt>
+
+ <dd>
+
+ <p>Markup where the author's intent is very unclear is often made non-conforming. Correcting
+ these errors early makes later maintenance easier.</p>
+
+ <div class="example">
+
+ <p>For example, it is unclear whether the author intended the following to be an
+ <code>h1</code> heading or an <code>h2</code> heading:</p>
+
+ <pre class="bad">&lt;h1>Contact details&lt;/h2></pre>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Cases that are likely to be typos</dt>
+
+ <dd>
+
+ <p>When a user makes a simple typo, it is helpful if the error can be caught early, as this can
+ save the author a lot of debugging time. This specification therefore usually considers it an
+ error to use element names, attribute names, and so forth, that do not match the names defined
+ in this specification.</p>
+
+ <div class="example">
+
+ <p>For example, if the author typed <code>&lt;capton></code> instead of
+ <code>&lt;caption></code>, this would be flagged as an error and the author could correct the
+ typo immediately.</p>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Errors that could interfere with new syntax in the future</dt>
+
+ <dd>
+
+ <p>In order to allow the language syntax to be extended in the future, certain otherwise
+ harmless features are disallowed.</p>
+
+ <div class="example">
+
+ <p>For example, "attributes" in end tags are ignored currently, but they are invalid, in case a
+ future change to the language makes use of that syntax feature without conflicting with
+ already-deployed (and valid!) content.</p>
+
+ </div>
+
+ </dd>
+
+
+ </dl>
+
+ <p>Some authors find it helpful to be in the practice of always quoting all attributes and always
+ including all optional tags, preferring the consistency derived from such custom over the minor
+ benefits of terseness afforded by making use of the flexibility of the HTML syntax. To aid such
+ authors, conformance checkers can provide modes of operation wherein such conventions are
+ enforced.</p>
+
+
+
+ <h4>Restrictions on content models and on attribute values</h4>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>Beyond the syntax of the language, this specification also places restrictions on how elements
+ and attributes can be specified. These restrictions are present for similar reasons:</p>
+
+ <dl>
+
+
+ <dt>Errors involving content with dubious semantics</dt>
+
+ <dd>
+
+ <p>To avoid misuse of elements with defined meanings, content models are defined that restrict
+ how elements can be nested when such nestings would be of dubious value.</p>
+
+ <p class="example">For example, this specification disallows nesting a <code>section</code>
+ element inside a <code>kbd</code> element, since it is highly unlikely for an author to indicate
+ that an entire section should be keyed in.</p>
+
+ </dd>
+
+
+ <dt>Errors that involve a conflict in expressed semantics</dt>
+
+ <dd>
+
+ <p>Similarly, to draw the author's attention to mistakes in the use of elements, clear
+ contradictions in the semantics expressed are also considered conformance errors.</p>
+
+ <div class="example">
+
+ <p>In the fragments below, for example, the semantics are nonsensical: a separator cannot
+ simultaneously be a cell, nor can a radio button be a progress bar.</p>
+
+ <pre class="bad">&lt;hr role="cell"></pre>
+ <pre class="bad">&lt;input type=radio role=progressbar></pre>
+
+ </div>
+
+ <p class="example">Another example is the restrictions on the content models of the
+ <code>ul</code> element, which only allows <code>li</code> element children. Lists by definition
+ consist just of zero or more list items, so if a <code>ul</code> element contains something
+ other than an <code>li</code> element, it's not clear what was meant.</p>
+
+ </dd>
+
+
+ <dt>Cases where the default styles are likely to lead to confusion</dt>
+
+ <dd>
+
+ <p>Certain elements have default styles or behaviors that make certain combinations likely to
+ lead to confusion. Where these have equivalent alternatives without this problem, the confusing
+ combinations are disallowed.</p>
+
+ <p class="example">For example, <code>div</code> elements are rendered as block boxes, and
+ <code>span</code> elements as inline boxes. Putting a block box in an inline box is
+ unnecessarily confusing; since either nesting just <code>div</code> elements, or nesting just
+ <code>span</code> elements, or nesting <code>span</code> elements inside <code>div</code>
+ elements all serve the same purpose as nesting a <code>div</code> element in a <code>span</code>
+ element, but only the latter involves a block box in an inline box, the latter combination is
+ disallowed.</p>
+
+ <p class="example">Another example would be the way <span>interactive content</span> cannot be
+ nested. For example, a <code>button</code> element cannot contain a <code>textarea</code>
+ element. This is because the default behavior of such nesting interactive elements would be
+ highly confusing to users. Instead of nesting these elements, they can be placed side by
+ side.</p>
+
+ </dd>
+
+
+ <dt>Errors that indicate a likely misunderstanding of the specification</dt>
+
+ <dd>
+
+ <p>Sometimes, something is disallowed because allowing it would likely cause author
+ confusion.</p>
+
+ <p class="example">For example, setting the <code data-x="attr-fe-disabled">disabled</code>
+ attribute to the value "<code data-x="">false</code>" is disallowed, because despite the
+ appearance of meaning that the element is enabled, it in fact means that the element is
+ <em>disabled</em> (what matters for implementations is the presence of the attribute, not its
+ value).</p>
+
+ </dd>
+
+
+ <dt>Errors involving limits that have been imposed merely to simplify the language</dt>
+
+ <dd>
+
+ <p>Some conformance errors simplify the language that authors need to learn.</p>
+
+ <p class="example">For example, the <code>area</code> element's <code
+ data-x="attr-area-shape">shape</code> attribute, despite accepting both <code
+ data-x="attr-area-shape-keyword-circ">circ</code> and <code
+ data-x="attr-area-shape-keyword-circle">circle</code> values in practice as synonyms, disallows
+ the use of the <code data-x="attr-area-shape-keyword-circ">circ</code> value, so as to simplify
+ tutorials and other learning aids. There would be no benefit to allowing both, but it would
+ cause extra confusion when teaching the language.</p>
+
+ </dd>
+
+
+ <dt>Errors that involve peculiarities of the parser</dt>
+
+ <dd>
+
+ <p>Certain elements are parsed in somewhat eccentric ways (typically for historical reasons),
+ and their content model restrictions are intended to avoid exposing the author to these
+ issues.</p>
+
+ <div class="example">
+
+ <p>For example, a <code>form</code> element isn't allowed inside <span>phrasing content</span>,
+ because when parsed as HTML, a <code>form</code> element's start tag will imply a
+ <code>p</code> element's end tag. Thus, the following markup results in two <span
+ data-x="paragraph">paragraphs</span>, not one:</p>
+
+ <pre>&lt;p>Welcome. &lt;form>&lt;label>Name:&lt;/label> &lt;input>&lt;/form></pre>
+
+ <p>It is parsed exactly like the following:</p>
+
+ <pre>&lt;p>Welcome. &lt;/p>&lt;form>&lt;label>Name:&lt;/label> &lt;input>&lt;/form></pre>
+
+ </div>
+
+ </dd>
+
+
+ <dt>Errors that would likely result in scripts failing in hard-to-debug ways</dt>
+
+ <dd>
+
+ <p>Some errors are intended to help prevent script problems that would be hard to debug.</p>
+
+ <p class="example">This is why, for instance, it is non-conforming to have two <code
+ data-x="attr-id">id</code> attributes with the same value. Duplicate IDs lead to the wrong
+ element being selected, with sometimes disastrous effects whose cause is hard to determine.</p>
+
+ </dd>
+
+
+ <dt>Errors that waste authoring time</dt>
+
+ <dd>
+
+ <p>Some constructs are disallowed because historically they have been the cause of a lot of
+ wasted authoring time, and by encouraging authors to avoid making them, authors can save time in
+ future efforts.</p>
+
+ <p class="example">For example, a <code>script</code> element's <code
+ data-x="attr-script-src">src</code> attribute causes the element's contents to be ignored.
+ However, this isn't obvious, especially if the element's contents appear to be executable script
+ &mdash; which can lead to authors spending a lot of time trying to debug the inline script
+ without realizing that it is not executing. To reduce this problem, this specification makes it
+ non-conforming to have executable script in a <code>script</code> element when the <code
+ data-x="attr-script-src">src</code> attribute is present. This means that authors who are
+ validating their documents are less likely to waste time with this kind of mistake.</p>
+
+ </dd>
+
+
+ <dt>Errors that involve areas that affect authors migrating to and from XHTML</dt>
+
+ <dd>
+
+ <p>Some authors like to write files that can be interpreted as both XML and HTML with similar
+ results. Though this practice is discouraged in general due to the myriad of subtle
+ complications involved (especially when involving scripting, styling, or any kind of automated
+ serialisation), this specification has a few restrictions intended to at least somewhat mitigate
+ the difficulties. This makes it easier for authors to use this as a transitionary step when
+ migrating between HTML and XHTML.</p>
+
+ <p class="example">For example, there are somewhat complicated rules surrounding the <code
+ data-x="attr-lang">lang</code> and <code data-x="attr-xml-lang">xml:lang</code> attributes
+ intended to keep the two synchronized.</p>
+
+ <p class="example">Another example would be the restrictions on the values of <code
+ data-x="">xmlns</code> attributes in the HTML serialisation, which are intended to ensure that
+ elements in conforming documents end up in the same namespaces whether processed as HTML or
+ XML.</p>
+
+ </dd>
+
+
+ <dt>Errors that involve areas reserved for future expansion</dt>
+
+ <dd>
+
+ <p>As with the restrictions on the syntax intended to allow for new syntax in future revisions
+ of the language, some restrictions on the content models of elements and values of attributes
+ are intended to allow for future expansion of the HTML vocabulary.</p>
+
+ <p class="example">For example, limiting the values of the <code
+ data-x="attr-hyperlink-target">target</code> attribute that start with an U+005F LOW LINE
+ character (_) to only specific predefined values allows new predefined values to be introduced
+ at a future time without conflicting with author-defined values.</p>
+
+ </dd>
+
+
+ <dt>Errors that indicate a mis-use of other specifications</dt>
+
+ <dd>
+
+ <p>Certain restrictions are intended to support the restrictions made by other
+ specifications.</p>
+
+ <p class="example">For example, requiring that attributes that take media queries use only
+ <em>valid</em> media queries reinforces the importance of following the conformance rules of
+ that specification.</p>
+
+ </dd>
+
+ </dl>
+
+
+
+ <h3>Suggested reading</h3>
+
+ <!-- NON-NORMATIVE SECTION -->
+
+ <p>The following documents might be of interest to readers of this specification.</p>
+
+ <dl>
+
+ <dt><cite>Character Model for the World Wide Web 1.0: Fundamentals</cite> <a href="#refsCHARMOD">[CHARMOD]</a></dt>
+
+ <dd><blockquote><p>This Architectural Specification provides authors of specifications, software
+ developers, and content developers with a common reference for interoperable text manipulation on
+ the World Wide Web, building on the Universal Character Set, defined jointly by the Unicode
+ Standard and ISO/IEC 10646. Topics addressed include use of the terms 'character', 'encoding' and
+ 'string', a reference processing model, choice and identification of character encodings,
+ character escaping, and string indexing.</p></blockquote></dd>
+
+ <dt><cite>Unicode Security Considerations</cite> <a href="#refsUTR36">[UTR36]</a></dt>
+
+ <dd><blockquote><p>Because Unicode contains such a large number of characters and incorporates
+ the varied writing systems of the world, incorrect usage can expose programs or systems to
+ possible security attacks. This is especially important as more and more products are
+ internationalized. This document describes some of the security considerations that programmers,
+ system analysts, standards developers, and users should take into account, and provides specific
+ recommendations to reduce the risk of problems.</p></blockquote></dd>
+
+ <dt><cite>Web Content Accessibility Guidelines (WCAG) 2.0</cite> <a href="#refsWCAG">[WCAG]</a></dt>
+
+ <dd><blockquote><p>Web Content Accessibility Guidelines (WCAG) 2.0 covers a wide range of
+ recommendations for making Web content more accessible. Following these guidelines will make
+ content accessible to a wider range of people with disabilities, including blindness and low
+ vision, deafness and hearing loss, learning disabilities, cognitive limitations, limited
+ movement, speech disabilities, photosensitivity and combinations of these. Following these
+ guidelines will also often make your Web content more usable to users in
+ general.</p></blockquote></dd>
+
+ <dt class="nodev"><cite>Authoring Tool Accessibility Guidelines (ATAG) 2.0</cite> <a href="#refsATAG">[ATAG]</a></dt>
+
+ <dd class="nodev"><blockquote><p>This specification provides guidelines for designing Web content
+ authoring tools that are more accessible for people with disabilities. An authoring tool that
+ conforms to these guidelines will promote accessibility by providing an accessible user interface
+ to authors with disabilities as well as by enabling, supporting, and promoting the production of
+ accessible Web content by all authors.</p></blockquote></dd>
+
+ <dt class="nodev"><cite>User Agent Accessibility Guidelines (UAAG) 2.0</cite> <a href="#refsUAAG">[UAAG]</a></dt>
+
+ <dd class="nodev"><blockquote><p>This document provides guidelines for designing user agents that
+ lower barriers to Web accessibility for people with disabilities. User agents include browsers
+ and other types of software that retrieve and render Web content. A user agent that conforms to
+ these guidelines will promote accessibility through its own user interface and through other
+ internal facilities, including its ability to communicate with other technologies (especially
+ assistive technologies). Furthermore, all users, not just users with disabilities, should find
+ conforming user agents to be more usable.</p></blockquote></dd>
+
+ </dl>
+
+
+
+ <h2 id="infrastructure">Common infrastructure</h2>
+
+ <h3>Terminology</h3>
+
+ <p>This specification refers to both HTML and XML attributes and IDL attributes, often in the same
+ context. When it is not clear which is being referred to, they are referred to as <dfn
+ data-x="">content attributes</dfn> for HTML and XML attributes, and <dfn data-x="">IDL
+ attributes</dfn> for those defined on IDL interfaces. Similarly, the term "properties" is used for
+ both JavaScript object properties and CSS properties. When these are ambiguous they are qualified
+ as <dfn data-x="">object properties</dfn> and <dfn data-x="">CSS properties</dfn> respectively.</p>
+
+ <p>Generally, when the specification states that a feature applies to <span>the HTML syntax</span>
+ or <span>the XHTML syntax</span>, it also includes the other. When a feature specifically only
+ applies to one of the two languages, it is called out by explicitly stating that it does not apply
+ to the other format, as in "for HTML, ... (this does not apply to XHTML)".</p>
+
+ <p>This specification uses the term <dfn data-x="">document</dfn> to refer to any use of HTML,
+ ranging from short static documents to long essays or reports with rich multimedia, as well as to
+ fully-fledged interactive applications. The term is used to refer both to <code>Document</code>
+ objects and their descendant DOM trees, and to serialised byte streams using the <span data-x="the
+ HTML syntax">HTML syntax</span> or <span data-x="the XHTML syntax">XHTML syntax</span>, depending
+ on context.</p>
+
+ <p>In the context of the DOM structures, the terms <span data-x="HTML documents">HTML
+ document</span> and <span data-x="XML documents">XML document</span> are used as defined in the DOM
+ specification, and refer specifically to two different modes that <code>Document</code> objects
+ can find themselves in. <a href="#refsDOM">[DOM]</a> (Such uses are always hyperlinked to their
+ definition.)</p>
+
+ <p>In the context of byte streams, the term HTML document refers to resources labeled as
+ <code>text/html</code>, and the term XML document refers to resources labeled with an <span>XML
+ MIME type</span>.</p>
+
+ <p>The term <dfn>XHTML document</dfn> is used to refer to both <code>Document</code>s in the <span
+ data-x="XML documents">XML document</span> mode that contains element nodes in the <span>HTML
+ namespace</span>, and byte streams labeled with an <span>XML MIME type</span> that contain
+ elements from the <span>HTML namespace</span>, depending on context.</p>
+
+ <hr>
+
+ <p>For simplicity, terms such as <dfn data-x="">shown</dfn>, <dfn data-x="">displayed</dfn>, and
+ <dfn data-x="">visible</dfn> might sometimes be used when referring to the way a document is
+ rendered to the user. These terms are not meant to imply a visual medium; they must be considered
+ to apply to other media in equivalent ways.</p>
+
+ <div class="nodev">
+
+ <p>When an algorithm B says to return to another algorithm A, it implies that A called B. Upon
+ returning to A, the implementation must continue from where it left off in calling B.</p>
+
+ </div>
+
+ <!-- should find somewhere more appropriate to put this -->
+ <p>The term "transparent black" refers to the colour with red, green, blue, and alpha channels all
+ set to zero.</p>
+
+
+ <h4>Resources</h4>
+
+ <p>The specification uses the term <dfn data-x="">supported</dfn> when referring to whether a user
+ agent has an implementation capable of decoding the semantics of an external resource. A format or
+ type is said to be <i>supported</i> if the implementation can process an external resource of that
+ format or type without critical aspects of the resource being ignored. Whether a specific resource
+ is <i>supported</i> can depend on what features of the resource's format are in use.</p>
+
+ <p class="example">For example, a PNG image would be considered to be in a supported format if its
+ pixel data could be decoded and rendered, even if, unbeknownst to the implementation, the image
+ also contained animation data.</p>
+
+ <p class="example">An MPEG-4 video file would not be considered to be in a supported format if the
+ compression format used was not supported, even if the implementation could determine the
+ dimensions of the movie from the file's metadata.</p>
+
+ <p>What some specifications, in particular the HTTP specification, refer to as a
+ <i>representation</i> is referred to in this specification as a <dfn data-x="">resource</dfn>. <a
+ href="#refsHTTP">[HTTP]</a></p>
+
+ <p>The term <dfn>MIME type</dfn> is used to refer to what is sometimes called an <i>Internet media
+ type</i> in protocol literature. The term <i>media type</i> in this specification is used to refer
+ to the type of media intended for presentation, as used by the CSS specifications. <a
+ href="#refsRFC2046">[RFC2046]</a> <a href="#refsMQ">[MQ]</a></p>
+
+ <p>A string is a <dfn>valid MIME type</dfn> if it matches the <code data-x="">media-type</code>
+ rule defined in section 3.7 "Media Types" of RFC 2616. In particular, a <span>valid MIME
+ type</span> may include MIME type parameters. <a href="#refsHTTP">[HTTP]</a></p>
+
+ <p>A string is a <dfn>valid MIME type with no parameters</dfn> if it matches the <code
+ data-x="">media-type</code> rule defined in section 3.7 "Media Types" of RFC 2616, but does not
+ contain any U+003B SEMICOLON characters (;). In other words, if it consists only of a type and
+ subtype, with no MIME Type parameters. <a href="#refsHTTP">[HTTP]</a></p>
+
+ <p>The term <dfn>HTML MIME type</dfn> is used to refer to the <span>MIME type</span>
+ <code>text/html</code>.</p>
+
+ <p>A resource's <dfn>critical subresources</dfn> are those that the resource needs to have
+ available to be correctly processed. Which resources are considered critical or not is defined by
+ the specification that defines the resource's format.</p>
+
+ <p>The term <dfn data-x="data protocol"><code data-x="">data:</code> URL</dfn> refers to <span
+ data-x="URL">URLs</span> that use the <code data-x="">data:</code> scheme. <a
+ href="#refsRFC2397">[RFC2397]</a></p>
+
+
+ <h4>XML</h4>
+
+ <p id="html-namespace">To ease migration from HTML to XHTML, UAs conforming to this specification
+ will place elements in HTML in the <code>http://www.w3.org/1999/xhtml</code> namespace, at least
+ for the purposes of the DOM and CSS. The term "<dfn>HTML elements</dfn>", when used in this
+ specification, refers to any element in that namespace, and thus refers to both HTML and XHTML
+ elements.</p>
+
+ <p>Except where otherwise stated, all elements defined or mentioned in this specification are in
+ the <span>HTML namespace</span> ("<code>http://www.w3.org/1999/xhtml</code>"), and all attributes
+ defined or mentioned in this specification have no namespace.</p>
+
+ <p>The term <dfn>element type</dfn> is used to refer to the set of elements that have a given
+ local name and namespace. For example, <code>button</code> elements are elements with the element
+ type <code>button</code>, meaning they have the local name "<code data-x="">button</code>" and
+ (implicitly as defined above) the <span>HTML namespace</span>.</p>
+
+ <p>Attribute names are said to be <dfn>XML-compatible</dfn> if they match the <a
+ href="http://www.w3.org/TR/xml/#NT-Name"><code data-x="">Name</code></a> production defined in XML
+ and they contain no U+003A COLON characters (:). <a href="#refsXML">[XML]</a></p>
+
+ <p>The term <dfn>XML MIME type</dfn> is used to refer to the <span data-x="MIME type">MIME
+ types</span> <code data-x="">text/xml</code>, <code data-x="">application/xml</code>, and any
+ <span>MIME type</span> whose subtype ends with the four characters "<code data-x="">+xml</code>".
+ <a href="#refsRFC3023">[RFC3023]</a></p>
+
+
+ <h4>DOM trees</h4>
+
+ <p>The <dfn>root element of a <code>Document</code> object</dfn> is that <code>Document</code>'s
+ first element child, if any. If it does not have one then the <code>Document</code> has no root
+ element.</p>
+
+ <p>The term <dfn>root element</dfn>, when not referring to a <code>Document</code> object's root
+ element, means the furthest ancestor element node of whatever node is being discussed, or the node
+ itself if it has no ancestors. When the node is a part of the document, then the node's <span>root
+ element</span> is indeed the document's root element; however, if the node is not currently part
+ of the document tree, the root element will be an orphaned node.</p>
+
+ <p>When an element's <span>root element</span> is the <span>root element of a
+ <code>Document</code> object</span>, it is said to be <dfn>in a <code>Document</code></dfn>. An
+ element is said to have been <dfn data-x="insert an element into a document">inserted into a
+ document</dfn> when its <span>root element</span> changes and is now the document's <span>root
+ element</span>. Analogously, an element is said to have been <dfn data-x="remove an element from a
+ document">removed from a document</dfn> when its <span>root element</span> changes from being the
+ document's <span>root element</span> to being another element.</p>
+
+ <p>A node's <dfn>home subtree</dfn> is the subtree rooted at that node's <span>root
+ element</span>. When a node is <span>in a <code>Document</code></span>, its <span>home
+ subtree</span> is that <code>Document</code>'s tree.</p>
+
+ <p>The <code>Document</code> of a <code>Node</code> (such as an element) is the
+ <code>Document</code> that the <code>Node</code>'s <code
+ data-x="dom-Node-ownerDocument">ownerDocument</code> IDL attribute returns. When a
+ <code>Node</code> is <span>in a <code>Document</code></span> then that <code>Document</code> is
+ always the <code>Node</code>'s <code>Document</code>, and the <code>Node</code>'s <code
+ data-x="dom-Node-ownerDocument">ownerDocument</code> IDL attribute thus always returns that
+ <code>Document</code>.</p>
+
+ <p>The <code>Document</code> of a content attribute is the <code>Document</code> of the
+ attribute's element.</p>
+
+ <p>The term <dfn>tree order</dfn> means a pre-order, depth-first traversal of DOM nodes involved
+ (through the <code data-x="dom-Node-parentNode">parentNode</code>/<code
+ data-x="dom-Node-childNodes">childNodes</code> relationship).</p>
+
+ <p>When it is stated that some element or attribute is <dfn data-x="ignore">ignored</dfn>, or
+ treated as some other value, or handled as if it was something else, this refers only to the
+ processing of the node after it is in the DOM. <span class="nodev">A user agent must not mutate the
+ DOM in such situations.</span></p>
+
+ <p>A content attribute is said to <dfn data-x="">change</dfn> value only if its new value is
+ different than its previous value; setting an attribute to a value it already has does not change
+ it.</p>
+
+ <p>The term <dfn data-x="">empty</dfn>, when used of an attribute value, <code>Text</code> node, or
+ string, means that the length of the text is zero (i.e. not even containing spaces or <span>control
+ characters</span>).</p>
+
+
+ <h4>Scripting</h4>
+
+ <p>The construction "a <code>Foo</code> object", where <code>Foo</code> is actually an interface,
+ is sometimes used instead of the more accurate "an object implementing the interface
+ <code>Foo</code>".</p>
+
+ <p>An IDL attribute is said to be <dfn data-x="">getting</dfn> when its value is being retrieved
+ (e.g. by author script), and is said to be <dfn data-x="">setting</dfn> when a new value is
+ assigned to it.</p>
+
+ <p>If a DOM object is said to be <dfn>live</dfn>, then the attributes and methods on that object
+ <span class="nodev">must</span> operate on the actual underlying data, not a snapshot of the
+ data.</p>
+
+ <p>In the contexts of events, the terms <i>fire</i> and <i>dispatch</i> are used as defined in the
+ DOM specification: <dfn data-x="concept-event-fire">firing</dfn> an event means to create and <span
+ data-x="concept-event-dispatch">dispatch</span> it, and <dfn
+ data-x="concept-event-dispatch">dispatching</dfn> an event means to follow the steps that propagate
+ the event through the tree. The term <dfn data-x="concept-events-trusted">trusted event</dfn> is
+ used to refer to events whose <code data-x="dom-event-isTrusted">isTrusted</code> attribute is
+ initialised to true. <a href="#refsDOM">[DOM]</a></p>
+
+
+ <h4>Plugins</h4>
+
+ <p>The term <dfn>plugin</dfn> refers to a user-agent defined set of content handlers used by the
+ user agent that can take part in the user agent's rendering of a <code>Document</code> object, but
+ that neither act as <span data-x="child browsing context">child browsing contexts</span> of the
+ <code>Document</code> nor introduce any <code>Node</code> objects to the <code>Document</code>'s
+ DOM.</p>
+
+ <p>Typically such content handlers are provided by third parties, though a user agent can also
+ designate built-in content handlers as plugins.</p>
+
+ <div class="nodev">
+
+ <p>A user agent must not consider the types <code>text/plain</code> and
+ <code>application/octet-stream</code> as having a registered <span>plugin</span>.</p> <!-- because
+ of the way <object> elements handles those types, if nothing else (it also doesn't make any sense
+ to have a plugin registered for those types, of course) -->
+
+ </div>
+
+ <p class="example">One example of a plugin would be a PDF viewer that is instantiated in a
+ <span>browsing context</span> when the user navigates to a PDF file. This would count as a plugin
+ regardless of whether the party that implemented the PDF viewer component was the same as that
+ which implemented the user agent itself. However, a PDF viewer application that launches separate
+ from the user agent (as opposed to using the same interface) is not a plugin by this
+ definition.</p>
+
+ <p class="note">This specification does not define a mechanism for interacting with plugins, as it
+ is expected to be user-agent- and platform-specific. Some UAs might opt to support a plugin
+ mechanism such as the Netscape Plugin API; others might use remote content converters or have
+ built-in support for certain types. Indeed, this specification doesn't require user agents to
+ support plugins at all. <a href="#refsNPAPI">[NPAPI]</a></p>
+
+ <p>A plugin can be <dfn data-x="concept-plugin-secure">secured</dfn> if it honors the semantics of
+ the <code data-x="attr-iframe-sandbox">sandbox</code> attribute.</p>
+
+ <p class="example">For example, a secured plugin would prevent its contents from creating pop-up
+ windows when the plugin is instantiated inside a sandboxed <code>iframe</code>.</p>
+
+ <div class="nodev">
+
+ <p class="warning">Browsers should take extreme care when interacting with external content
+ intended for <span data-x="plugin">plugins</span>. When third-party software is run with the same
+ privileges as the user agent itself, vulnerabilities in the third-party software become as
+ dangerous as those in the user agent.</p>
+
+ <p>Since different users having differents sets of <span data-x="plugin">plugins</span> provides a
+ fingerprinting vector that increases the chances of users being uniquely identified, user agents
+ are encouraged to support the exact same set of <span data-x="plugin">plugins</span> for each
+ user.
+ <!--INSERT FINGERPRINT-->
+ </p>
+
+ </div>
+
+
+
+ <h4 id="encoding-terminology">Character encodings</h4>
+
+ <p>A <dfn data-x="encoding">character encoding</dfn>, or just <i>encoding</i> where that is not
+ ambiguous, is a defined way to convert between byte streams and Unicode strings, as defined in the
+ WHATWG Encoding standard. An <span>encoding</span> has an <dfn>encoding name</dfn> and one or more
+ <dfn data-x="encoding label">encoding labels</dfn>, referred to as the encoding's <i>name</i> and
+ <i>labels</i> in the Encoding standard. <a href="#refsENCODING">[ENCODING]</a></p>
+
+ <p>An <dfn>ASCII-compatible character encoding</dfn> is a single-byte or variable-length
+ <span>encoding</span> in which the bytes 0x09, 0x0A, 0x0C, 0x0D, 0x20 - 0x22, 0x26, 0x27, 0x2C -
+ 0x3F, 0x41 - 0x5A, and 0x61 - 0x7A<!-- is that list ok? do any character sets we want to support
+ do things outside that range? -->, ignoring bytes that are the second and later bytes of multibyte
+ sequences, all correspond to single-byte sequences that map to the same Unicode characters as
+ those bytes in Windows-1252<!--ANSI_X3.4-1968 (US-ASCII)-->. <a href="#refsENCODING">[ENCODING]</a></p>
+
+ <p class="note">This includes such encodings as Shift_JIS, HZ-GB-2312, and variants of ISO-2022,
+ even though it is possible in these encodings for bytes like 0x70 to be part of longer sequences
+ that are unrelated to their interpretation as ASCII. It excludes UTF-16 variants, as well as
+ obsolete legacy encodings such as UTF-7, GSM03.38, and EBCDIC variants.</p>
+
+ <!--
+ We'll have to change that if anyone comes up with a way to have a document that is valid as two
+ different encodings at once, with different <meta charset> elements applying in each case.
+ -->
+
+ <p>The term <dfn>a UTF-16 encoding</dfn> refers to any variant of UTF-16: UTF-16LE or UTF-16BE,
+ regardless of the presence or absence of a BOM. <a href="#refsENCODING">[ENCODING]</a></p>
+
+ <p>The term <dfn>code unit</dfn> is used as defined in the Web IDL specification: a 16 bit
+ unsigned integer, the smallest atomic component of a <code>DOMString</code>. (This is a narrower
+ definition than the one used in Unicode, and is not the same as a <i>code point</i>.) <a
+ href="#refsWEBIDL">[WEBIDL]</a></p>
+
+ <p>The term <dfn>Unicode code point</dfn> means a <i data-x="">Unicode scalar value</i> where
+ possible, and an isolated surrogate code point when not. When a conformance requirement is defined
+ in terms of characters or Unicode code points, a pair of <span data-x="code unit">code units</span>
+ consisting of a high surrogate followed by a low surrogate must be treated as the single code
+ point represented by the surrogate pair, but isolated surrogates must each be treated as the
+ single code point with the value of the surrogate. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+ <p>In this specification, the term <dfn>character</dfn>, when not qualified as <em>Unicode</em>
+ character, is synonymous with the term <span>Unicode code point</span>.</p>
+
+ <p>The term <dfn>Unicode character</dfn> is used to mean a <i data-x="">Unicode scalar value</i>
+ (i.e. any Unicode code point that is not a surrogate code point). <a
+ href="#refsUNICODE">[UNICODE]</a></p>
+
+ <p>The <dfn>code-unit length</dfn> of a string is the number of <span data-x="code unit">code
+ units</span> in that string.</p>
+
+ <p class="note">This complexity results from the historical decision to define the DOM API in
+ terms of 16 bit (UTF-16) <span data-x="code unit">code units</span>, rather than in terms of <span
+ data-x="Unicode character">Unicode characters</span>.</p>
+
+
+
+ <div class="nodev">
+
+ <h3>Conformance requirements</h3>
+
+ <p>All diagrams, examples, and notes in this specification are non-normative, as are all sections
+ explicitly marked non-normative. Everything else in this specification is normative.</p>
+
+ <p>The key words "MUST", "MUST NOT", <!--"REQUIRED",--> <!--"SHALL", "SHALL NOT",--> "SHOULD", "SHOULD
+ NOT", <!--"RECOMMENDED", "NOT RECOMMENDED",--> "MAY", and "OPTIONAL" in the normative parts of
+ this document are to be interpreted as described in RFC2119. The key word "OPTIONALLY" in the
+ normative parts of this document is to be interpreted with the same normative meaning as "MAY" and
+ "OPTIONAL". For readability, these words do not appear in all uppercase letters in this
+ specification. <a href="#refsRFC2119">[RFC2119]</a></p>
+
+ <p>Requirements phrased in the imperative as part of algorithms (such as "strip any leading space
+ characters" or "return false and abort these steps") are to be interpreted with the meaning of the
+ key word ("must", "should", "may", etc) used in introducing the algorithm.</p>
+
+ <div class="example">
+
+ <p>For example, were the spec to say:</p>
+
+ <pre>To eat an orange, the user must:
+1. Peel the orange.
+2. Separate each slice of the orange.
+3. Eat the orange slices.</pre>
+
+ <p>...it would be equivalent to the following:</p>
+
+ <pre>To eat an orange:
+1. The user must peel the orange.
+2. The user must separate each slice of the orange.
+3. The user must eat the orange slices.</pre>
+
+ <p>Here the key word is "must".</p>
+
+ <p>The former (imperative) style is generally preferred in this specification for stylistic
+ reasons.</p>
+
+ </div>
+
+ <p>Conformance requirements phrased as algorithms or specific steps may be implemented in any
+ manner, so long as the end result is equivalent. (In particular, the algorithms defined in this
+ specification are intended to be easy to follow, and not intended to be performant.)</p>
+
+ </div>
+
+
+
+ <div class="nodev">
+
+ <h4>Conformance classes</h4>
+
+ <p>This specification describes the conformance criteria for <span class="nodev">user agents
+ (relevant to implementors) and</span> documents<span class="nodev"> (relevant to authors and
+ authoring tool implementors)</span>.</p>
+
+ <p><dfn>Conforming documents</dfn> are those that comply with all the conformance criteria for
+ documents. For readability, some of these conformance requirements are phrased as conformance
+ requirements on authors; such requirements are implicitly requirements on documents: by
+ definition, all documents are assumed to have had an author. (In some cases, that author may
+ itself be a user agent &mdash; such user agents are subject to additional rules, as explained
+ below.)</p>
+
+ <p class="example">For example, if a requirement states that "authors must not use the <code
+ data-x="">foobar</code> element", it would imply that documents are not allowed to contain elements
+ named <code data-x="">foobar</code>.</p>
+
+ <p class="note impl">There is no implied relationship between document conformance requirements
+ and implementation conformance requirements. User agents are not free to handle non-conformant
+ documents as they please; the processing model described in this specification applies to
+ implementations regardless of the conformity of the input documents.</p>
+
+ <p>User agents fall into several (overlapping) categories with different conformance
+ requirements.</p>
+
+ <dl>
+
+ <dt id="interactive">Web browsers and other interactive user agents</dt>
+
+ <dd>
+
+ <p>Web browsers that support <span>the XHTML syntax</span> must process elements and attributes
+ from the <span>HTML namespace</span> found in XML documents as described in this specification,
+ so that users can interact with them, unless the semantics of those elements have been
+ overridden by other specifications.</p>
+
+ <p class="example">A conforming XHTML processor would, upon finding an XHTML <code>script</code>
+ element in an XML document, execute the script contained in that element. However, if the
+ element is found within a transformation expressed in XSLT (assuming the user agent also
+ supports XSLT), then the processor would instead treat the <code>script</code> element as an
+ opaque element that forms part of the transform.</p>
+
+ <p>Web browsers that support <span>the HTML syntax</span> must process documents labeled with an
+ <span>HTML MIME type</span> as described in this specification, so that users can interact with
+ them.</p>
+
+ <p>User agents that support scripting must also be conforming implementations of the IDL
+ fragments in this specification, as described in the Web IDL specification. <a
+ href="#refsWEBIDL">[WEBIDL]</a></p>
+
+ <p class="note">Unless explicitly stated, specifications that override the semantics of HTML
+ elements do not override the requirements on DOM objects representing those elements. For
+ example, the <code>script</code> element in the example above would still implement the
+ <code>HTMLScriptElement</code> interface.</p>
+
+ </dd>
+
+ <dt id="non-interactive">Non-interactive presentation user agents</dt>
+
+ <dd>
+
+ <p>User agents that process HTML and XHTML documents purely to render non-interactive versions
+ of them must comply to the same conformance criteria as Web browsers, except that they are
+ exempt from requirements regarding user interaction.</p>
+
+ <p class="note">Typical examples of non-interactive presentation user agents are printers
+ (static UAs) and overhead displays (dynamic UAs). It is expected that most static
+ non-interactive presentation user agents will also opt to <a href="#non-scripted">lack scripting
+ support</a>.</p>
+
+ <p class="example">A non-interactive but dynamic presentation UA would still execute scripts,
+ allowing forms to be dynamically submitted, and so forth. However, since the concept of "focus"
+ is irrelevant when the user cannot interact with the document, the UA would not need to support
+ any of the focus-related DOM APIs.</p>
+
+ </dd>
+
+ <dt id="renderingUA">Visual user agents that support the suggested default rendering</dt>
+
+ <dd>
+
+ <p>User agents, whether interactive or not, may be designated (possibly as a user option) as
+ supporting the suggested default rendering defined by this specification.</p>
+
+ <p>This is not required. In particular, even user agents that do implement the suggested default
+ rendering are encouraged to offer settings that override this default to improve the experience
+ for the user, e.g. changing the colour contrast, using different focus styles, or otherwise
+ making the experience more accessible and usable to the user.</p>
+
+ <p>User agents that are designated as supporting the suggested default rendering must, while so
+ designated, implement the rules in <a href="#rendering">the rendering section</a> that that
+ section defines as the behavior that user agents are <em>expected</em> to implement.</p>
+
+ </dd>
+
+ <dt id="non-scripted">User agents with no scripting support</dt>
+
+ <dd>
+
+ <p>Implementations that do not support scripting (or which have their scripting features
+ disabled entirely) are exempt from supporting the events and DOM interfaces mentioned in this
+ specification. For the parts of this specification that are defined in terms of an events model
+ or in terms of the DOM, such user agents must still act as if events and the DOM were
+ supported.</p>
+
+ <p class="note">Scripting can form an integral part of an application. Web browsers that do not
+ support scripting, or that have scripting disabled, might be unable to fully convey the author's
+ intent.</p>
+
+ </dd>
+
+
+ <dt>Conformance checkers</dt>
+
+ <dd id="conformance-checkers">
+
+ <p>Conformance checkers must verify that a document conforms to the applicable conformance
+ criteria described in this specification. Automated conformance checkers are exempt from
+ detecting errors that require interpretation of the author's intent (for example, while a
+ document is non-conforming if the content of a <code>blockquote</code> element is not a quote,
+ conformance checkers running without the input of human judgement do not have to check that
+ <code>blockquote</code> elements only contain quoted material).</p>
+
+ <p>Conformance checkers must check that the input document conforms when parsed without a
+ <span>browsing context</span> (meaning that no scripts are run, and that the parser's
+ <span>scripting flag</span> is disabled), and should also check that the input document conforms
+ when parsed with a <span>browsing context</span> in which scripts execute, and that the scripts
+ never cause non-conforming states to occur other than transiently during script execution
+ itself. (This is only a "SHOULD" and not a "MUST" requirement because it has been proven to be
+ impossible. <a href="#refsCOMPUTABLE">[COMPUTABLE]</a>)</p>
+
+ <p>The term "HTML validator" can be used to refer to a conformance checker that itself conforms
+ to the applicable requirements of this specification.</p>
+
+ <div class="note">
+
+ <p>XML DTDs cannot express all the conformance requirements of this specification. Therefore, a
+ validating XML processor and a DTD cannot constitute a conformance checker. Also, since neither
+ of the two authoring formats defined in this specification are applications of SGML, a
+ validating SGML system cannot constitute a conformance checker either.</p>
+
+ <p>To put it another way, there are three types of conformance criteria:</p>
+
+ <ol>
+
+ <li>Criteria that can be expressed in a DTD.</li>
+
+ <li>Criteria that cannot be expressed by a DTD, but can still be checked by a machine.</li>
+
+ <li>Criteria that can only be checked by a human.</li>
+
+ </ol>
+
+ <p>A conformance checker must check for the first two. A simple DTD-based validator only checks
+ for the first class of errors and is therefore not a conforming conformance checker according
+ to this specification.</p>
+
+ </div>
+ </dd>
+
+
+ <dt>Data mining tools</dt>
+
+ <dd id="data-mining">
+
+ <p>Applications and tools that process HTML and XHTML documents for reasons other than to either
+ render the documents or check them for conformance should act in accordance with the semantics
+ of the documents that they process.</p>
+
+ <p class="example">A tool that generates <span data-x="outline">document outlines</span> but
+ increases the nesting level for each paragraph and does not increase the nesting level for each
+ section would not be conforming.</p>
+
+ </dd>
+
+
+ <dt id="editors">Authoring tools and markup generators</dt>
+
+ <dd>
+
+ <p>Authoring tools and markup generators must generate <span>conforming documents</span>.
+ Conformance criteria that apply to authors also apply to authoring tools, where appropriate.</p>
+
+ <p>Authoring tools are exempt from the strict requirements of using elements only for their
+ specified purpose, but only to the extent that authoring tools are not yet able to determine
+ author intent. However, authoring tools must not automatically misuse elements or encourage
+ their users to do so.</p>
+
+ <p class="example">For example, it is not conforming to use an <code>address</code> element for
+ arbitrary contact information; that element can only be used for marking up contact information
+ for the author of the document or section. However, since an authoring tool is likely unable to
+ determine the difference, an authoring tool is exempt from that requirement. This does not mean,
+ though, that authoring tools can use <code>address</code> elements for any block of italics text
+ (for instance); it just means that the authoring tool doesn't have to verify that when the user
+ uses a tool for inserting contact information for a section, that the user really is doing that
+ and not inserting something else instead.</p>
+
+ <p class="note">In terms of conformance checking, an editor has to output documents that conform
+ to the same extent that a conformance checker will verify.</p>
+
+ <p>When an authoring tool is used to edit a non-conforming document, it may preserve the
+ conformance errors in sections of the document that were not edited during the editing session
+ (i.e. an editing tool is allowed to round-trip erroneous content). However, an authoring tool
+ must not claim that the output is conformant if errors have been so preserved.</p>
+
+ <p>Authoring tools are expected to come in two broad varieties: tools that work from structure
+ or semantic data, and tools that work on a What-You-See-Is-What-You-Get media-specific editing
+ basis (WYSIWYG).</p>
+
+ <p>The former is the preferred mechanism for tools that author HTML, since the structure in the
+ source information can be used to make informed choices regarding which HTML elements and
+ attributes are most appropriate.</p>
+
+ <p>However, WYSIWYG tools are legitimate. WYSIWYG tools should use elements they know are
+ appropriate, and should not use elements that they do not know to be appropriate. This might in
+ certain extreme cases mean limiting the use of flow elements to just a few elements, like
+ <code>div</code>, <code>b</code>, <code>i</code>, and <code>span</code> and making liberal use
+ of the <code data-x="attr-style">style</code> attribute.</p>
+
+ <p>All authoring tools, whether WYSIWYG or not, should make a best effort attempt at enabling
+ users to create well-structured, semantically rich, media-independent content.</p>
+
+ </dd>
+
+ </dl>
+
+ <p id="hardwareLimitations">User agents may impose implementation-specific limits on otherwise
+ unconstrained inputs, e.g. to prevent denial of service attacks, to guard against running out of
+ memory, or to work around platform-specific limitations.
+ <!--INSERT FINGERPRINT-->
+ </p>
+
+ <p>For compatibility with existing content and prior specifications, this specification describes
+ two authoring formats: one based on XML (referred to as <span>the XHTML syntax</span>), and one
+ using a <a href="#writing">custom format</a> inspired by SGML (referred to as <span>the HTML
+ syntax</span>). Implementations must support at least one of these two formats, although
+ supporting both is encouraged.</p>
+
+ <p>Some conformance requirements are phrased as requirements on elements, attributes, methods or
+ objects. Such requirements fall into two categories: those describing content model restrictions,
+ and those describing implementation behavior. Those in the former category are requirements on
+ documents and authoring tools. Those in the second category are requirements on user agents.
+ Similarly, some conformance requirements are phrased as requirements on authors; such requirements
+ are to be interpreted as conformance requirements on the documents that authors produce. (In other
+ words, this specification does not distinguish between conformance criteria on authors and
+ conformance criteria on documents.)</p>
+
+ </div>
+
+
+ <div class="nodev">
+
+ <h4>Dependencies</h4>
+
+ <p>This specification relies on several other underlying specifications.</p>
+
+ <dl>
+
+ <dt>Unicode and Encoding</dt>
+
+ <dd>
+
+ <p>The Unicode character set is used to represent textual data, and the WHATWG Encoding standard
+ defines requirements around <span data-x="encoding">character encodings</span>. <a
+ href="#refsUNICODE">[UNICODE]</a></p>
+
+ <p class="note">This specification <a href="#encoding-terminology">introduces terminology</a>
+ based on the terms defined in those specifications, as described earlier.</p>
+
+ <p>The following terms are used as defined in the WHATWG Encoding standard: <a
+ href="#refsENCODING">[ENCODING]</a></p>
+
+ <ul class="brief">
+
+ <li><dfn>Getting an encoding</dfn>
+
+ <li>The <dfn>encoder</dfn> and <dfn>decoder</dfn> algorithms for various encodings, including
+ the <dfn>UTF-8 encoder</dfn> and <dfn>UTF-8 decoder</dfn>
+
+ <li>The generic <dfn>decode</dfn> algorithm which takes a byte stream and an encoding and
+ returns a character stream
+
+ <li>The <dfn>UTF-8 decode</dfn> algorithm which takes a byte stream and returns a character
+ stream, additionally stripping one leading UTF-8 Byte Order Mark (BOM), if any
+
+ </ul>
+
+ <p class="note">The <span>UTF-8 decoder</span> is distinct from the <i>UTF-8 decode
+ algorithm</i>. The latter first strips a Byte Order Mark (BOM), if any, and then invokes the
+ former.</p>
+
+ <p>For readability, character encodings are sometimes referenced in this specification with a
+ case that differs from the canonical case given in the WHATWG Encoding standard. (For example,
+ "UTF-16LE" instead of "utf-16le".)</p>
+
+ </dd>
+
+
+ <dt>XML</dt>
+
+ <dd>
+
+ <p>Implementations that support <span>the XHTML syntax</span> must support some version of XML,
+ as well as its corresponding namespaces specification, because that syntax uses an XML
+ serialisation with namespaces. <a href="#refsXML">[XML]</a> <a href="#refsXMLNS">[XMLNS]</a></p>
+
+ </dd>
+
+
+ <dt>URLs</dt>
+
+ <dd>
+
+ <p>The following terms are defined in the WHATWG URL standard: <a href="#refsURL">[URL]</a></p>
+
+ <ul class="brief">
+ <li><dfn>URL</dfn>
+ <li><dfn>Absolute URL</dfn>
+ <li><dfn>Relative URL</dfn>
+ <li><dfn data-x="concept-url-scheme-relative">Relative schemes</dfn>
+ <li>The <dfn>URL parser</dfn>
+ <li><dfn>Parsed URL</dfn>
+ <li>The <dfn data-x="concept-url-scheme">scheme</dfn> component of a <span>parsed URL</span>
+ <li>The <dfn data-x="concept-url-scheme-data">scheme data</dfn> component of a <span>parsed URL</span>
+ <li>The <dfn data-x="concept-url-username">username</dfn> component of a <span>parsed URL</span>
+ <li>The <dfn data-x="concept-url-password">password</dfn> component of a <span>parsed URL</span>
+ <li>The <dfn data-x="concept-url-host">host</dfn> component of a <span>parsed URL</span>
+ <li>The <dfn data-x="concept-url-port">port</dfn> component of a <span>parsed URL</span>
+ <li>The <dfn data-x="concept-url-path">path</dfn> component of a <span>parsed URL</span>
+ <li>The <dfn data-x="concept-url-query">query</dfn> component of a <span>parsed URL</span>
+ <li>The <dfn data-x="concept-url-fragment">fragment</dfn> component of a <span>parsed URL</span>
+ <li><dfn data-x="concept-url-parse-error">Parse errors</dfn> from the <span>URL parser</span>
+ <li>The <dfn data-x="concept-url-serializer">URL serializer</dfn>
+ <li><dfn>Default encode set</dfn>
+ <li><dfn>Percent encode</dfn>
+ <li><dfn>UTF-8 percent encode</dfn>
+ <li><dfn>Percent decode</dfn>
+ <li><dfn>Decoder error</dfn>
+ <li>The <dfn>domain label to ASCII</dfn> algorithm</li>
+ <li>The <dfn>domain label to Unicode</dfn> algorithm</li>
+ <li><dfn><code>URLUtils</code></dfn> interface
+ <li><dfn><code>URLUtilsReadOnly</code></dfn> interface
+ <li><dfn data-x="dom-url-href"><code>href</code> attribute</dfn>
+ <li><dfn data-x="dom-url-protocol"><code>protocol</code> attribute</dfn>
+ <li>The <dfn data-x="concept-uu-get-the-base">get the base</dfn> hook for <code>URLUtils</code>
+ <li>The <dfn data-x="concept-uu-update">update steps</dfn> hook for <code>URLUtils</code>
+ <li>The <dfn data-x="concept-uu-set-the-input">set the input</dfn> algorithm for <code>URLUtils</code>
+ <li>The <dfn data-x="concept-uu-query-encoding">query encoding</dfn> of an <code>URLUtils</code> object
+ <li>The <dfn data-x="concept-uu-input">input</dfn> of an <code>URLUtils</code> object
+ <li>The <dfn data-x="concept-uu-url">url</dfn> of an <code>URLUtils</code> object
+ </ul>
+
+ </dd>
+
+
+ <dt>Cookies</dt>
+
+ <dd>
+
+ <p>The following terms are defined in the Cookie specification: <a
+ href="#refsCOOKIES">[COOKIES]</a></p>
+
+ <ul class="brief">
+ <li><dfn>cookie-string</dfn>
+ <li><dfn>receives a set-cookie-string</dfn>
+ </ul>
+
+ </dd>
+
+
+ <dt>Fetch</dt>
+
+ <dd>
+
+ <p>The following terms are defined in the WHATWG Fetch specification: <a href="#refsFETCH">[FETCH]</a></p>
+
+ <ul class="brief">
+ <li><dfn>cross-origin request</dfn>
+ <li><dfn>cross-origin request status</dfn>
+ <li><dfn>custom request headers</dfn>
+ <li><dfn>simple cross-origin request</dfn>
+ <li><dfn>redirect steps</dfn>
+ <li><dfn>omit credentials flag</dfn>
+ <li><dfn>resource sharing check</dfn>
+ </ul>
+
+ <p class="note">This specification does not yet use the "fetch" algorithm from the WHATWG Fetch
+ specification. It will be updated to do so in due course.</p>
+
+ </dd>
+
+
+<!--TOPIC:DOM APIs-->
+
+ <dt>Web IDL</dt>
+
+ <dd>
+
+ <p>The IDL fragments in this specification must be interpreted as required for conforming IDL
+ fragments, as described in the Web IDL specification. <a href="#refsWEBIDL">[WEBIDL]</a></p>
+
+ <p>The terms <dfn>supported property indices</dfn>, <dfn>determine the value of an indexed
+ property</dfn>, <dfn>support named properties</dfn>, <dfn>supported property names</dfn>,
+ <dfn>unenumerable</dfn>, <dfn>determine the value of a named property</dfn>, <dfn>platform array
+ objects</dfn>, and <dfn data-x="dfn-read-only-array">read only</dfn> (when applied to arrays)
+ are used as defined in the Web IDL specification. The algorithm to <dfn>convert a DOMString to a
+ sequence of Unicode characters</dfn> is similarly that defined in the Web IDL specification.</p>
+
+ <p>When this specification requires a user agent to <dfn>create a <code>Date</code> object</dfn>
+ representing a particular time (which could be the special value Not-a-Number), the milliseconds
+ component of that time, if any, must be truncated to an integer, and the time value of the newly
+ created <code>Date</code> object must represent the resulting truncated time.</p>
+
+ <p class="example">For instance, given the time 23045 millionths of a second after 01:00 UTC on
+ January 1st 2000, i.e. the time 2000-01-01T00:00:00.023045Z, then the <code>Date</code> object
+ created representing that time would represent the same time as that created representing the
+ time 2000-01-01T00:00:00.023Z, 45 millionths earlier. If the given time is NaN, then the result
+ is a <code>Date</code> object that represents a time value NaN (indicating that the object does
+ not represent a specific instant of time).</p>
+
+ </dd>
+
+
+ <dt>JavaScript</dt>
+
+ <dd>
+
+ <p>Some parts of the language described by this specification only support JavaScript as the
+ underlying scripting language. <a href="#refsECMA262">[ECMA262]</a></p>
+
+ <p class="note">The term "JavaScript" is used to refer to ECMA262, rather than the official term
+ ECMAScript, since the term JavaScript is more widely known. Similarly, the <span>MIME
+ type</span> used to refer to JavaScript in this specification is <code
+ data-x="">text/javascript</code>, since that is the most commonly used type, <span data-x="willful
+ violation">despite it being an officially obsoleted type</span> according to RFC 4329. <a
+ href="#refsRFC4329">[RFC4329]</a></p>
+
+ <p>The term <dfn>JavaScript global environment</dfn> refers to the <i data-x="">global
+ environment</i> concept defined in the ECMAScript specification.</p>
+
+ <p>The ECMAScript <dfn data-x="js-SyntaxError"><code>SyntaxError</code></dfn> exception is also
+ defined in the ECMAScript specification. <a href="#refsECMA262">[ECMA262]</a></p>
+
+ <p>The <dfn>ArrayBuffer</dfn> and related object types and underlying concepts from the
+ ECMAScript Specification are used for several features in this specification. <a
+ href="#refsECMA262">[ECMA262]</a></p>
+
+ <p>The following helper IDL is used for referring to <code>ArrayBuffer</code>-related types:</p>
+
+ <pre class="idl">typedef (<dfn>Int8Array</dfn> or <dfn>Uint8Array</dfn> or <dfn>Uint8ClampedArray</dfn> or
+ <dfn>Int16Array</dfn> or <dfn>Uint16Array</dfn> or
+ <dfn>Int32Array</dfn> or <dfn>Uint32Array</dfn> or
+ <dfn>Float32Array</dfn> or <dfn>Float64Array</dfn> or
+ <dfn>DataView</dfn>) <dfn>ArrayBufferView</dfn>;</pre>
+
+ <p class="note">In particular, the <code>Uint8ClampedArray</code> type is used by some <span
+ data-x="ImageData">2D canvas APIs</span>, and the <a href="#network"><code>WebSocket</code>
+ API</a> uses <code>ArrayBuffer</code> objects for handling binary frames.</p>
+
+ </dd>
+
+
+ <dt>DOM</dt>
+
+ <dd>
+
+ <p>The Document Object Model (DOM) is a representation &mdash; a model &mdash; of a document and
+ its content. The DOM is not just an API; the conformance criteria of HTML implementations are
+ defined, in this specification, in terms of operations on the DOM. <a
+ href="#refsDOM">[DOM]</a></p>
+
+ <p>Implementations must support DOM and the events defined in DOM Events, because this
+ specification is defined in terms of the DOM, and some of the features are defined as extensions
+ to the DOM interfaces. <a href="#refsDOM">[DOM]</a> <a href="#refsDOMEVENTS">[DOMEVENTS]</a></p>
+
+ <p>In particular, the following features are defined in the DOM specification: <a
+ href="#refsDOM">[DOM]</a></p> <!-- aka DOM Core or DOMCORE -->
+
+ <ul class="brief">
+
+ <li><dfn><code>Attr</code></dfn> interface</li>
+ <li><dfn><code>Comment</code></dfn> interface</li>
+ <li><dfn><code>DOMImplementation</code></dfn> interface</li>
+ <li><dfn data-x="DOM Document"><code>Document</code></dfn> interface</li>
+ <li><dfn><code>XMLDocument</code></dfn> interface</li>
+ <li><dfn><code>DocumentFragment</code></dfn> interface</li>
+ <li><dfn><code>DocumentType</code></dfn> interface</li>
+ <li><dfn><code>DOMException</code></dfn> interface</li>
+ <li><dfn><code>ChildNode</code></dfn> interface</li>
+ <li><dfn><code>Element</code></dfn> interface</li>
+ <li><dfn><code>Node</code></dfn> interface</li>
+ <li><dfn><code>NodeList</code></dfn> interface</li>
+ <li><dfn><code>ProcessingInstruction</code></dfn> interface</li>
+ <li><dfn><code>Text</code></dfn> interface</li>
+
+ <li><dfn><code>HTMLCollection</code></dfn> interface</li>
+ <li><dfn data-x="dom-HTMLCollection-item"><code>item()</code></dfn> method</li>
+ <li>The terms <dfn>collections</dfn> and <dfn>represented by the collection</dfn></li>
+
+ <li><dfn><code>DOMTokenList</code></dfn> interface</li>
+ <li><dfn><code>DOMSettableTokenList</code></dfn> interface</li>
+
+ <li><dfn data-x="dom-DOMImplementation-createDocument"><code>createDocument()</code></dfn> method</li>
+ <li><dfn data-x="dom-DOMImplementation-createHTMLDocument"><code>createHTMLDocument()</code></dfn> method</li>
+ <li><dfn data-x="dom-Document-createElement"><code>createElement()</code></dfn> method</li>
+ <li><dfn data-x="dom-Document-createElementNS"><code>createElementNS()</code></dfn> method</li>
+ <li><dfn data-x="dom-Document-getElementById"><code>getElementById()</code></dfn> method</li>
+ <li><dfn data-x="dom-Node-insertBefore"><code>insertBefore()</code></dfn> method</li>
+
+ <li><dfn data-x="dom-Node-ownerDocument"><code>ownerDocument</code></dfn> attribute</li>
+ <li><dfn data-x="dom-Node-childNodes"><code>childNodes</code></dfn> attribute</li>
+ <li><dfn data-x="dom-Node-localName"><code>localName</code></dfn> attribute</li>
+ <li><dfn data-x="dom-Node-parentNode"><code>parentNode</code></dfn> attribute</li>
+ <li><dfn data-x="dom-Node-namespaceURI"><code>namespaceURI</code></dfn> attribute</li>
+ <li><dfn data-x="dom-Element-tagName"><code>tagName</code></dfn> attribute</li>
+ <li><dfn data-x="dom-Element-id"><code>id</code></dfn> attribute</li>
+ <li><dfn><code>textContent</code></dfn> attribute</li>
+
+ <li>The <dfn data-x="concept-node-insert">insert</dfn>, <dfn data-x="concept-node-append">append</dfn>, <dfn data-x="concept-node-remove">remove</dfn>, <dfn data-x="concept-node-replace">replace</dfn>, and <dfn data-x="concept-node-adopt">adopt</dfn> algorithms for nodes</li>
+ <li>The <dfn>nodes are inserted</dfn> and <dfn>nodes are removed</dfn> concepts</li>
+ <li>An element's <dfn data-x="concept-node-adopt-ext">adopting steps</dfn></li>
+ <li>The <dfn>attribute list</dfn> concept.</li>
+ <li>The <dfn data-x="concept-cd-data">data</dfn> of a text node.</li>
+
+ <li><dfn><code>Event</code></dfn> interface</li>
+ <li><dfn><code>EventTarget</code></dfn> interface</li>
+ <li><dfn><code>EventInit</code></dfn> dictionary type</li>
+ <li><dfn data-x="dom-Event-target"><code>target</code></dfn> attribute</li>
+ <li><dfn data-x="dom-Event-isTrusted"><code>isTrusted</code></dfn> attribute</li>
+ <li>The <dfn data-x="concept-event-type">type</dfn> of an event</li>
+ <li>The concept of an <dfn data-x=concept-event-listener>event listener</dfn> and the <span data-x=concept-event-listener>event listeners</span> associated with an <code>EventTarget</code></li>
+ <li>The concept of a <dfn>target override</dfn></li>
+ <li>The concept of a regular <dfn>event parent</dfn> and a <dfn>cross-boundary event parent</dfn></li> <!-- see bug 18780 -->
+
+ <li>The <dfn data-x="document's character encoding">encoding</dfn> (herein the <i>character encoding</i>) and <dfn data-x="concept-document-content-type">content type</dfn> of a <code>Document</code></li>
+ <li>The distinction between <dfn>XML documents</dfn> and <dfn>HTML documents</dfn></li>
+ <li>The terms <dfn>quirks mode</dfn>, <dfn>limited-quirks mode</dfn>, and <dfn>no-quirks mode</dfn></li>
+ <li>The algorithm to <dfn data-x="concept-node-clone">clone</dfn> a <code>Node</code>, and the concept of <dfn data-x="concept-node-clone-ext">cloning steps</dfn> used by that algorithm</li>
+ <li>The concept of <dfn>base URL change steps</dfn> and the definition of what happens when an element is <dfn>affected by a base URL change</dfn></li>
+ <li>The concept of an element's <dfn data-x="concept-id">unique identifier (ID)</dfn></li>
+
+ <li>The concept of a DOM <dfn data-x="concept-range">range</dfn>, and the terms <dfn data-x="concept-range-start">start</dfn>, <dfn data-x="concept-range-end">end</dfn>, and <dfn data-x="concept-range-bp">boundary point</dfn> as applied to ranges.</li>
+
+ <li><dfn><code>MutationObserver</code></dfn> interface</li>
+ <li>The <dfn data-x="concept-mo-invoke">invoke <code>MutationObserver</code> objects</dfn> algorithm</li>
+
+ <li><dfn>Promise</dfn> interface</li>
+ <li>The <dfn data-x="concept-resolver">resolver</dfn> concept</li>
+ <li>The <dfn data-x="concept-resolver-fulfill">fulfill</dfn> and <dfn data-x="concept-resolver-reject">reject</dfn> algorithms</li>
+
+ </ul>
+
+ <p>The term <dfn>throw</dfn> in this specification is used as defined in the DOM specification.
+ The following <code>DOMException</code> types are defined in the DOM specification: <a
+ href="#refsDOM">[DOM]</a></p>
+
+ <ol class="brief">
+ <li value="1"><dfn><code>IndexSizeError</code></dfn></li>
+ <li value="3"><dfn><code>HierarchyRequestError</code></dfn></li>
+ <li value="4"><dfn><code>WrongDocumentError</code></dfn></li>
+ <li value="5"><dfn><code>InvalidCharacterError</code></dfn></li>
+ <li value="7"><dfn><code>NoModificationAllowedError</code></dfn></li>
+ <li value="8"><dfn><code>NotFoundError</code></dfn></li>
+ <li value="9"><dfn><code>NotSupportedError</code></dfn></li>
+ <li value="11"><dfn><code>InvalidStateError</code></dfn></li>
+ <li value="12"><dfn><code>SyntaxError</code></dfn></li>
+ <li value="13"><dfn><code>InvalidModificationError</code></dfn></li>
+ <li value="14"><dfn><code>NamespaceError</code></dfn></li>
+ <li value="15"><dfn><code>InvalidAccessError</code></dfn></li>
+ <li value="18"><dfn><code>SecurityError</code></dfn></li>
+ <li value="19"><dfn><code>NetworkError</code></dfn></li>
+ <li value="20"><dfn><code>AbortError</code></dfn></li>
+ <li value="21"><dfn><code>URLMismatchError</code></dfn></li>
+ <li value="22"><dfn><code>QuotaExceededError</code></dfn></li>
+ <li value="23"><dfn><code>TimeoutError</code></dfn></li>
+ <li value="24"><dfn><code>InvalidNodeTypeError</code></dfn></li>
+ <li value="25"><dfn><code>DataCloneError</code></dfn></li>
+ </ol>
+
+ <p class="example">For example, to <i>throw a <code>TimeoutError</code> exception</i>, a user
+ agent would construct a <code>DOMException</code> object whose type was the string "<code
+ data-x="">TimeoutError</code>" (and whose code was the number 23, for legacy reasons) and
+ actually throw that object as an exception.</p>
+
+ <p>The following features are defined in the DOM Events specification: <a
+ href="#refsDOMEVENTS">[DOMEVENTS]</a></p>
+
+ <ul class="brief">
+
+ <li><dfn><code>MouseEvent</code></dfn> interface</li>
+ <li><dfn><code>MouseEventInit</code></dfn> dictionary type</li>
+
+ <li>The <dfn><code>FocusEvent</code></dfn> interface and its <dfn data-x="dom-FocusEvent-relatedTarget"><code>relatedTarget</code></dfn> attribute</li>
+
+ <li>The <dfn><code>UIEvent</code></dfn> interface's <dfn data-x="dom-UIEvent-detail"><code>detail</code></dfn> attribute</li>
+
+ <li><dfn data-x="event-click"><code>click</code></dfn> event</li>
+ <li><dfn data-x="event-dblclick"><code>dblclick</code></dfn> event</li>
+ <li><dfn data-x="event-mousedown"><code>mousedown</code></dfn> event</li>
+ <li><dfn data-x="event-mouseenter"><code>mouseenter</code></dfn> event</li>
+ <li><dfn data-x="event-mouseleave"><code>mouseleave</code></dfn> event</li>
+ <li><dfn data-x="event-mousemove"><code>mousemove</code></dfn> event</li>
+ <li><dfn data-x="event-mouseout"><code>mouseout</code></dfn> event</li>
+ <li><dfn data-x="event-mouseover"><code>mouseover</code></dfn> event</li>
+ <li><dfn data-x="event-mouseup"><code>mouseup</code></dfn> event</li>
+ <li><dfn data-x="event-mousewheel"><code>mousewheel</code></dfn> event</li>
+
+ <li><dfn data-x="event-keydown"><code>keydown</code></dfn> event</li>
+ <li><dfn data-x="event-keyup"><code>keyup</code></dfn> event</li>
+ <li><dfn data-x="event-keypress"><code>keypress</code></dfn> event</li>
+
+ </ul>
+
+ <p>The following features are defined in the Touch Events specification: <a
+ href="#refsTOUCH">[TOUCH]</a></p>
+
+ <ul class="brief">
+
+ <li><dfn><code>Touch</code></dfn> interface</li>
+
+ <li><dfn>Touch point</dfn> concept</li>
+
+ </ul>
+
+ <p>This specification sometimes uses the term <dfn data-x="">name</dfn> to refer to the event's
+ <code data-x="dom-event-type">type</code>; as in, "an event named <code data-x="">click</code>"
+ or "if the event name is <code data-x="">keypress</code>". The terms "name" and "type" for
+ events are synonymous.</p>
+
+ <p>The following features are defined in the DOM Parsing and Serialisation specification: <a
+ href="#refsDOMPARSING">[DOMPARSING]</a></p>
+
+ <ul class="brief">
+ <li><dfn data-x="dom-innerHTML"><code>innerHTML</code></dfn></li>
+ <li><dfn data-x="dom-outerHTML"><code>outerHTML</code></dfn></li>
+ </ul>
+
+ <p class="note">User agents are also encouraged to implement the features described in the
+ <cite>HTML Editing APIs</cite> and <cite><code>UndoManager</code> and DOM Transaction</cite>
+ specifications.
+ <a href="#refsEDITING">[EDITING]</a>
+ <a href="#refsUNDO">[UNDO]</a>
+ </p>
+
+ <p>The following parts of the Fullscreen specification are referenced from this specification,
+ in part to define the rendering of <code>dialog</code> elements, and also to define how the
+ Fullscreen API interacts with the sandboxing features in HTML: <a
+ href="#refsFULLSCREEN">[FULLSCREEN]</a></p>
+
+ <ul class="brief">
+ <li>The <dfn>top layer</dfn> concept</li>
+ <li><dfn data-x="dom-element-requestFullscreen"><code>requestFullscreen()</code></dfn>
+ <li>The <dfn>fullscreen enabled flag</dfn></li>
+ <li>The <dfn>fully exit fullscreen</dfn> algorithm</li>
+ </ul>
+
+ </dd>
+
+
+
+ <dt>File API</dt>
+
+ <dd>
+
+ <p>This specification uses the following features defined in the File API specification: <a
+ href="#refsFILEAPI">[FILEAPI]</a></p>
+
+ <ul class="brief">
+
+ <li><dfn><code>Blob</code></dfn></li>
+ <li><dfn><code>File</code></dfn></li>
+ <li><dfn><code>FileList</code></dfn></li>
+ <li><dfn data-x="dom-Blob-close"><code>Blob.close()</code></dfn></li>
+ <li><dfn data-x="dom-Blob-type"><code>Blob.type</code></dfn></li>
+ <li>The concept of <dfn data-x="file-error-read">read errors</dfn></li>
+ </ul>
+
+ </dd>
+
+
+ <dt>XMLHttpRequest</dt>
+
+ <dd>
+
+ <p>This specification references the XMLHttpRequest specification to describe how the two
+ specifications interact and to use its <code>ProgressEvent</code> features. The following
+ features and terms are defined in the XMLHttpRequest specification: <a
+ href="#refsXHR">[XHR]</a></p>
+
+ <ul class="brief">
+
+ <li><dfn><code>XMLHttpRequest</code></dfn>
+ <li><dfn><code>ProgressEvent</code></dfn>
+ <li><dfn data-x="fire a progress event">Fire a progress event named <var data-x="">e</var></dfn>
+
+ </ul>
+
+ </dd>
+
+
+<!--TOPIC:HTML-->
+
+ <dt>Media Queries</dt>
+
+ <dd>
+
+ <p>Implementations must support the Media Queries language. <a href="#refsMQ">[MQ]</a></p>
+
+ </dd>
+
+
+ <dt>CSS modules</dt>
+
+ <dd>
+
+ <p>While support for CSS as a whole is not required of implementations of this specification
+ (though it is encouraged, at least for Web browsers), some features are defined in terms of
+ specific CSS requirements.</p>
+
+ <p>In particular, some features require that a string be <dfn>parsed as a CSS &lt;color&gt;
+ value</dfn>. When parsing a CSS value, user agents are required by the CSS specifications to
+ apply some error handling rules. These apply to this specification also. <a
+ href="#refsCSSCOLOR">[CSSCOLOR]</a> <a href="#refsCSS">[CSS]</a></p>
+
+ <p class="example">For example, user agents are required to close all open constructs upon
+ finding the end of a style sheet unexpectedly. Thus, when parsing the string "<code
+ data-x="">rgb(0,0,0</code>" (with a missing close-parenthesis) for a colour value, the close
+ parenthesis is implied by this error handling rule, and a value is obtained (the colour 'black').
+ However, the similar construct "<code data-x="">rgb(0,0,</code>" (with both a missing parenthesis
+ and a missing "blue" value) cannot be parsed, as closing the open construct does not result in a
+ viable value.</p>
+
+ <p>The term <dfn>CSS element reference identifier</dfn> is used as defined in the <cite>CSS
+ Image Values and Replaced Content</cite> specification to define the API that declares
+ identifiers for use with the CSS 'element()' function. <a
+ href="#refsCSSIMAGES">[CSSIMAGES]</a></p>
+
+ <p>Similarly, the term <dfn>provides a paint source</dfn> is used as defined in the <cite>CSS
+ Image Values and Replaced Content</cite> specification to define the interaction of certain HTML
+ elements with the CSS 'element()' function. <a href="#refsCSSIMAGES">[CSSIMAGES]</a></p>
+
+ <p>The term <dfn>default object size</dfn> is also defined in the <cite>CSS Image Values and
+ Replaced Content</cite> specification. <a href="#refsCSSIMAGES">[CSSIMAGES]</a></p>
+
+ <p>Implementations that support scripting must support the CSS Object Model. The following
+ features and terms are defined in the CSSOM specifications: <a href="#refsCSSOM">[CSSOM]</a> <a
+ href="#refsCSSOMVIEW">[CSSOMVIEW]</a>
+
+ <ul class="brief">
+ <li><dfn><code>Screen</code></dfn></li>
+ <li><dfn><code>LinkStyle</code></dfn></li>
+ <li><dfn><code>CSSStyleDeclaration</code></dfn></li>
+ <li><dfn data-x="dom-CSSStyleDeclaration-cssText"><code>cssText</code></dfn> attribute of <code>CSSStyleDeclaration</code></li>
+ <li><dfn><code>StyleSheet</code></dfn></li>
+ <li>The terms <dfn>create a CSS style sheet</dfn>, <dfn>remove a CSS style sheet</dfn>, and <dfn>associated CSS style sheet</dfn></li>
+ <li><dfn data-x="CSS style sheet">CSS style sheets</dfn> and their properties:
+ <dfn data-x="concept-css-style-sheet-type">type</dfn>,
+ <dfn data-x="concept-css-style-sheet-location">location</dfn>,
+ <dfn data-x="concept-css-style-sheet-parent-CSS-style-sheet">parent CSS style sheet</dfn>,
+ <dfn data-x="concept-css-style-sheet-owner-node">owner node</dfn>,
+ <dfn data-x="concept-css-style-sheet-owner-CSS-rule">owner CSS rule</dfn>,
+ <dfn data-x="concept-css-style-sheet-media">media</dfn>,
+ <dfn data-x="concept-css-style-sheet-title">title</dfn>,
+ <dfn data-x="concept-css-style-sheet-alternate-flag">alternate flag</dfn>,
+ <dfn data-x="concept-css-style-sheet-disabeld-flag">disabled flag</dfn>,
+ <dfn data-x="concept-css-style-sheet-CSS-rules">CSS rules</dfn>,
+ <dfn data-x="concept-css-style-sheet-origin-clean-flag">origin-clean flag</dfn>
+ </li>
+ <li><dfn>Alternative style sheet sets</dfn> and the <dfn>preferred style sheet set</dfn></li>
+ <li><dfn>Serializing a CSS value</dfn></li>
+ <li><dfn>Scroll an element into view</dfn></li>
+ <li><dfn>Scroll to the beginning of the document</dfn></li>
+ <li>The <dfn data-x="event-resize"><code>resize</code></dfn> event</li>
+ <li>The <dfn data-x="event-scroll"><code>scroll</code></dfn> event</li>
+ </ul>
+
+ <p>The term <dfn>environment encoding</dfn> is defined in the <cite>CSS Syntax</cite>
+ specifications. <a href="#refsCSSSYNTAX">[CSSSYNTAX]</a></p>
+
+ <p>The term <dfn>CSS styling attribute</dfn> is defined in the <cite>CSS Style Attributes</cite>
+ specification. <a href="#refsCSSATTR">[CSSATTR]</a></p>
+
+ <p>The <code>CanvasRenderingContext2D</code> object's use of fonts depends on the features
+ described in the CSS <cite>Fonts</cite> and <cite>Font Load Events</cite> specifications, including in particular
+ <dfn><code>FontLoader</code></dfn>. <a href="#refsCSSFONTS">[CSSFONTS]</a> <a
+ href="#refsCSSFONTLOAD">[CSSFONTLOAD]</a></p>
+
+ </dd>
+
+
+<!--TOPIC:Canvas-->
+
+ <dt>SVG</dt>
+
+ <dd>
+
+ <p>The following interface is defined in the SVG specification: <a href="#refsSVG">[SVG]</a></p>
+
+ <ul class="brief">
+ <li><dfn><code>SVGMatrix</code></dfn>
+ </ul>
+
+ <!-- mention that the parser supports it? -->
+
+ </dd>
+
+
+ <dt>WebGL</dt>
+
+ <dd>
+
+ <p>The following interface is defined in the WebGL specification: <a
+ href="#refsWEBGL">[WEBGL]</a></p>
+
+ <ul class="brief">
+ <li><dfn><code>WebGLRenderingContext</code></dfn>
+ </ul>
+
+ </dd>
+
+
+<!--TOPIC:HTML-->
+
+ <!-- mention that the parser supports mathml? -->
+
+
+<!--TOPIC:Video Text Tracks-->
+
+ <dt>WebVTT</dt>
+
+ <dd>
+
+ <p>Implementations may support <dfn>WebVTT</dfn> as a text track format for subtitles, captions,
+ chapter titles, metadata, etc, for media resources. <a href="#refsWEBVTT">[WEBVTT]</a></p>
+
+ <p>The following terms, used in this specification, are defined in the WebVTT specification:</p>
+
+ <ul class="brief">
+ <li><dfn>WebVTT file</dfn>
+ <li><dfn>WebVTT file using cue text</dfn>
+ <li><dfn>WebVTT file using chapter title text</dfn>
+ <li><dfn>WebVTT file using only nested cues</dfn>
+ <li><dfn>WebVTT parser</dfn>
+ <li>The <dfn>rules for updating the display of WebVTT text tracks</dfn>
+ <li>The <dfn>rules for interpreting WebVTT cue text</dfn>
+ <li>The WebVTT <dfn>text track cue writing direction</dfn>
+ </ul>
+
+ </dd>
+
+
+<!--TOPIC:WebSocket API-->
+
+ <dt>The WebSocket protocol</dt>
+
+ <dd>
+
+ <p>The following terms are defined in the WebSocket protocol specification: <a
+ href="#refsWSP">[WSP]</a></p>
+
+ <ul class="brief">
+
+ <li><dfn>establish a WebSocket connection</dfn>
+ <li><dfn>the WebSocket connection is established</dfn>
+ <li><dfn>validate the server's response</dfn>
+ <li><dfn>extensions in use</dfn>
+ <li><dfn>subprotocol in use</dfn>
+ <li><dfn>headers to send appropriate cookies</dfn>
+ <li><dfn>cookies set during the server's opening handshake</dfn>
+ <li><dfn>a WebSocket message has been received</dfn>
+ <li><dfn>send a WebSocket Message</dfn>
+ <li><dfn>fail the WebSocket connection</dfn>
+ <li><dfn>close the WebSocket connection</dfn>
+ <li><dfn>start the WebSocket closing handshake</dfn>
+ <li><dfn>the WebSocket closing handshake is started</dfn>
+ <li><dfn>the WebSocket connection is closed</dfn> (possibly <i data-x="">cleanly</i>)
+ <li><dfn>the WebSocket connection close code</dfn>
+ <li><dfn>the WebSocket connection close reason</dfn>
+
+ </ul>
+
+ </dd>
+
+
+<!--TOPIC:HTML-->
+
+ <dt>ARIA</dt>
+
+ <dd>
+
+ <p>The terms <dfn>strong native semantics</dfn> is used as defined in the ARIA specification.
+ The term <dfn>default implicit ARIA semantics</dfn> has the same meaning as the term <i>implicit
+ WAI-ARIA semantics</i> as used in the ARIA specification. <a href="#refsARIA">[ARIA]</a></p>
+
+ <p>The <dfn data-x="attr-aria-role"><code>role</code></dfn> and <code data-x="">aria-*</code>
+ attributes are defined in the ARIA specification. <a href="#refsARIA">[ARIA]</a></p>
+
+
+ </dd>
+
+
+ </dl>
+
+ <p>This specification does not <em>require</em> support of any particular network protocol, style
+ sheet language, scripting language, or any of the DOM specifications beyond those required in the
+ list above. However, the language described by this specification is biased towards CSS as the
+ styling language, JavaScript as the scripting language, and HTTP as the network protocol, and
+ several features assume that those languages and protocols are in use.</p>
+
+ <p>A user agent that implements the HTTP protocol must implement the Web Origin Concept
+ specification and the HTTP State Management Mechanism specification (Cookies) as well. <a
+ href="#refsHTTP">[HTTP]</a> <a href="#refsORIGIN">[ORIGIN]</a> <a
+ href="#refsCOOKIES">[COOKIES]</a></p>
+
+ <p class="note">This specification might have certain additional requirements on character
+ encodings, image formats, audio formats, and video formats in the respective sections.</p>
+
+ </div>
+
+ </div>
+
+
+ <h4>Extensibility</h4>
+
+ <p>Vendor-specific proprietary user agent extensions to this specification are strongly
+ discouraged. Documents must not use such extensions, as doing so reduces interoperability and
+ fragments the user base, allowing only users of specific user agents to access the content in
+ question.</p>
+
+ <div class="nodev">
+
+ <p>If such extensions are nonetheless needed, e.g. for experimental purposes, then vendors are
+ strongly urged to use one of the following extension mechanisms:</p>
+
+ <ul>
+
+ <li><p>For markup-level features that can be limited to the XML serialisation and need not be
+ supported in the HTML serialisation, vendors should use the namespace mechanism to define custom
+ namespaces in which the non-standard elements and attributes are supported.</p>
+
+ <li>
+
+ <p>For markup-level features that are intended for use with <span>the HTML syntax</span>,
+ extensions should be limited to new attributes of the form "<code data-x="">x-<var
+ data-x="">vendor</var>-<var data-x="">feature</var></code>", where <var data-x="">vendor</var> is a
+ short string that identifies the vendor responsible for the extension, and <var
+ data-x="">feature</var> is the name of the feature. New element names should not be created.
+ Using attributes for such extensions exclusively allows extensions from multiple vendors to
+ co-exist on the same element, which would not be possible with elements. Using the "<code
+ data-x="">x-<var data-x="">vendor</var>-<var data-x="">feature</var></code>" form allows extensions
+ to be made without risk of conflicting with future additions to the specification.</p>
+
+ <div class="example">
+
+ <p>For instance, a browser named "FerretBrowser" could use "ferret" as a vendor prefix, while a
+ browser named "Mellblom Browser" could use "mb". If both of these browsers invented extensions
+ that turned elements into scratch-and-sniff areas, an author experimenting with these features
+ could write:</p>
+
+ <pre>&lt;p>This smells of lemons!
+&lt;span x-ferret-smellovision x-ferret-smellcode="LEM01"
+ x-mb-outputsmell x-mb-smell="lemon juice">&lt;/span>&lt;/p></pre>
+
+ </div>
+
+ </li>
+
+ </ul>
+
+ <p>Attribute names beginning with the two characters "<code data-x="">x-</code>" are reserved for
+ user agent use and are guaranteed to never be formally added to the HTML language. For
+ flexibility, attributes names containing underscores (the U+005F LOW LINE character) are also
+ reserved for experimental purposes and are guaranteed to never be formally added to the HTML
+ language.</p>
+
+ <p class="note">Pages that use such attributes are by definition non-conforming.</p>
+
+ <p>For DOM extensions, e.g. new methods and IDL attributes, the new members should be prefixed by
+ vendor-specific strings to prevent clashes with future versions of this specification.</p>
+
+ <p>For events, experimental event types should be prefixed with vendor-specific strings.</p>
+
+ <div class="example">
+
+ <p>For example, if a user agent called "Pleas<!--e h-->old" were to add an event to indicate when
+ the user is going up in an elevator, it could use the prefix "<code data-x="">pleasold</code>" and
+ thus name the event "<code data-x="">pleasoldgoingup</code>", possibly with an event handler
+ attribute named "<code data-x="">onpleasoldgoingup</code>".</p>
+
+ </div>
+
+ <p>All extensions must be defined so that the use of extensions neither contradicts nor causes the
+ non-conformance of functionality defined in the specification.</p> <!-- thanks to QA Framework -->
+
+ <div class="example">
+
+ <p>For example, while strongly discouraged from doing so, an implementation "Foo Browser" could
+ add a new IDL attribute "<code data-x="">fooTypeTime</code>" to a control's DOM interface that
+ returned the time it took the user to select the current value of a control (say). On the other
+ hand, defining a new control that appears in a form's <code
+ data-x="dom-form-elements">elements</code> array would be in violation of the above requirement,
+ as it would violate the definition of <code data-x="dom-form-elements">elements</code> given in
+ this specification.</p>
+
+ </div>
+
+ <p>When adding new <span data-x="reflect">reflecting</span> IDL attributes corresponding to content
+ attributes of the form "<code data-x="">x-<var data-x="">vendor</var>-<var
+ data-x="">feature</var></code>", the IDL attribute should be named "<code data-x=""><var
+ data-x="">vendor</var><var data-x="">Feature</var></code>" (i.e. the "<code data-x="">x</code>" is
+ dropped from the IDL attribute's name).</p>
+
+ </div>
+
+ <hr>
+
+ <p>When vendor-neutral extensions to this specification are needed, either this specification can
+ be updated accordingly, or an extension specification can be written that overrides the
+ requirements in this specification. When someone applying this specification to their activities
+ decides that they will recognise the requirements of such an extension specification, it becomes
+ an <dfn data-x="other applicable specifications">applicable specification</dfn> for the purposes of
+ conformance requirements in this specification.</p>
+
+ <p class="note">Someone could write a specification that defines any arbitrary byte stream as
+ conforming, and then claim that their random junk is conforming. However, that does not mean that
+ their random junk actually is conforming for everyone's purposes: if someone else decides that
+ that specification does not apply to their work, then they can quite legitimately say that the
+ aforementioned random junk is just that, junk, and not conforming at all. As far as conformance
+ goes, what matters in a particular community is what that community <em>agrees</em> is
+ applicable.</p>
+
+ <div class="nodev">
+
+ <hr>
+
+ <p>User agents must treat elements and attributes that they do not understand as semantically
+ neutral; leaving them in the DOM (for DOM processors), and styling them according to CSS (for CSS
+ processors), but not inferring any meaning from them.</p>
+
+<!--ADD-TOPIC:Security-->
+ <p>When support for a feature is disabled (e.g. as an emergency measure to mitigate a security
+ problem, or to aid in development, or for performance reasons), user agents must act as if they
+ had no support for the feature whatsoever, and as if the feature was not mentioned in this
+ specification. For example, if a particular feature is accessed via an attribute in a Web IDL
+ interface, the attribute itself would be omitted from the objects that implement that interface
+ &mdash; leaving the attribute on the object but making it return null or throw an exception is
+ insufficient.</p>
+<!--REMOVE-TOPIC:Security-->
+
+ </div>
+
+
+ <div class="nodev">
+
+ <h4>Interactions with XPath and XSLT</h4>
+
+ <p id="xpath-1.0-processors">Implementations of XPath 1.0 that operate on <span>HTML
+ documents</span> parsed or created in the manners described in this specification (e.g. as part of
+ the <code data-x="">document.evaluate()</code> API) must act as if the following edit was applied
+ to the XPath 1.0 specification.</p>
+
+ <p>First, remove this paragraph:</p>
+
+ <blockquote cite="http://www.w3.org/TR/1999/REC-xpath-19991116#node-tests">
+
+ <p>A <a href="http://www.w3.org/TR/REC-xml-names#NT-QName">QName</a> in the node test is expanded
+ into an <a href="http://www.w3.org/TR/1999/REC-xpath-19991116#dt-expanded-name">expanded-name</a>
+ using the namespace declarations from the expression context. This is the same way expansion is
+ done for element type names in start and end-tags except that the default namespace declared with
+ <code data-x="">xmlns</code> is not used: if the <a
+ href="http://www.w3.org/TR/REC-xml-names#NT-QName">QName</a> does not have a prefix, then the
+ namespace URI is null (this is the same way attribute names are expanded). It is an error if the
+ <a href="http://www.w3.org/TR/REC-xml-names#NT-QName">QName</a> has a prefix for which there is
+ no namespace declaration in the expression context.</p>
+
+ </blockquote>
+
+ <p>Then, insert in its place the following:</p>
+
+ <blockquote cite="http://www.w3.org/Bugs/Public/show_bug.cgi?id=7059#c37">
+
+ <p>A QName in the node test is expanded into an expanded-name using the namespace declarations
+ from the expression context. If the QName has a prefix, then there must be a<!-- added 2009-10-27
+ - http://www.w3.org/Bugs/Public/show_bug.cgi?id=8062 --> namespace declaration for this prefix in
+ the expression context, and the corresponding<!-- typo fixed 2009-10-27 -
+ http://www.w3.org/Bugs/Public/show_bug.cgi?id=8063 --> namespace URI is the one that is
+ associated with this prefix. It is an error if the QName has a prefix for which there is no
+ namespace declaration in the expression context. </p>
+
+ <p>If the QName has no prefix and the principal node type of the axis is element, then the
+ default element namespace is used. Otherwise if the QName has no prefix, the namespace URI is
+ null. The default element namespace is a member of the context for the XPath expression. The
+ value of the default element namespace when executing an XPath expression through the DOM3 XPath
+ API is determined in the following way:</p>
+
+ <ol>
+
+ <li>If the context node is from an HTML DOM, the default element namespace is
+ "http://www.w3.org/1999/xhtml".</li>
+
+ <li>Otherwise, the default element namespace URI is null.</li>
+
+ </ol>
+
+ <p class="note">This is equivalent to adding the default element namespace feature of XPath 2.0
+ to XPath 1.0, and using the HTML namespace as the default element namespace for HTML documents.
+ It is motivated by the desire to have implementations be compatible with legacy HTML content
+ while still supporting the changes that this specification introduces to HTML regarding the
+ namespace used for HTML elements, and by the desire to use XPath 1.0 rather than XPath 2.0.</p>
+
+ </blockquote>
+
+ <p class="note">This change is a <span>willful violation</span> of the XPath 1.0 specification,
+ motivated by desire to have implementations be compatible with legacy content while still
+ supporting the changes that this specification introduces to HTML regarding which namespace is
+ used for HTML elements. <a href="#refsXPATH10">[XPATH10]</a></p> <!-- note: version matters for
+ this ref -->
+
+ <hr>
+
+ <p id="dom-based-xslt-1.0-processors">XSLT 1.0 processors outputting to a DOM when the output
+ method is "html" (either explicitly or via the defaulting rule in XSLT 1.0) are affected as
+ follows:</p>
+
+ <p>If the transformation program outputs an element in no namespace, the processor must, prior to
+ constructing the corresponding DOM element node, change the namespace of the element to the
+ <span>HTML namespace</span>, <span data-x="converted to ASCII lowercase">ASCII-lowercase</span> the
+ element's local name, and <span data-x="converted to ASCII lowercase">ASCII-lowercase</span> the
+ names of any non-namespaced attributes on the element.</p>
+
+ <p class="note">This requirement is a <span>willful violation</span> of the XSLT 1.0
+ specification, required because this specification changes the namespaces and case-sensitivity
+ rules of HTML in a manner that would otherwise be incompatible with DOM-based XSLT
+ transformations. (Processors that serialise the output are unaffected.) <a
+ href="#refsXSLT10">[XSLT10]</a></p> <!-- note: version matters for this ref -->
+
+ <hr>
+
+ <p>This specification does not specify precisely how XSLT processing interacts with the <span>HTML
+ parser</span> infrastructure (for example, whether an XSLT processor acts as if it puts any
+ elements into a <span>stack of open elements</span>). However, XSLT processors must <span>stop
+ parsing</span> if they successfully complete, and must set the <span>current document
+ readiness</span> first to "<code data-x="">interactive</code>"<!-- this synchronously fires an
+ event --> and then to "<code data-x="">complete</code>"<!-- this also synchronously fires an event
+ --> if they are aborted.</p>
+
+ <hr>
+
+ <p>This specification does not specify how XSLT interacts with the <span
+ data-x="navigate">navigation</span> algorithm, how it fits in with the <span>event loop</span>, nor
+ how error pages are to be handled (e.g. whether XSLT errors are to replace an incremental XSLT
+ output, or are rendered inline, etc).</p>
+
+ <p class="note">There are also additional non-normative comments regarding the interaction of XSLT
+ and HTML <a href="#scriptTagXSLT">in the <code>script</code> element section</a>, and of
+ XSLT, XPath, and HTML <a href="#template-XSLT-XPath">in the <code>template</code> element
+ section</a>.</p>
+
+ </div>
+
+
+
+
+ <h3>Case-sensitivity and string comparison</h3>
+
+ <p>Comparing two strings in a <dfn>case-sensitive</dfn> manner means comparing them exactly, code
+ point for code point.</p>
+
+ <p>Comparing two strings in an <dfn>ASCII case-insensitive</dfn> manner means comparing them
+ exactly, code point for code point, except that the characters in the range U+0041 to U+005A (i.e.
+ LATIN CAPITAL LETTER A to LATIN CAPITAL LETTER Z) and the corresponding characters in the range
+ U+0061 to U+007A (i.e. LATIN SMALL LETTER A to LATIN SMALL LETTER Z) are considered to also
+ match.</p>
+
+ <p>Comparing two strings in a <dfn>compatibility caseless</dfn> manner means using the Unicode
+ <i>compatibility caseless match</i> operation to compare the two strings, with no language-specific tailoirings. <a
+ href="#refsUNICODE">[UNICODE]</a></p>
+
+ <p>Except where otherwise stated, string comparisons must be performed in a
+ <span>case-sensitive</span> manner.</p>
+
+
+ <div class="nodev">
+
+ <p><dfn data-x="converted to ASCII uppercase">Converting a string to ASCII uppercase</dfn> means
+ replacing all characters in the range U+0061 to U+007A (i.e. LATIN SMALL LETTER A to LATIN SMALL
+ LETTER Z) with the corresponding characters in the range U+0041 to U+005A (i.e. LATIN CAPITAL
+ LETTER A to LATIN CAPITAL LETTER Z).</p>
+
+ <p><dfn data-x="converted to ASCII lowercase">Converting a string to ASCII lowercase</dfn> means
+ replacing all characters in the range U+0041 to U+005A (i.e. LATIN CAPITAL LETTER A to LATIN
+ CAPITAL LETTER Z) with the corresponding characters in the range U+0061 to U+007A (i.e. LATIN
+ SMALL LETTER A to LATIN SMALL LETTER Z).</p>
+
+ </div>
+
+
+ <p>A string <var data-x="">pattern</var> is a <dfn>prefix match</dfn> for a string <var
+ data-x="">s</var> when <var data-x="">pattern</var> is not longer than <var data-x="">s</var> and
+ truncating <var data-x="">s</var> to <var data-x="">pattern</var>'s length leaves the two strings as
+ matches of each other.</p>
+
+
+
+ <h3>Common microsyntaxes</h3>
+
+ <p>There are various places in HTML that accept particular data types, such as dates or numbers.
+ This section describes what the conformance criteria for content in those formats is, and how to
+ parse them.</p>
+
+ <div class="nodev">
+
+ <p class="note">Implementors are strongly urged to carefully examine any third-party libraries
+ they might consider using to implement the parsing of syntaxes described below. For example, date
+ libraries are likely to implement error handling behavior that differs from what is required in
+ this specification, since error-handling behavior is often not defined in specifications that
+ describe date syntaxes similar to those used in this specification, and thus implementations tend
+ to vary greatly in how they handle errors.</p>
+
+ </div>
+
+
+ <div class="nodev">
+
+ <h4>Common parser idioms</h4>
+
+ </div>
+
+ <p>The <dfn data-x="space character">space characters</dfn>, for the purposes of this
+ specification, are U+0020 SPACE, U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), U+000C
+ FORM FEED (FF), and U+000D CARRIAGE RETURN (CR).</p>
+
+ <p>The <dfn data-x="White_Space">White_Space characters</dfn> are those that have the Unicode
+ property "White_Space" in the Unicode <code data-x="">PropList.txt</code> data file. <a
+ href="#refsUNICODE">[UNICODE]</a></p>
+
+ <p class="note">This should not be confused with the "White_Space" value (abbreviated "WS") of the
+ "Bidi_Class" property in the <code data-x="">Unicode.txt</code> data file.</p>
+
+ <p>The <dfn>control characters</dfn> are those whose Unicode "General_Category" property has the
+ value "Cc" in the Unicode <code data-x="">UnicodeData.txt</code> data file. <a
+ href="#refsUNICODE">[UNICODE]</a></p>
+
+ <p>The <dfn>uppercase ASCII letters</dfn> are the characters in the range U+0041 LATIN CAPITAL
+ LETTER A to U+005A LATIN CAPITAL LETTER Z.</p>
+
+ <p>The <dfn>lowercase ASCII letters</dfn> are the characters in the range U+0061 LATIN SMALL
+ LETTER A to U+007A LATIN SMALL LETTER Z.</p>
+
+ <p>The <dfn>ASCII digits</dfn> are the characters in the range U+0030 DIGIT ZERO (0) to U+0039
+ DIGIT NINE (9).</p>
+
+ <p>The <dfn>alphanumeric ASCII characters</dfn> are those that are either <span>uppercase ASCII
+ letters</span>, <span>lowercase ASCII letters</span>, or <span>ASCII digits</span>.</p>
+
+ <p>The <dfn>ASCII hex digits</dfn> are the characters in the ranges U+0030 DIGIT ZERO (0) to
+ U+0039 DIGIT NINE (9), U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F, and U+0061
+ LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F.</p>
+
+ <p>The <dfn>uppercase ASCII hex digits</dfn> are the characters in the ranges U+0030 DIGIT ZERO (0) to
+ U+0039 DIGIT NINE (9) and U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F only.</p>
+
+ <p>The <dfn>lowercase ASCII hex digits</dfn> are the characters in the ranges U+0030 DIGIT ZERO
+ (0) to U+0039 DIGIT NINE (9) and U+0061 LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F
+ only.</p>
+
+ <div class="nodev">
+
+ <p>Some of the micro-parsers described below follow the pattern of having an <var
+ data-x="">input</var> variable that holds the string being parsed, and having a <var
+ data-x="">position</var> variable pointing at the next character to parse in <var
+ data-x="">input</var>.</p>
+
+ <p>For parsers based on this pattern, a step that requires the user agent to <dfn>collect a
+ sequence of characters</dfn> means that the following algorithm must be run, with <var
+ data-x="">characters</var> being the set of characters that can be collected:</p>
+
+ <ol>
+
+ <li><p>Let <var data-x="">input</var> and <var data-x="">position</var> be the same variables as
+ those of the same name in the algorithm that invoked these steps.</p></li>
+
+ <li><p>Let <var data-x="">result</var> be the empty string.</p></li>
+
+ <li><p>While <var data-x="">position</var> doesn't point past the end of <var data-x="">input</var>
+ and the character at <var data-x="">position</var> is one of the <var data-x="">characters</var>,
+ append that character to the end of <var data-x="">result</var> and advance <var
+ data-x="">position</var> to the next character in <var data-x="">input</var>.</p></li>
+
+ <li><p>Return <var data-x="">result</var>.</p></li>
+
+ </ol>
+
+ <p>The step <dfn>skip whitespace</dfn> means that the user agent must <span>collect a sequence of
+ characters</span> that are <span data-x="space character">space characters</span>. The step
+ <dfn>skip White_Space characters</dfn> means that the user agent must <span>collect a sequence of
+ characters</span> that are <span>White_Space</span> characters. In both cases, the collected
+ characters are not used. <a href="#refsUNICODE">[UNICODE]</a></p>
+
+ <p>When a user agent is to <dfn>strip line breaks</dfn> from a string, the user agent must remove
+ any U+000A LINE FEED (LF) and U+000D CARRIAGE RETURN (CR) characters from that string.</p>
+
+ <p>When a user agent is to <dfn>strip leading and trailing whitespace</dfn> from a string, the
+ user agent must remove all <span data-x="space character">space characters</span> that are at the
+ start or end of the string.</p>
+
+ <p>When a user agent is to <dfn>strip and collapse whitespace</dfn> in a string, it must replace
+ any sequence of one or more consecutive <span data-x="space character">space characters</span> in
+ that string with a single U+0020 SPACE character, and then <span>strip leading and trailing
+ whitespace</span> from that string.</p>
+
+ <p>When a user agent has to <dfn>strictly split a string</dfn> on a particular delimiter character
+ <var data-x="">delimiter</var>, it must use the following algorithm:</p>
+
+ <ol>
+
+ <li><p>Let <var data-x="">input</var> be the string being parsed.</p></li>
+
+ <li><p>Let <var data-x="">position</var> be a pointer into <var data-x="">input</var>, initially
+ pointing at the start of the string.</p></li>
+
+ <li><p>Let <var data-x="">tokens</var> be an ordered list of tokens, initially empty.</p></li>
+
+ <li><p>While <var data-x="">position</var> is not past the end of <var data-x="">input</var>:</p>
+
+ <ol>
+
+ <li><p><span>Collect a sequence of characters</span> that are not the <var
+ data-x="">delimiter</var> character.</p></li>
+
+ <li><p>Append the string collected in the previous step to <var data-x="">tokens</var>.</p></li>
+
+ <li><p>Advance <var data-x="">position</var> to the next character in <var
+ data-x="">input</var>.</p></li> <!-- skips past the delimiter -->
+
+ </ol>
+
+ </li>
+
+ <li><p>Return <var data-x="">tokens</var>.</p></li>
+
+ </ol>
+
+ <p class="note">For the special cases of splitting a string <span data-x="split a string on
+ spaces">on spaces</span> and <span data-x="split a string on commas">on commas</span>, this
+ algorithm does not apply (those algorithms also perform <span data-x="strip leading and trailing
+ whitespace">whitespace trimming</span>).</p>
+
+ </div>
+
+
+
+ <h4>Boolean attributes</h4>
+
+ <p>A number of attributes are <dfn data-x="boolean attribute">boolean attributes</dfn>. The
+ presence of a boolean attribute on an element represents the true value, and the absence of the
+ attribute represents the false value.</p>
+
+ <p>If the attribute is present, its value must either be the empty string or a value that is an
+ <span>ASCII case-insensitive</span> match for the attribute's canonical name, with no leading or
+ trailing whitespace.</p>
+
+ <p class="note">The values "true" and "false" are not allowed on boolean attributes. To represent
+ a false value, the attribute has to be omitted altogether.</p>
+
+ <div class="example">
+
+ <p>Here is an example of a checkbox that is checked and disabled. The <code
+ data-x="attr-input-checked">checked</code> and <code data-x="attr-fe-disabled">disabled</code>
+ attributes are the boolean attributes.</p>
+
+ <pre>&lt;label>&lt;input type=checkbox checked name=cheese disabled> Cheese&lt;/label></pre>
+
+ <p>This could be equivalently written as this:
+
+ <pre>&lt;label>&lt;input type=checkbox checked=checked name=cheese disabled=disabled> Cheese&lt;/label></pre>
+
+ <p>You can also mix styles; the following is still equivalent:</p>
+
+ <pre>&lt;label>&lt;input type='checkbox' checked name=cheese disabled=""> Cheese&lt;/label></pre>
+
+ </div>
+
+
+
+ <h4>Keywords and enumerated attributes</h4>
+
+ <p>Some attributes are defined as taking one of a finite set of keywords. Such attributes are
+ called <dfn data-x="enumerated attribute">enumerated attributes</dfn>. The keywords are each
+ defined to map to a particular <em>state</em> (several keywords might map to the same state, in
+ which case some of the keywords are synonyms of each other; additionally, some of the keywords can
+ be said to be non-conforming, and are only in the specification for historical reasons). In
+ addition, two default states can be given. The first is the <i>invalid value default</i>, the
+ second is the <i>missing value default</i>.</p>
+
+ <p>If an enumerated attribute is specified, the attribute's value must be an <span>ASCII
+ case-insensitive</span> match for one of the given keywords that are not said to be
+ non-conforming, with no leading or trailing whitespace.</p>
+
+ <p>When the attribute is specified, if its value is an <span>ASCII case-insensitive</span> match
+ for one of the given keywords then that keyword's state is the state that the attribute
+ represents. If the attribute value matches none of the given keywords, but the attribute has an
+ <i>invalid value default</i>, then the attribute represents that state. Otherwise, if the
+ attribute value matches none of the keywords but there is a <i>missing value default</i> state
+ defined, then <em>that</em> is the state represented by the attribute. Otherwise, there is no
+ default, and invalid values mean that there is no state represented.</p>
+
+ <p>When the attribute is <em>not</em> specified, if there is a <i>missing value default</i> state
+ defined, then that is the state represented by the (missing) attribute. Otherwise, the absence of
+ the attribute means that there is no state represented.</p>
+
+ <p class="note">The empty string can be a valid keyword.</p>
+
+
+ <h4>Numbers</h4>
+
+ <h5>Signed integers</h5>
+
+ <p>A string is a <dfn>valid integer</dfn> if it consists of one or more <span>ASCII digits</span>,
+ optionally prefixed with a U+002D HYPHEN-MINUS character (-).</p>
+
+ <p>A <span>valid integer</span> without a U+002D HYPHEN-MINUS (-) prefix represents the number
+ that is represented in base ten by that string of digits. A <span>valid integer</span>
+ <em>with</em> a U+002D HYPHEN-MINUS (-) prefix represents the number represented in base ten by
+ the string of digits that follows the U+002D HYPHEN-MINUS, subtracted from zero.</p>
+
+ <div class="nodev">
+
+ <p>The <dfn>rules for parsing integers</dfn> are as given in the following algorithm. When
+ invoked, the steps must be followed in the order given, aborting at the first step that returns a
+ value. This algorithm will return either an integer or an error.</p>
+
+ <ol>
+
+ <li><p>Let <var data-x="">input</var> be the string being parsed.</p></li>
+
+ <li><p>Let <var data-x="">position</var> be a pointer into <var data-x="">input</var>, initially
+ pointing at the start of the string.</p></li>
+
+ <li><p>Let <var data-x="">sign</var> have the value "positive".</p></li>
+
+ <li><p><span>Skip whitespace</span>.</p></li>
+
+ <li><p>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, return an
+ error.</p></li>
+
+ <li>
+
+ <p>If the character indicated by <var data-x="">position</var> (the first character) is a U+002D
+ HYPHEN-MINUS character (-):</p>
+
+ <ol>
+
+ <li>Let <var data-x="">sign</var> be "negative".</li>
+
+ <li>Advance <var data-x="">position</var> to the next character.</li>
+
+ <li>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, return an
+ error.</li>
+
+ </ol>
+
+ <p>Otherwise, if the character indicated by <var data-x="">position</var> (the first character)
+ is a U+002B PLUS SIGN character (+):</p>
+
+ <ol>
+
+ <li>Advance <var data-x="">position</var> to the next character. (The "<code data-x="">+</code>"
+ is ignored, but it is not conforming.)</li>
+
+ <li>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, return an
+ error.</li>
+
+ </ol>
+
+ </li>
+
+ <li><p>If the character indicated by <var data-x="">position</var> is not an <span data-x="ASCII
+ digits">ASCII digit</span>, then return an error.</p></li>
+
+ <!-- Ok. At this point we know we have a number. It might have
+ trailing garbage which we'll ignore, but it's a number, and we
+ won't return an error. -->
+
+ <li><p><span>Collect a sequence of characters</span> that are <span>ASCII digits</span>, and
+ interpret the resulting sequence as a base-ten integer. Let <var data-x="">value</var> be that
+ integer.</p></li>
+
+ <li><p>If <var data-x="">sign</var> is "positive", return <var
+ data-x="">value</var>, otherwise return the result of subtracting
+ <var data-x="">value</var> from zero.</p></li>
+
+ </ol>
+
+ </div>
+
+
+ <h5>Non-negative integers</h5>
+
+ <p>A string is a <dfn>valid non-negative integer</dfn> if it consists of one or more <span>ASCII
+ digits</span>.</p>
+
+ <p>A <span>valid non-negative integer</span> represents the number that is represented in base ten
+ by that string of digits.</p>
+
+ <div class="nodev">
+
+ <p>The <dfn>rules for parsing non-negative integers</dfn> are as given in the following algorithm.
+ When invoked, the steps must be followed in the order given, aborting at the first step that
+ returns a value. This algorithm will return either zero, a positive integer, or an error.</p>
+
+ <ol>
+
+ <li><p>Let <var data-x="">input</var> be the string being parsed.</p></li>
+
+ <li><p>Let <var data-x="">value</var> be the result of parsing <var data-x="">input</var> using the
+ <span>rules for parsing integers</span>.</p></li>
+
+ <li><p>If <var data-x="">value</var> is an error, return an error.</p></li>
+
+ <li><p>If <var data-x="">value</var> is less than zero, return an error.</p></li>
+
+ <li><p>Return <var data-x="">value</var>.</p></li>
+
+ </ol>
+
+ <!-- Implications: A leading + is ignored. A leading - is ignored if the value is zero. -->
+
+ </div>
+
+
+ <h5>Floating-point numbers</h5>
+
+ <p>A string is a <dfn>valid floating-point number</dfn> if it consists of:</p>
+
+ <ol class="brief">
+
+ <li>Optionally, a U+002D HYPHEN-MINUS character (-).</li>
+
+ <li>One or both of the following, in the given order:
+
+ <ol>
+
+ <li>A series of one or more <span>ASCII digits</span>.</li>
+
+ <li>
+
+ <ol>
+
+ <li>A single U+002E FULL STOP character (.).</li>
+
+ <li>A series of one or more <span>ASCII digits</span>.</li>
+
+ </ol>
+
+ </li>
+
+ </ol>
+
+ </li>
+
+ <li>Optionally:
+
+ <ol>
+
+ <li>Either a U+0065 LATIN SMALL LETTER E character (e) or a U+0045 LATIN CAPITAL LETTER E
+ character (E).</li>
+
+ <li>Optionally, a U+002D HYPHEN-MINUS character (-) or U+002B PLUS SIGN character (+).</li>
+
+ <li>A series of one or more <span>ASCII digits</span>.</li>
+
+ </ol>
+
+ </li>
+
+ </ol>
+
+ <p>A <span>valid floating-point number</span> represents the number obtained by multiplying the
+ significand by ten raised to the power of the exponent, where the significand is the first number,
+ interpreted as base ten (including the decimal point and the number after the decimal point, if
+ any, and interpreting the significand as a negative number if the whole string starts with a
+ U+002D HYPHEN-MINUS character (-) and the number is not zero), and where the exponent is the
+ number after the E, if any (interpreted as a negative number if there is a U+002D HYPHEN-MINUS
+ character (-) between the E and the number and the number is not zero, or else ignoring a U+002B
+ PLUS SIGN character (+) between the E and the number if there is one). If there is no E, then the
+ exponent is treated as zero.</p>
+
+ <p class="note">The Infinity and Not-a-Number (NaN) values are not <span data-x="valid
+ floating-point number">valid floating-point numbers</span>.</p>
+
+ <div class="nodev">
+
+ <p>The <dfn data-x="best representation of the number as a floating-point number">best
+ representation of the number <var data-x="">n</var> as a floating-point number</dfn> is the string
+ obtained from applying the JavaScript operator ToString to <var data-x="">n</var>. The JavaScript
+ operator ToString is not uniquely determined. When there are multiple possible strings that could
+ be obtained from the JavaScript operator ToString for a particular value, the user agent must
+ always return the same string for that value (though it may differ from the value used by other
+ user agents).</p>
+
+ <p>The <dfn>rules for parsing floating-point number values</dfn> are as given in the following
+ algorithm. This algorithm must be aborted at the first step that returns something. This algorithm
+ will return either a number or an error.</p>
+
+ <ol>
+
+ <li><p>Let <var data-x="">input</var> be the string being parsed.</p></li>
+
+ <li><p>Let <var data-x="">position</var> be a pointer into <var data-x="">input</var>, initially
+ pointing at the start of the string.</p></li>
+
+ <li><p>Let <var data-x="">value</var> have the value 1.</li>
+
+ <li><p>Let <var data-x="">divisor</var> have the value 1.</p></li>
+
+ <li><p>Let <var data-x="">exponent</var> have the value 1.</p></li>
+
+ <li><p><span>Skip whitespace</span>.</p></li>
+
+ <li><p>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, return an
+ error.</p></li>
+
+ <li>
+
+ <p>If the character indicated by <var data-x="">position</var> is a U+002D HYPHEN-MINUS character
+ (-):</p>
+
+ <ol>
+
+ <li>Change <var data-x="">value</var> and <var data-x="">divisor</var> to &#x2212;1.</li>
+
+ <li>Advance <var data-x="">position</var> to the next character.</li>
+
+ <li>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, return an
+ error.</li>
+
+ </ol>
+
+ <p>Otherwise, if the character indicated by <var data-x="">position</var> (the first character)
+ is a U+002B PLUS SIGN character (+):</p>
+
+ <ol>
+
+ <li>Advance <var data-x="">position</var> to the next character. (The "<code data-x="">+</code>"
+ is ignored, but it is not conforming.)</li>
+
+ <li>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, return an
+ error.</li>
+
+ </ol>
+
+ </li>
+
+ <li><p>If the character indicated by <var data-x="">position</var> is a U+002E FULL STOP (.), and
+ that is not the last character in <var data-x="">input</var>, and the character after the
+ character indicated by <var data-x="">position</var> is an <span data-x="ASCII digits">ASCII
+ digit</span>, then set <var data-x="">value</var> to zero and jump to the step labeled
+ <i>fraction</i>.</p> <!-- we have to check there's a number so that ".e1" fails to parse but ".0"
+ does not -->
+
+ <li><p>If the character indicated by <var data-x="">position</var> is not an <span data-x="ASCII
+ digits">ASCII digit</span>, then return an error.</p></li>
+
+ <li><p><span>Collect a sequence of characters</span> that are <span>ASCII digits</span>, and
+ interpret the resulting sequence as a base-ten integer. Multiply <var data-x="">value</var> by
+ that integer.</p></li>
+
+ <li>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, jump to the
+ step labeled <i>conversion</i>.</li>
+
+ <li><p><i>Fraction</i>: If the character indicated by <var data-x="">position</var> is a U+002E
+ FULL STOP (.), run these substeps:</p>
+
+ <ol>
+
+ <li><p>Advance <var data-x="">position</var> to the next character.</p></li>
+
+ <li><p>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, or if the
+ character indicated by <var data-x="">position</var> is not an <span data-x="ASCII digits">ASCII
+ digit</span>, U+0065 LATIN SMALL LETTER E (e), or U+0045 LATIN CAPITAL LETTER E (E), then jump
+ to the step labeled <i>conversion</i>.</li>
+
+ <li><p>If the character indicated by <var data-x="">position</var> is a U+0065 LATIN SMALL
+ LETTER E character (e) or a U+0045 LATIN CAPITAL LETTER E character (E), skip the remainder of
+ these substeps.</p>
+
+ <li><p><i>Fraction loop</i>: Multiply <var data-x="">divisor</var> by ten.</p></li>
+
+ <li>Add the value of the character indicated by <var data-x="">position</var>, interpreted as a
+ base-ten digit (0..9) and divided by <var data-x="">divisor</var>, to <var
+ data-x="">value</var>.</li>
+
+ <li><p>Advance <var data-x="">position</var> to the next character.</p></li>
+
+ <li><p>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, then jump
+ to the step labeled <i>conversion</i>.</li>
+
+ <li><p>If the character indicated by <var data-x="">position</var> is an <span data-x="ASCII
+ digits">ASCII digit</span>, jump back to the step labeled <i>fraction loop</i> in these
+ substeps.</p></li>
+
+ </ol>
+
+ </li>
+
+ <li><p>If the character indicated by <var data-x="">position</var> is a U+0065 LATIN SMALL LETTER
+ E character (e) or a U+0045 LATIN CAPITAL LETTER E character (E), run these substeps:</p>
+
+ <ol>
+
+ <li><p>Advance <var data-x="">position</var> to the next character.</p></li>
+
+ <li><p>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, then jump
+ to the step labeled <i>conversion</i>.</li>
+
+ <li>
+
+ <p>If the character indicated by <var data-x="">position</var> is a U+002D HYPHEN-MINUS
+ character (-):</p>
+
+ <ol>
+
+ <li>Change <var data-x="">exponent</var> to &#x2212;1.</li>
+
+ <li>Advance <var data-x="">position</var> to the next character.</li>
+
+ <li><p>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, then
+ jump to the step labeled <i>conversion</i>.</li>
+
+ </ol>
+
+ <p>Otherwise, if the character indicated by <var data-x="">position</var> is a U+002B PLUS SIGN
+ character (+):</p>
+
+ <ol>
+
+ <li>Advance <var data-x="">position</var> to the next character.</li>
+
+ <li><p>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, then
+ jump to the step labeled <i>conversion</i>.</li>
+
+ </ol>
+
+ </li>
+
+ <li><p>If the character indicated by <var data-x="">position</var> is not an <span data-x="ASCII
+ digits">ASCII digit</span>, then jump to the step labeled <i>conversion</i>.</li>
+
+ <li><p><span>Collect a sequence of characters</span> that are <span>ASCII digits</span>, and
+ interpret the resulting sequence as a base-ten integer. Multiply <var data-x="">exponent</var>
+ by that integer.</p></li>
+
+ <li><p>Multiply <var data-x="">value</var> by ten raised to the <var data-x="">exponent</var>th
+ power.</p></li>
+
+ </ol>
+
+ </li>
+
+ <li><p><i>Conversion</i>: Let <var data-x="">S</var> be the set of finite IEEE 754
+ double-precision floating-point values except &#x2212;0, but with two special values added: 2<sup
+ data-x="">1024</sup> and &#x2212;2<sup data-x="">1024</sup>.</p></li>
+
+ <li><p>Let <var data-x="">rounded-value</var> be the number in <var data-x="">S</var> that is
+ closest to <var data-x="">value</var>, selecting the number with an even significand if there are
+ two equally close values. (The two special values 2<sup data-x="">1024</sup> and &#x2212;2<sup
+ data-x="">1024</sup> are considered to have even significands for this purpose.)</p></li>
+
+ <li><p>If <var data-x="">rounded-value</var> is 2<sup data-x="">1024</sup> or &#x2212;2<sup
+ data-x="">1024</sup>, return an error.</p></li>
+
+ <li><p>Return <var data-x="">rounded-value</var>.</p></li>
+
+ </ol>
+
+ </div>
+
+
+<div class="nodev">
+ <h5 id="percentages-and-dimensions">Percentages and lengths</h5>
+
+ <p>The <dfn>rules for parsing dimension values</dfn> are as given in the following algorithm. When
+ invoked, the steps must be followed in the order given, aborting at the first step that returns a
+ value. This algorithm will return either a number greater than or equal to 1.0, or an error; if a
+ number is returned, then it is further categorised as either a percentage or a length.</p>
+
+ <ol>
+
+ <li><p>Let <var data-x="">input</var> be the string being parsed.</p></li>
+
+ <li><p>Let <var data-x="">position</var> be a pointer into <var data-x="">input</var>, initially
+ pointing at the start of the string.</p></li>
+
+ <li><p><span>Skip whitespace</span>.</p></li>
+
+ <li><p>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, return an
+ error.</p></li>
+
+ <li><p>If the character indicated by <var data-x="">position</var> is a U+002B PLUS SIGN character
+ (+), advance <var data-x="">position</var> to the next character.</li>
+
+ <li><p><span>Collect a sequence of characters</span> that are U+0030 DIGIT ZERO (0) characters,
+ and discard them.</p></li>
+
+ <li><p>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, return an
+ error.</p></li>
+
+ <li><p>If the character indicated by <var data-x="">position</var> is not one of U+0031 DIGIT ONE
+ (1) to U+0039 DIGIT NINE (9), then return an error.</p></li>
+
+ <!-- Ok. At this point we know we have a number. It might have trailing garbage which we'll
+ ignore, but it's a number, and we won't return an error. -->
+
+ <li><p><span>Collect a sequence of characters</span> that are <span>ASCII digits</span>, and
+ interpret the resulting sequence as a base-ten integer. Let <var data-x="">value</var> be that
+ number.</li>
+
+ <li><p>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, return <var
+ data-x="">value</var> as a length.</p></li>
+
+ <li>
+
+ <p>If the character indicated by <var data-x="">position</var> is a U+002E FULL STOP character
+ (.):</p>
+
+ <ol>
+
+ <li><p>Advance <var data-x="">position</var> to the next character.</p></li>
+
+ <li><p>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, or if the
+ character indicated by <var data-x="">position</var> is not an <span data-x="ASCII digits">ASCII
+ digit</span>, then return <var data-x="">value</var> as a length.</li>
+
+ <li><p>Let <var data-x="">divisor</var> have the value 1.</p></li>
+
+ <li><p><i>Fraction loop</i>: Multiply <var data-x="">divisor</var> by ten.</p></li>
+
+ <li>Add the value of the character indicated by <var data-x="">position</var>, interpreted as a
+ base-ten digit (0..9) and divided by <var data-x="">divisor</var>, to <var
+ data-x="">value</var>.</li>
+
+ <li><p>Advance <var data-x="">position</var> to the next character.</p></li>
+
+ <li><p>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, then
+ return <var data-x="">value</var> as a length.</li>
+
+ <li><p>If the character indicated by <var data-x="">position</var> is an <span data-x="ASCII
+ digits">ASCII digit</span>, return to the step labeled <i>fraction loop</i> in these
+ substeps.</p></li>
+
+ </ol>
+
+ </li>
+
+ <li><p>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, return <var
+ data-x="">value</var> as a length.</p></li>
+
+ <li><p>If the character indicated by <var data-x="">position</var> is a U+0025 PERCENT SIGN
+ character (%), return <var data-x="">value</var> as a percentage.</p></li>
+
+ <li><p>Return <var data-x="">value</var> as a length.</p></li>
+
+ </ol>
+
+ </div>
+
+
+ <h5>Lists of integers</h5>
+
+ <p>A <dfn>valid list of integers</dfn> is a number of <span data-x="valid integer">valid
+ integers</span> separated by U+002C COMMA characters, with no other characters (e.g. no <span
+ data-x="space character">space characters</span>). In addition, there might be restrictions on the
+ number of integers that can be given, or on the range of values allowed.</p>
+
+ <div class="nodev">
+
+ <p>The <dfn>rules for parsing a list of integers</dfn> are as follows:</p>
+
+ <ol>
+
+ <li><p>Let <var data-x="">input</var> be the string being parsed.</p></li>
+
+ <li><p>Let <var data-x="">position</var> be a pointer into <var data-x="">input</var>, initially
+ pointing at the start of the string.</p></li>
+
+ <li><p>Let <var data-x="">numbers</var> be an initially empty list of integers. This list will be
+ the result of this algorithm.</p></li>
+
+ <li><p>If there is a character in the string <var data-x="">input</var> at position <var
+ data-x="">position</var>, and it is either a U+0020 SPACE, U+002C COMMA, or U+003B SEMICOLON
+ character, then advance <var data-x="">position</var> to the next character in <var
+ data-x="">input</var>, or to beyond the end of the string if there are no more
+ characters.</p></li>
+
+ <li><p>If <var data-x="">position</var> points to beyond the end of <var data-x="">input</var>,
+ return <var data-x="">numbers</var> and abort.</p></li>
+
+ <li><p>If the character in the string <var data-x="">input</var> at position <var
+ data-x="">position</var> is a U+0020 SPACE, U+002C COMMA, or U+003B SEMICOLON character, then
+ return to step 4.</li>
+
+ <li><p>Let <var data-x="">negated</var> be false.</p></li> <li><p>Let <var data-x="">value</var> be
+ 0.</p></li>
+
+ <li><p>Let <var data-x="">started</var> be false. This variable is set to true when the parser
+ sees a number or a U+002D HYPHEN-MINUS character (-).</p></li>
+
+ <li><p>Let <var data-x="">got number</var> be false. This variable is set to true when the parser
+ sees a number.</p></li>
+
+ <li><p>Let <var data-x="">finished</var> be false. This variable is set to true to switch parser
+ into a mode where it ignores characters until the next separator.</p></li>
+
+ <li><p>Let <var data-x="">bogus</var> be false.</p></li>
+
+ <li><p><i>Parser</i>: If the character in the string <var data-x="">input</var> at position <var
+ data-x="">position</var> is:</p>
+
+ <dl class="switch">
+
+ <dt>A U+002D HYPHEN-MINUS character</dt>
+
+ <dd>
+
+ <p>Follow these substeps:</p>
+
+ <ol>
+
+ <li>If <var data-x="">got number</var> is true, let <var data-x="">finished</var> be true.</li>
+
+ <li>If <var data-x="">finished</var> is true, skip to the next step in the overall set of
+ steps.</li>
+
+ <li>If <var data-x="">started</var> is true, let <var data-x="">negated</var> be false.</li>
+
+ <li>Otherwise, if <var data-x="">started</var> is false and if <var data-x="">bogus</var> is
+ false, let <var data-x="">negated</var> be true.</li>
+
+ <li>Let <var data-x="">started</var> be true.</li>
+
+ </ol>
+
+ </dd>
+
+ <dt>An <span data-x="ASCII digits">ASCII digit</span></dt>
+
+ <dd>
+
+ <p>Follow these substeps:</p>
+
+ <ol>
+
+ <li>If <var data-x="">finished</var> is true, skip to the next step in the overall set of
+ steps.</li>
+
+ <li>Multiply <var data-x="">value</var> by ten.</li>
+
+ <li>Add the value of the digit, interpreted in base ten, to <var data-x="">value</var>.</li>
+
+ <li>Let <var data-x="">started</var> be true.</li>
+
+ <li>Let <var data-x="">got number</var> be true.</li>
+
+ </ol>
+
+ </dd>
+
+
+ <dt>A U+0020 SPACE character</dt>
+ <dt>A U+002C COMMA character</dt>
+ <dt>A U+003B SEMICOLON character</dt>
+
+ <dd>
+
+ <p>Follow these substeps:</p>
+
+ <ol>
+
+ <li>If <var data-x="">got number</var> is false, return the <var data-x="">numbers</var> list
+ and abort. This happens if an entry in the list has no digits, as in "<code
+ data-x="">1,2,x,4</code>".</li>
+
+ <li>If <var data-x="">negated</var> is true, then negate <var data-x="">value</var>.</li>
+
+ <li>Append <var data-x="">value</var> to the <var data-x="">numbers</var> list.</li>
+
+ <li>Jump to step 4 in the overall set of steps.</li>
+
+ </ol>
+
+ </dd>
+
+
+ <!-- <dt>A U+002E FULL STOP character</dt> -->
+ <dt>A character in the range U+0001 to U+001F, <!-- space --> U+0021 to U+002B, <!-- comma --> U+002D to U+002F, <!-- digits --> U+003A, <!-- semicolon --> U+003C to U+0040, <!-- a-z --> U+005B to U+0060, <!-- A-Z --> U+007b to U+007F
+ (i.e. any other non-alphabetic ASCII character)</dt>
+
+ <!--
+ Test: http://www.hixie.ch/tests/adhoc/html/flow/image-maps/004-demo.html
+ IE6 on Wine treats the following characters like this also: U+1-U+1f, U+21-U+2b, U+2d-U+2f, U+3a,
+ U+3c-U+40, U+5b-U+60, U+7b-U+82, U+84-U+89, U+8b, U+8d, U+8f-U+99, U+9b, U+9d, U+a0-U+bf, U+d7,
+ U+f7, U+1f6-U+1f9, U+218-U+24f, U+2a9-U+385, U+387, U+38b, U+38d, U+3a2, U+3cf, U+3d7-U+3d9, U+3db,
+ U+3dd, U+3df, U+3e1, U+3f4-U+400, U+40d, U+450, U+45d, U+482-U+48f, U+4c5-U+4c6, U+4c9-U+4ca,
+ U+4cd-U+4cf, U+4ec-U+4ed, U+4f6-U+4f7, U+4fa-U+530, U+557-U+560, U+588-U+5cf, U+5eb-U+5ef,
+ U+5f3-U+620, U+63b-U+640, U+64b-U+670, U+6b8-U+6b9, U+6bf, U+6cf, U+6d4, U+6d6-U+904, U+93a-U+957,
+ U+962-U+984, U+98d-U+98e, U+991-U+992, U+9a9, U+9b1, U+9b3-U+9b5, U+9ba-U+9db, U+9de, U+9e2-U+9ef,
+ U+9f2-U+a04, U+a0b-U+a0e, U+a11-U+a12, U+a29, U+a31, U+a34, U+a37, U+a3a-U+a58, U+a5d, U+a5f-U+a84,
+ U+a8c, U+a8e, U+a92, U+aa9, U+ab1, U+ab4, U+aba-U+adf, U+ae1-U+b04, U+b0d-U+b0e, U+b11-U+b12,
+ U+b29, U+b31, U+b34-U+b35, U+b3a-U+b5b, U+b5e, U+b62-U+b84, U+b8b-U+b8d, U+b91, U+b96-U+b98, U+b9b,
+ U+b9d, U+ba0-U+ba2, U+ba5-U+ba7, U+bab-U+bad, U+bb6, U+bba-U+c04, U+c0d, U+c11, U+c29, U+c34,
+ U+c3a-U+c5f, U+c62-U+c84, U+c8d, U+c91, U+ca9, U+cb4, U+cba-U+cdd, U+cdf, U+ce2-U+d04, U+d0d,
+ U+d11, U+d29, U+d3a-U+d5f, U+d62-U+e00, U+e2f, U+e31, U+e34-U+e3f, U+e46-U+e80, U+e83, U+e85-U+e86,
+ U+e89, U+e8b-U+e8c, U+e8e-U+e93, U+e98, U+ea0, U+ea4, U+ea6, U+ea8-U+ea9, U+eac, U+eaf-U+edb,
+ U+ede-U+109f, U+10c6-U+10cf, U+10f7-U+10ff, U+115a-U+115e, U+11a3-U+11a7, U+11fa-U+1dff,
+ U+1e9b-U+1e9f, U+1efa-U+1eff, U+1f16-U+1f17, U+1f1e-U+1f1f, U+1f46-U+1f47, U+1f4e-U+1f4f, U+1f58,
+ U+1f5a, U+1f5c, U+1f5e, U+1f7e-U+1f7f, U+1fb5, U+1fbd-U+1fc1, U+1fc5, U+1fcd-U+1fcf, U+1fd4-U+1fd5,
+ U+1fdc-U+1fdf, U+1fed-U+1ff1, U+1ff5, U+1ffd-U+249b, U+24ea-U+3004, U+3006-U+3040, U+3095-U+309a,
+ U+309f-U+30a0, U+30fb, U+30ff-U+3104, U+312d-U+3130, U+318f-U+4dff, U+9fa6-U+abff, U+d7a4-U+d7ff,
+ U+e000-U+f8ff, U+fa2e-U+faff, U+fb07-U+fb12, U+fb18-U+fb1e, U+fb37, U+fb3d, U+fb3f, U+fb42, U+fb45,
+ U+fbb2-U+fbd2, U+fbe9, U+fce1, U+fd3e-U+fd4f, U+fd90-U+fd91, U+fdc8-U+fdef, U+fdfc-U+fe7f,
+ U+fefd-U+ff20, U+ff3b-U+ff40, U+ff5b-U+ff65, U+ffa0, U+ffbf-U+ffc1, U+ffc8-U+ffc9, U+ffd0-U+ffd1,
+ U+ffd8-U+ffd9, U+ffdd-U+ffff
+ IE7 on Win2003 treats the following characters like this also instead: U+1-U+1f, U+21-U+2b,
+ U+2d-U+2f, U+3a, U+3c-U+40, U+5b-U+60, U+7b-U+82, U+84-U+89, U+8b, U+8d, U+8f-U+99, U+9b, U+9d,
+ U+a0-U+a9, U+ab-U+b4, U+b6-U+b9, U+bb-U+bf, U+d7, U+f7, U+220-U+221, U+234-U+24f, U+2ae-U+2af,
+ U+2b9-U+2ba, U+2c2-U+2df, U+2e5-U+2ed, U+2ef-U+344, U+346-U+379, U+37b-U+385, U+387, U+38b, U+38d,
+ U+3a2, U+3cf, U+3d8-U+3d9, U+3f4-U+3ff, U+482-U+48b, U+4c5-U+4c6, U+4c9-U+4ca, U+4cd-U+4cf,
+ U+4f6-U+4f7, U+4fa-U+530, U+557-U+558, U+55a-U+560, U+588-U+5cf, U+5eb-U+5ef, U+5f3-U+620,
+ U+63b-U+640, U+656-U+66f, U+6d4, U+6dd-U+6e0, U+6e9-U+6ec, U+6ee-U+6f9, U+6fd-U+70f, U+72d-U+72f,
+ U+740-U+77f, U+7b1-U+900, U+904, U+93a-U+93c, U+94d - U+94f, U+951-U+957, U+964-U+980, U+984,
+ U+98d-U+98e, U+991-U+992, U+9a9, U+9b1, U+9b3-U+9b5, U+9ba-U+9bd, U+9c5-U+9c6, U+9c9-U+9ca,
+ U+9cd-U+9d6, U+9d8-U+9db, U+9de, U+9e4-U+9ef, U+9f2-U+a01, U+a03-U+a04, U+a0b-U+a0e, U+a11-U+a12,
+ U+a29, U+a31, U+a34, U+a37, U+a3a-U+a3d, U+a43-U+a46, U+a49-U+a4a, U+a4d-U+a58, U+a5d, U+a5f-U+a6f,
+ U+a75-U+a80, U+a84, U+a8c, U+a8e, U+a92, U+aa9, U+ab1, U+ab4, U+aba-U+abc, U+ac6, U+aca,
+ U+acd-U+acf, U+ad1-U+adf, U+ae1-U+b00, U+b04, U+b0d-U+b0e, U+b11-U+b12, U+b29, U+b31, U+b34-U+b35,
+ U+b3a-U+b3c, U+b44-U+b46, U+b49 - U+b4a, U+b4d-U+b55, U+b58-U+b5b, U+b5e, U+b62-U+b81, U+b84,
+ U+b8b-U+b8d, U+b91, U+b96-U+b98, U+b9b, U+b9d, U+ba0 - U+ba2, U+ba5-U+ba7, U+bab-U+bad, U+bb6,
+ U+bba-U+bbd, U+bc3-U+bc5, U+bc9, U+bcd-U+bd6, U+bd8-U+c00, U+c04, U+c0d, U+c11, U+c29, U+c34,
+ U+c3a-U+c3d, U+c45, U+c49, U+c4d-U+c54, U+c57-U+c5f, U+c62-U+c81, U+c84, U+c8d, U+c91, U+ca9,
+ U+cb4, U+cba-U+cbd, U+cc5, U+cc9, U+ccd-U+cd4, U+cd7-U+cdd, U+cdf, U+ce2-U+d01, U+d04, U+d0d,
+ U+d11, U+d29, U+d3a-U+d3d, U+d44-U+d45, U+d49, U+d4d-U+d56, U+d58-U+d5f, U+d62-U+d81, U+d84,
+ U+d97-U+d99, U+db2, U+dbc, U+dbe - U+dbf, U+dc7-U+dce, U+dd5, U+dd7, U+de0-U+df1, U+df4-U+e00,
+ U+e3b-U+e3f, U+e4f-U+e80, U+e83, U+e85-U+e86, U+e89, U+e8b-U+e8c, U+e8e-U+e93, U+e98, U+ea0, U+ea4,
+ U+ea6, U+ea8-U+ea9, U+eac, U+eba, U+ebe-U+ebf, U+ec5-U+ecc, U+ece-U+edb, U+ede-U+eff, U+f01-U+f3f,
+ U+f48, U+f6b-U+f70, U+f82-U+f87, U+f8c-U+f8f, U+f98, U+fbd-U+fff, U+1022, U+1028, U+102b,
+ U+1033-U+1035, U+1037, U+1039-U+104f, U+105a-U+109f, U+10c6-U+10cf, U+10f7-U+10ff, U+115a - U+115e,
+ U+11a3-U+11a7, U+11fa-U+11ff, U+1207, U+1247, U+1249, U+124e-U+124f, U+1257, U+1259, U+125e-U+125f,
+ U+1287, U+1289, U+128e-U+128f, U+12af, U+12b1, U+12b6-U+12b7, U+12bf, U+12c1, U+12c6-U+12c7,
+ U+12cf, U+12d7, U+12ef, U+130f, U+1311, U+1316-U+1317, U+131f, U+1347, U+135b-U+139f,
+ U+13f5-U+1400, U+166d-U+166e, U+1677-U+1680, U+169b - U+169f, U+16eb-U+177f, U+17c9-U+181f, U+1843,
+ U+1878-U+187f, U+18aa-U+1dff, U+1e9c-U+1e9f, U+1efa-U+1eff, U+1f16-U+1f17, U+1f1e-U+1f1f,
+ U+1f46-U+1f47, U+1f4e-U+1f4f, U+1f58, U+1f5a, U+1f5c, U+1f5e, U+1f7e-U+1f7f, U+1fb5, U+1fbd,
+ U+1fbf-U+1fc1, U+1fc5, U+1fcd-U+1fcf, U+1fd4-U+1fd5, U+1fdc-U+1fdf, U+1fed-U+1ff1, U+1ff5,
+ U+1ffd-U+207e, U+2080-U+2101, U+2103-U+2106, U+2108-U+2109, U+2114, U+2116-U+2118, U+211e-U+2123,
+ U+2125, U+2127, U+2129, U+212e, U+2132, U+213a-U+215f, U+2184-U+3005, U+3008-U+3020, U+302a-U+3037,
+ U+303b-U+3104, U+312d-U+3130, U+318f - U+319f, U+31b8-U+33ff, U+4db6-U+4dff, U+9fa6-U+9fff,
+ U+a48d-U+abff, U+d7a4-U+d7ff, U+e000-U+f8ff, U+fa2e-U+faff, U+fb07-U+fb12, U+fb18-U+fb1c, U+fb1e,
+ U+fb29, U+fb37, U+fb3d, U+fb3f, U+fb42, U+fb45, U+fbb2-U+fbd2, U+fd3e-U+fd4f, U+fd90-U+fd91,
+ U+fdc8-U+fdef, U+fdfc-U+fe6f, U+fe73, U+fe75, U+fefd-U+ff20, U+ff3b-U+ff40, U+ff5b-U+ff9f,
+ U+ffbf-U+ffc1, U+ffc8-U+ffc9, U+ffd0-U+ffd1, U+ffd8-U+ffd9, U+ffdd-U+ffff
+-->
+
+ <dd>
+
+ <p>Follow these substeps:</p>
+
+ <ol>
+
+ <li>If <var data-x="">got number</var> is true, let <var data-x="">finished</var> be true.</li>
+
+ <li>If <var data-x="">finished</var> is true, skip to the next step in the overall set of
+ steps.</li>
+
+ <li>Let <var data-x="">negated</var> be false.</li>
+
+ </ol>
+
+ </dd>
+
+
+ <dt>Any other character</dt>
+ <!-- alphabetic a-z A-Z, and non-ASCII -->
+
+ <dd>
+
+ <p>Follow these substeps:</p>
+
+ <ol>
+
+ <li>If <var data-x="">finished</var> is true, skip to the next step in the overall set of
+ steps.</li>
+
+ <li>Let <var data-x="">negated</var> be false.</li>
+
+ <li>Let <var data-x="">bogus</var> be true.</li>
+
+ <li>If <var data-x="">started</var> is true, then return the <var data-x="">numbers</var> list,
+ and abort. (The value in <var data-x="">value</var> is not appended to the list first; it is
+ dropped.)</li>
+
+ </ol>
+
+ </dd>
+
+ </dl>
+
+ </li>
+
+ <li><p>Advance <var data-x="">position</var> to the next character in <var data-x="">input</var>,
+ or to beyond the end of the string if there are no more characters.</p></li>
+
+ <li><p>If <var data-x="">position</var> points to a character (and not to beyond the end of <var
+ data-x="">input</var>), jump to the big <i>Parser</i> step above.</p></li>
+
+ <li><p>If <var data-x="">negated</var> is true, then negate <var data-x="">value</var>.</li>
+
+ <li><p>If <var data-x="">got number</var> is true, then append <var data-x="">value</var> to the
+ <var data-x="">numbers</var> list.</li>
+
+ <li><p>Return the <var data-x="">numbers</var> list and abort.</p></li>
+
+ </ol>
+
+ </div>
+
+
+ <div class="nodev">
+
+ <h5>Lists of dimensions</h5>
+
+ <!-- no definition of a type since no conforming feature uses this syntax (it's only used in
+ cols="" and rows="" on <frameset> elements -->
+
+ <p>The <dfn>rules for parsing a list of dimensions</dfn> are as follows. These rules return a list
+ of zero or more pairs consisting of a number and a unit, the unit being one of <i>percentage</i>,
+ <i>relative</i>, and <i>absolute</i>.</p>
+
+ <ol>
+
+ <li><p>Let <var data-x="">raw input</var> be the string being parsed.</p></li>
+
+ <li><p>If the last character in <var data-x="">raw input</var> is a U+002C COMMA character (,),
+ then remove that character from <var data-x="">raw input</var>.</p></li>
+
+ <li><p><span data-x="split a string on commas">Split the string <var data-x="">raw input</var> on
+ commas</span>. Let <var data-x="">raw tokens</var> be the resulting list of tokens.</p></li>
+
+ <li><p>Let <var data-x="">result</var> be an empty list of number/unit pairs.</p></li>
+
+ <li>
+
+ <p>For each token in <var data-x="">raw tokens</var>, run the following substeps:</p>
+
+ <ol>
+
+ <li><p>Let <var data-x="">input</var> be the token.</p></li>
+
+ <li><p>Let <var data-x="">position</var> be a pointer into <var data-x="">input</var>,
+ initially pointing at the start of the string.</p></li>
+
+ <li><p>Let <var data-x="">value</var> be the number 0.</p></li>
+
+ <li><p>Let <var data-x="">unit</var> be <i>absolute</i>.</p></li>
+
+ <li><p>If <var data-x="">position</var> is past the end of <var data-x="">input</var>, set <var
+ data-x="">unit</var> to <i>relative</i> and jump to the last substep.</p></li>
+
+ <li><p>If the character at <var data-x="">position</var> is an <span data-x="ASCII
+ digits">ASCII digit</span>, <span>collect a sequence of characters</span> that are <span>ASCII
+ digits</span>, interpret the resulting sequence as an integer in base ten, and increment <var
+ data-x="">value</var> by that integer.</p></li>
+
+ <li>
+
+ <p>If the character at <var data-x="">position</var> is a U+002E FULL STOP character (.), run
+ these substeps:</p>
+
+ <ol>
+
+ <li><p><span>Collect a sequence of characters</span> consisting of <span data-x="space
+ character">space characters</span> and <span>ASCII digits</span>. Let <var data-x="">s</var>
+ be the resulting sequence.</p></li>
+
+ <li><p>Remove all <span data-x="space character">space characters</span> in <var
+ data-x="">s</var>.</p></li>
+
+ <li>
+
+ <p>If <var data-x="">s</var> is not the empty string, run these subsubsteps:</p>
+
+ <ol>
+
+ <li><p>Let <var data-x="">length</var> be the number of characters in <var
+ data-x="">s</var> (after the spaces were removed).</p></li>
+
+ <li><p>Let <var data-x="">fraction</var> be the result of interpreting <var
+ data-x="">s</var> as a base-ten integer, and then dividing that number by <span
+ data-x="">10<sup data-x=""><var data-x="">length</var></sup></span>.</li>
+
+ <li><p>Increment <var data-x="">value</var> by <var data-x="">fraction</var>.</p></li>
+
+ </ol>
+
+ </li>
+
+ </ol>
+
+ </li>
+
+ <li><p><span>Skip whitespace</span>.</p></li>
+
+ <li>
+
+ <p>If the character at <var data-x="">position</var> is a U+0025 PERCENT SIGN character (%),
+ then set <var data-x="">unit</var> to <i>percentage</i>.</p>
+
+ <p>Otherwise, if the character at <var data-x="">position</var> is a U+002A ASTERISK character
+ (*), then set <var data-x="">unit</var> to <i>relative</i>.</p>
+
+ </li>
+
+ <!-- the remaining characters in /input/ are ignored -->
+
+ <li><p>Add an entry to <var data-x="">result</var> consisting of the number given by <var
+ data-x="">value</var> and the unit given by <var data-x="">unit</var>.</p></li>
+
+ </ol>
+
+ </li>
+
+ <li><p>Return the list <var data-x="">result</var>.</p></li>
+
+ </ol>
+
+ </div>
+
+
+ <h4>Dates and times</h4>
+
+ <p>In the algorithms below, the <dfn>number of days in month <var data-x="">month</var> of year
+ <var data-x="">year</var></dfn> is: <em>31</em> if <var data-x="">month</var> is 1, 3, 5, 7, 8,
+ 10, or 12; <em>30</em> if <var data-x="">month</var> is 4, 6, 9, or 11; <em>29</em> if <var
+ data-x="">month</var> is 2 and <var data-x="">year</var> is a number divisible by 400, or if <var
+ data-x="">year</var> is a number divisible by 4 but not by 100; and <em>28</em> otherwise. This
+ takes into account leap years in the Gregorian calendar. <a
+ href="#refsGREGORIAN">[GREGORIAN]</a></p>
+
+ <p>When <span>ASCII digits</span> are used in the date and time syntaxes defined in this section,
+ they express numbers in base ten.</p>
+
+ <div class="nodev">
+
+ <p class="note">While the formats described here are intended to be subsets of the corresponding
+ ISO8601 formats, this specification defines parsing rules in much more detail than ISO8601.
+ Implementors are therefore encouraged to carefully examine any date parsing libraries before using
+ them to implement the parsing rules described below; ISO8601 libraries might not parse dates and
+ times in exactly the same manner. <a href="#refsISO8601">[ISO8601]</a></p>
+
+ </div>
+
+ <p>Where this specification refers to the <dfn>proleptic Gregorian calendar</dfn>, it means the
+ modern Gregorian calendar, extrapolated backwards to year 1. A date in the <span>proleptic
+ Gregorian calendar</span>, sometimes explicitly referred to as a <dfn>proleptic-Gregorian
+ date</dfn>, is one that is described using that calendar even if that calendar was not in use at
+ the time (or place) in question. <a href="#refsGREGORIAN">[GREGORIAN]</a></p>
+
+ <p class="note">The use of the Gregorian calendar as the wire format in this specification is an
+ arbitrary choice resulting from the cultural biases of those involved in the decision. See also
+ the section discussing <a href="#input-author-notes">date, time, and number formats</a> in forms
+ <span class="nodev">(for authors), <a href="#input-impl-notes">implemention notes regarding
+ localization of form controls</a>,</span> and the <code>time</code> element.</p>
+
+
+ <h5>Months</h5>
+
+ <p>A <dfn data-x="concept-month">month</dfn> consists of a specific <span>proleptic-Gregorian
+ date</span> with no time-zone information and no date information beyond a year and a month. <a
+ href="#refsGREGORIAN">[GREGORIAN]</a></p>
+
+ <p>A string is a <dfn>valid month string</dfn> representing a year <var data-x="">year</var> and
+ month <var data-x="">month</var> if it consists of the following components in the given order:</p>
+
+ <ol>
+
+ <li>Four or more <span>ASCII digits</span>, representing <var data-x="">year</var>, where <var
+ data-x="">year</var>&nbsp;&gt;&nbsp;0</li>
+
+ <li>A U+002D HYPHEN-MINUS character (-)</li>
+
+ <li>Two <span>ASCII digits</span>, representing the month <var data-x="">month</var>, in the range
+ 1&nbsp;&le;&nbsp;<var data-x="">month</var>&nbsp;&le;&nbsp;12</li>
+
+ </ol>
+
+ <div class="nodev">
+
+ <p>The rules to <dfn>parse a month string</dfn> are as follows. This will return either a year and
+ month, or nothing. If at any point the algorithm says that it "fails", this means that it is
+ aborted at that point and returns nothing.</p>
+
+ <ol>
+
+ <li><p>Let <var data-x="">input</var> be the string being parsed.</p></li>
+
+ <li><p>Let <var data-x="">position</var> be a pointer into <var data-x="">input</var>, initially
+ pointing at the start of the string.</p></li>
+
+ <li><p><span>Parse a month component</span> to obtain <var data-x="">year</var> and <var
+ data-x="">month</var>. If this returns nothing, then fail.</p>
+
+ <li><p>If <var data-x="">position</var> is <em>not</em> beyond the
+ end of <var data-x="">input</var>, then fail.</p></li>
+
+ <li><p>Return <var data-x="">year</var> and <var data-x="">month</var>.</p></li>
+
+ </ol>
+
+ <p>The rules to <dfn>parse a month component</dfn>, given an <var data-x="">input</var> string and
+ a <var data-x="">position</var>, are as follows. This will return either a year and a month, or
+ nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that
+ point and returns nothing.</p>
+
+ <ol>
+
+ <li><p><span>Collect a sequence of characters</span> that are <span>ASCII digits</span>. If the
+ collected sequence is not at least four characters long, then fail. Otherwise, interpret the
+ resulting sequence as a base-ten integer. Let that number be the <var
+ data-x="">year</var>.</p></li>
+
+ <li><p>If <var data-x="">year</var> is not a number greater than zero, then fail.</p></li>
+
+ <li><p>If <var data-x="">position</var> is beyond the end of <var data-x="">input</var> or if the
+ character at <var data-x="">position</var> is not a U+002D HYPHEN-MINUS character, then fail.
+ Otherwise, move <var data-x="">position</var> forwards one character.</p></li>
+
+ <li><p><span>Collect a sequence of characters</span> that are <span>ASCII digits</span>. If the
+ collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
+ resulting sequence as a base-ten integer. Let that number be the <var
+ data-x="">month</var>.</p></li>
+
+ <li><p>If <var data-x="">month</var> is not a number in the range 1&nbsp;&le;&nbsp;<var
+ data-x="">month</var>&nbsp;&le;&nbsp;12, then fail.</p></li>
+
+ <li><p>Return <var data-x="">year</var> and <var data-x="">month</var>.</p></li>
+
+ </ol>
+
+ </div>
+
+
+ <h5>Dates</h5>
+
+ <p>A <dfn data-x="concept-date">date</dfn> consists of a specific <span>proleptic-Gregorian
+ date</span> with no time-zone information, consisting of a year, a month, and a day. <a
+ href="#refsGREGORIAN">[GREGORIAN]</a></p>
+
+ <p>A string is a <dfn>valid date string</dfn> representing a year <var data-x="">year</var>, month
+ <var data-x="">month</var>, and day <var data-x="">day</var> if it consists of the following
+ components in the given order:</p>
+
+ <ol>
+
+ <li>A <span>valid month string</span>, representing <var data-x="">year</var> and <var
+ data-x="">month</var></li>
+
+ <li>A U+002D HYPHEN-MINUS character (-)</li>
+
+ <li>Two <span>ASCII digits</span>, representing <var data-x="">day</var>, in the range
+ 1&nbsp;&le;&nbsp;<var data-x="">day</var>&nbsp;&le;&nbsp;<var data-x="">maxday</var> where <var
+ data-x="">maxday</var> is the <span data-x="number of days in month month of year year">number of
+ days in the month <var data-x="">month</var> and year <var data-x="">year</var></span></li>
+
+ </ol>
+
+ <div class="nodev">
+
+ <p>The rules to <dfn>parse a date string</dfn> are as follows. This will return either a date, or
+ nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that
+ point and returns nothing.</p>
+
+ <ol>
+
+ <li><p>Let <var data-x="">input</var> be the string being parsed.</p></li>
+
+ <li><p>Let <var data-x="">position</var> be a pointer into <var data-x="">input</var>, initially
+ pointing at the start of the string.</p></li>
+
+ <li><p><span>Parse a date component</span> to obtain <var data-x="">year</var>, <var
+ data-x="">month</var>, and <var data-x="">day</var>. If this returns nothing, then fail.</p>
+
+ <li><p>If <var data-x="">position</var> is <em>not</em> beyond the end of <var
+ data-x="">input</var>, then fail.</p></li>
+
+ <li><p>Let <var data-x="">date</var> be the date with year <var data-x="">year</var>, month <var
+ data-x="">month</var>, and day <var data-x="">day</var>.</p></li>
+
+ <li><p>Return <var data-x="">date</var>.</p></li>
+
+ </ol>
+
+ <p>The rules to <dfn>parse a date component</dfn>, given an <var data-x="">input</var> string and a
+ <var data-x="">position</var>, are as follows. This will return either a year, a month, and a day,
+ or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at
+ that point and returns nothing.</p>
+
+ <ol>
+
+ <li><p><span>Parse a month component</span> to obtain <var data-x="">year</var> and <var
+ data-x="">month</var>. If this returns nothing, then fail.</li>
+
+ <li><p>Let <var data-x="">maxday</var> be the <span>number of days in month <var
+ data-x="">month</var> of year <var data-x="">year</var></span>.</p></li>
+
+ <li><p>If <var data-x="">position</var> is beyond the end of <var data-x="">input</var> or if the
+ character at <var data-x="">position</var> is not a U+002D HYPHEN-MINUS character, then fail.
+ Otherwise, move <var data-x="">position</var> forwards one character.</p></li>
+
+ <li><p><span>Collect a sequence of characters</span> that are <span>ASCII digits</span>. If the
+ collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
+ resulting sequence as a base-ten integer. Let that number be the <var
+ data-x="">day</var>.</p></li>
+
+ <li><p>If <var data-x="">day</var> is not a number in the range 1&nbsp;&le;&nbsp;<var
+ data-x="">day</var>&nbsp;&le;&nbsp;<var data-x="">maxday</var>, then fail.</li>
+
+ <li><p>Return <var data-x="">year</var>, <var data-x="">month</var>, and <var
+ data-x="">day</var>.</p></li>
+
+ </ol>
+
+ </div>
+
+
+ <h5>Yearless dates</h5>
+
+ <p>A <dfn data-x="concept-yearless-date">yearless date</dfn> consists of a Gregorian month and a
+ day within that month, but with no associated year. <a href="#refsGREGORIAN">[GREGORIAN]</a></p>
+
+ <p>A string is a <dfn>valid yearless date string</dfn> representing a month <var
+ data-x="">month</var> and a day <var data-x="">day</var> if it consists of the following components
+ in the given order:</p>
+
+ <ol>
+
+ <li>Optionally, two U+002D HYPHEN-MINUS characters (-)</li>
+
+ <li>Two <span>ASCII digits</span>, representing the month <var data-x="">month</var>, in the range
+ 1&nbsp;&le;&nbsp;<var data-x="">month</var>&nbsp;&le;&nbsp;12</li>
+
+ <li>A U+002D HYPHEN-MINUS character (-)</li>
+
+ <li>Two <span>ASCII digits</span>, representing <var data-x="">day</var>, in the range
+ 1&nbsp;&le;&nbsp;<var data-x="">day</var>&nbsp;&le;&nbsp;<var data-x="">maxday</var> where <var
+ data-x="">maxday</var> is the <span data-x="number of days in month month of year year">number of
+ days</span> in the month <var data-x="">month</var> and any arbitrary leap year (e.g. 4 or
+ 2000)</li>
+
+ </ol>
+
+ <p class="note">In other words, if the <var data-x="">month</var> is "<code data-x="">02</code>",
+ meaning February, then the day can be 29, as if the year was a leap year.</p>
+
+ <div class="nodev">
+
+ <p>The rules to <dfn>parse a yearless date string</dfn> are as follows. This will return either a
+ month and a day, or nothing. If at any point the algorithm says that it "fails", this means that
+ it is aborted at that point and returns nothing.</p>
+
+ <ol>
+
+ <li><p>Let <var data-x="">input</var> be the string being parsed.</p></li>
+
+ <li><p>Let <var data-x="">position</var> be a pointer into <var data-x="">input</var>, initially
+ pointing at the start of the string.</p></li>
+
+ <li><p><span>Parse a yearless date component</span> to obtain <var data-x="">month</var> and <var
+ data-x="">day</var>. If this returns nothing, then fail.</p>
+
+ <li><p>If <var data-x="">position</var> is <em>not</em> beyond the end of <var
+ data-x="">input</var>, then fail.</p></li>
+
+ <li><p>Return <var data-x="">month</var> and <var data-x="">day</var>.</p></li>
+
+ </ol>
+
+ <p>The rules to <dfn>parse a yearless date component</dfn>, given an <var data-x="">input</var>
+ string and a <var data-x="">position</var>, are as follows. This will return either a month and a
+ day, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted
+ at that point and returns nothing.</p>
+
+ <ol>
+
+ <li><p><span>Collect a sequence of characters</span> that are U+002D HYPHEN-MINUS characters (-).
+ If the collected sequence is not exactly zero or two characters long, then fail.</p></li>
+
+ <li><p><span>Collect a sequence of characters</span> that are <span>ASCII digits</span>. If the
+ collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
+ resulting sequence as a base-ten integer. Let that number be the <var
+ data-x="">month</var>.</p></li>
+
+ <li><p>If <var data-x="">month</var> is not a number in the range 1&nbsp;&le;&nbsp;<var
+ data-x="">month</var>&nbsp;&le;&nbsp;12, then fail.</p></li>
+
+ <li><p>Let <var data-x="">maxday</var> be the <span data-x="number of days in month month of year
+ year">number of days</span> in month <var data-x="">month</var> of any arbitrary leap year (e.g. 4
+ or 2000).</p></li>
+
+ <li><p>If <var data-x="">position</var> is beyond the end of <var data-x="">input</var> or if the
+ character at <var data-x="">position</var> is not a U+002D HYPHEN-MINUS character, then fail.
+ Otherwise, move <var data-x="">position</var> forwards one character.</p></li>
+
+ <li><p><span>Collect a sequence of characters</span> that are <span>ASCII digits</span>. If the
+ collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
+ resulting sequence as a base-ten integer. Let that number be the <var
+ data-x="">day</var>.</p></li>
+
+ <li><p>If <var data-x="">day</var> is not a number in the range 1&nbsp;&le;&nbsp;<var
+ data-x="">day</var>&nbsp;&le;&nbsp;<var data-x="">maxday</var>, then fail.</li>
+
+ <li><p>Return <var data-x="">month</var> and <var data-x="">day</var>.</p></li>
+
+ </ol>
+
+ </div>
+
+
+ <h5>Times</h5>
+
+ <p>A <dfn data-x="concept-time">time</dfn> consists of a specific time with no time-zone
+ information, consisting of an hour, a minute, a second, and a fraction of a second.</p>
+
+ <p>A string is a <dfn>valid time string</dfn> representing an hour <var data-x="">hour</var>, a
+ minute <var data-x="">minute</var>, and a second <var data-x="">second</var> if it consists of the
+ following components in the given order:</p>
+
+ <ol>
+
+ <li>Two <span>ASCII digits</span>, representing <var data-x="">hour</var>, in the range
+ 0&nbsp;&le;&nbsp;<var data-x="">hour</var>&nbsp;&le;&nbsp;23</li>
+
+ <li>A U+003A COLON character (:)</li>
+
+ <li>Two <span>ASCII digits</span>, representing <var data-x="">minute</var>, in the range
+ 0&nbsp;&le;&nbsp;<var data-x="">minute</var>&nbsp;&le;&nbsp;59</li>
+
+ <li>If <var data-x="">second</var> is non-zero, or optionally if <var data-x="">second</var> is
+ zero:
+
+ <ol>
+
+ <li>A U+003A COLON character (:)</li>
+
+ <li>Two <span>ASCII digits</span>, representing the integer part of <var data-x="">second</var>,
+ in the range 0&nbsp;&le;&nbsp;<var data-x="">s</var>&nbsp;&le;&nbsp;59</li>
+
+ <li>If <var data-x="">second</var> is not an integer, or optionally if <var
+ data-x="">second</var> is an integer:
+
+ <ol>
+
+ <li>A 002E FULL STOP character (.)</li>
+
+ <li>One, two, or three <span>ASCII digits</span>, representing the fractional part of <var
+ data-x="">second</var></li>
+
+ </ol>
+
+ </li>
+
+ </ol>
+
+ </li>
+
+ </ol>
+
+ <p class="note">The <var data-x="">second</var> component cannot be 60 or 61; leap seconds cannot
+ be represented.</p>
+
+ <div class="nodev">
+
+ <p>The rules to <dfn>parse a time string</dfn> are as follows. This will return either a time, or
+ nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that
+ point and returns nothing.</p>
+
+ <ol>
+
+ <li><p>Let <var data-x="">input</var> be the string being parsed.</p></li>
+
+ <li><p>Let <var data-x="">position</var> be a pointer into <var data-x="">input</var>, initially
+ pointing at the start of the string.</p></li>
+
+ <li><p><span>Parse a time component</span> to obtain <var data-x="">hour</var>, <var
+ data-x="">minute</var>, and <var data-x="">second</var>. If this returns nothing, then fail.</p>
+
+ <li><p>If <var data-x="">position</var> is <em>not</em> beyond the end of <var
+ data-x="">input</var>, then fail.</p></li>
+
+ <li><p>Let <var data-x="">time</var> be the time with hour <var data-x="">hour</var>, minute <var
+ data-x="">minute</var>, and second <var data-x="">second</var>.</p></li>
+
+ <li><p>Return <var data-x="">time</var>.</p></li>
+
+ </ol>
+
+ <p>The rules to <dfn>parse a time component</dfn>, given an <var data-x="">input</var> string and a
+ <var data-x="">position</var>, are as follows. This will return either an hour, a minute, and a
+ second, or nothing. If at any point the algorithm says that it "fails", this means that it is
+ aborted at that point and returns nothing.</p>
+
+ <ol>
+
+ <li><p><span>Collect a sequence of characters</span> that are <span>ASCII digits</span>. If the
+ collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
+ resulting sequence as a base-ten integer. Let that number be the <var
+ data-x="">hour</var>.</p></li>
+
+ <li>If <var data-x="">hour</var> is not a number in the range 0&nbsp;&le;&nbsp;<var
+ data-x="">hour</var>&nbsp;&le;&nbsp;23, then fail.</li>
+
+ <li><p>If <var data-x="">position</var> is beyond the end of <var data-x="">input</var> or if the
+ character at <var data-x="">position</var> is not a U+003A COLON character, then fail. Otherwise,
+ move <var data-x="">position</var> forwards one character.</p></li>
+
+ <li><p><span>Collect a sequence of characters</span> that are <span>ASCII digits</span>. If the
+ collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
+ resulting sequence as a base-ten integer. Let that number be the <var
+ data-x="">minute</var>.</p></li>
+
+ <li>If <var data-x="">minute</var> is not a number in the range 0&nbsp;&le;&nbsp;<var
+ data-x="">minute</var>&nbsp;&le;&nbsp;59, then fail.</li>
+
+ <li><p>Let <var data-x="">second</var> be a string with the value "0".</p></li>
+
+ <li>
+
+ <p>If <var data-x="">position</var> is not beyond the end of <var data-x="">input</var> and the
+ character at <var data-x="">position</var> is a U+003A COLON, then run these substeps:</p>
+
+ <ol>
+
+ <li><p>Advance <var data-x="">position</var> to the next character in <var
+ data-x="">input</var>.</p></li>
+
+ <li><p>If <var data-x="">position</var> is beyond the end of <var data-x="">input</var>, or at
+ the last character in <var data-x="">input</var>, or if the next <em>two</em> characters in <var
+ data-x="">input</var> starting at <var data-x="">position</var> are not both <span>ASCII
+ digits</span>, then fail.</p></li>
+
+ <li><p><span>Collect a sequence of characters</span> that are either <span>ASCII digits</span>
+ or U+002E FULL STOP characters. If the collected sequence is three characters long, or if it is
+ longer than three characters long and the third character is not a U+002E FULL STOP character,
+ or if it has more than one U+002E FULL STOP character, then fail. Otherwise, let the collected
+ string be <var data-x="">second</var> instead of its previous value.</p></li>
+
+ </ol>
+
+ </li>
+
+ <li><p>Interpret <var data-x="">second</var> as a base-ten number (possibly with a fractional
+ part). Let <var data-x="">second</var> be that number instead of the string version.</p></li>
+
+ <li><p>If <var data-x="">second</var> is not a number in the range 0&nbsp;&le;&nbsp;<var
+ data-x="">second</var>&nbsp;&lt;&nbsp;60, then fail.</p></li>
+
+ <li><p>Return <var data-x="">hour</var>, <var data-x="">minute</var>, and <var
+ data-x="">second</var>.</p></li>
+
+ </ol>
+
+ </div>
+
+
+ <h5>Local dates and times</h5>
+
+ <p>A <dfn data-x="concept-datetime-local">local date and time</dfn> consists of a specific
+ <span>proleptic-Gregorian date</span>, consisting of a year, a month, and a day, and a time,
+ consisting of an hour, a minute, a second, and a fraction of a second, but expressed without a
+ time zone. <a href="#refsGREGORIAN">[GREGORIAN]</a></p>
+
+ <p>A string is a <dfn>valid local date and time string</dfn> representing a date and time if it
+ consists of the following components in the given order:</p>
+
+ <ol>
+
+ <li>A <span>valid date string</span> representing the date</li>
+
+ <li>A U+0054 LATIN CAPITAL LETTER T character (T) or a U+0020 SPACE character</li>
+
+ <li>A <span>valid time string</span> representing the time</li>
+
+ </ol>
+
+ <p>A string is a <dfn>valid normalised local date and time string</dfn> representing a date and
+ time if it consists of the following components in the given order:</p>
+
+ <ol>
+
+ <li>A <span>valid date string</span> representing the date</li>
+
+ <li>A U+0054 LATIN CAPITAL LETTER T character (T)</li>
+
+ <li>A <span>valid time string</span> representing the time, expressed as the shortest possible
+ string for the given time (e.g. omitting the seconds component entirely if the given time is zero
+ seconds past the minute)</li>
+
+ </ol>
+
+ <div class="nodev">
+
+ <p>The rules to <dfn>parse a local date and time string</dfn> are as follows. This will return
+ either a date and time, or nothing. If at any point the algorithm says that it "fails", this means
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/LICENSE.md b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/LICENSE.md
new file mode 100644
index 0000000000..ad4858c874
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/LICENSE.md
@@ -0,0 +1,11 @@
+# The 3-Clause BSD License
+
+Copyright 2019 web-platform-tests contributors
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/README.md b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/README.md
new file mode 100644
index 0000000000..61b656941b
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/README.md
@@ -0,0 +1,52 @@
+This directory contains a number of tests from
+[web-platform-tests](https://github.com/web-platform-tests/wpt) at
+77585330fd7da01392aec01cf5fed7aa22597180, chosen from the files processed by the manifest script.
+
+These files are split into two directories:
+
+ * `weighted`, a set of 15 tests curated from a random weighted sample of 30, weighted by parse
+ time as of html5lib 1.0.1. The curation was performed primarily as many of the slowest files are
+ very similar and therefore provide little extra coverage while it is relatively probable both
+ with be chosen. This provides a set of files which significantly contribute to the manifest
+ generation time.
+
+ * `random`, a further set of 15 tests, this time a random unweighted sample of 15. This provides a
+ set of files much closer to the average file in WPT.
+
+The files are sourced from the following:
+
+`weighted`:
+
+ * `css/compositing/test-plan/test-plan.src.html`
+ * `css/css-flexbox/align-content-wrap-002.html`
+ * `css/css-grid/grid-definition/grid-auto-fill-rows-001.html`
+ * `css/css-grid/masonry.tentative/masonry-item-placement-006.html`
+ * `css/css-images/image-orientation/reference/image-orientation-from-image-content-images-ref.html`
+ * `css/css-position/position-sticky-table-th-bottom-ref.html`
+ * `css/css-text/white-space/pre-float-001.html`
+ * `css/css-ui/resize-004.html`
+ * `css/css-will-change/will-change-abspos-cb-001.html`
+ * `css/filter-effects/filter-turbulence-invalid-001.html`
+ * `css/vendor-imports/mozilla/mozilla-central-reftests/css21/pagination/moz-css21-table-page-break-inside-avoid-2.html`
+ * `encoding/legacy-mb-tchinese/big5/big5_chars_extra.html`
+ * `html/canvas/element/compositing/2d.composite.image.destination-over.html`
+ * `html/semantics/embedded-content/the-canvas-element/toBlob.png.html`
+ * `referrer-policy/4K-1/gen/top.http-rp/unsafe-url/fetch.http.html`
+
+`random`:
+
+ * `content-security-policy/frame-ancestors/frame-ancestors-self-allow.html`
+ * `css/css-backgrounds/reference/background-origin-007-ref.html`
+ * `css/css-fonts/idlharness.html`
+ * `css/css-position/static-position/htb-ltr-ltr.html`
+ * `css/vendor-imports/mozilla/mozilla-central-reftests/css21/pagination/moz-css21-float-page-break-inside-avoid-6.html`
+ * `css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-content-box-002.html`
+ * `encoding/legacy-mb-korean/euc-kr/euckr-encode-form.html`
+ * `html/browsers/browsing-the-web/unloading-documents/beforeunload-on-history-back-1.html`
+ * `html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/001.html`
+ * `html/editing/dnd/overlay/heavy-styling-005.html`
+ * `html/rendering/non-replaced-elements/lists/li-type-unsupported-ref.html`
+ * `html/semantics/grouping-content/the-dl-element/grouping-dl.html`
+ * `trusted-types/worker-constructor.https.html`
+ * `webvtt/rendering/cues-with-video/processing-model/selectors/cue/background_shorthand_css_relative_url.html`
+ * `IndexedDB/idbindex_get8.htm`
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/001.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/001.html
new file mode 100644
index 0000000000..7b0f21ec04
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/001.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<title>Accessing named windows from outside the unit of related browsing contexts</title>
+<a href="001-1.html" target="test_name">Click here</a>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/background-origin-007-ref.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/background-origin-007-ref.html
new file mode 100644
index 0000000000..d3a1d05328
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/background-origin-007-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Backgrounds and Borders Reference</title>
+<link rel="author" title="Intel" href="http://www.intel.com">
+<style>
+ div {
+ background-color: green;
+ height: 55px;
+ left: 5px;
+ position: relative;
+ top: 5px;
+ width: 55px;
+ }
+</style>
+<body>
+ <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+ <div></div>
+</body>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/background_shorthand_css_relative_url.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/background_shorthand_css_relative_url.html
new file mode 100644
index 0000000000..2397fec005
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/background_shorthand_css_relative_url.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<title>WebVTT rendering, ::cue, background shorthand, background image URL with relative path from CSS file</title>
+<link rel="match" href="background_shorthand_css_relative_url-ref.html">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+html { overflow:hidden }
+body { margin:0 }
+::cue {
+ font-family: Ahem, sans-serif;
+ background: #0f0 url('../../media/background.gif') repeat-x top left;
+ color: green;
+}
+</style>
+<script src="/common/reftest-wait.js"></script>
+<video width="320" height="180" autoplay onplaying="this.onplaying = null; this.pause(); takeScreenshot();">
+ <source src="/media/white.webm" type="video/webm">
+ <source src="/media/white.mp4" type="video/mp4">
+ <track src="../../support/test.vtt">
+ <script>
+ document.getElementsByTagName('track')[0].track.mode = 'showing';
+ </script>
+</video>
+</html>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/beforeunload-on-history-back-1.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/beforeunload-on-history-back-1.html
new file mode 100644
index 0000000000..4403cfa8e9
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/beforeunload-on-history-back-1.html
@@ -0,0 +1,5 @@
+<!doctype html>
+001-1
+<script>
+addEventListener("beforeunload", function() {top.t.step(function() {top.beforeunload_fired = true})}, false);
+</script>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/euckr-encode-form.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/euckr-encode-form.html
new file mode 100644
index 0000000000..545f8ac93f
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/euckr-encode-form.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="euc-kr"> <!-- test breaks if the server overrides this -->
+<title>EUC-KR encoding (form)</title>
+<meta name="timeout" content="long">
+<meta name="variant" content="?1-1000">
+<meta name="variant" content="?1001-2000">
+<meta name="variant" content="?2001-3000">
+<meta name="variant" content="?3001-4000">
+<meta name="variant" content="?4001-5000">
+<meta name="variant" content="?5001-6000">
+<meta name="variant" content="?6001-7000">
+<meta name="variant" content="?7001-8000">
+<meta name="variant" content="?8001-9000">
+<meta name="variant" content="?9001-10000">
+<meta name="variant" content="?10001-11000">
+<meta name="variant" content="?11001-12000">
+<meta name="variant" content="?12001-13000">
+<meta name="variant" content="?13001-14000">
+<meta name="variant" content="?14001-15000">
+<meta name="variant" content="?15001-16000">
+<meta name="variant" content="?16001-17000">
+<meta name="variant" content="?17001-last">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/subset-tests.js"></script>
+<script src="euckr_index.js"></script>
+<script src="euckr-encoder.js"></script>
+<link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
+<link rel="help" href="https://encoding.spec.whatwg.org/#euc-kr">
+<meta name="assert" content="The browser produces the expected byte sequences for all characters in the euc-kr encoding after 0x9F when encoding bytes for a URL produced by a form, using the encoder steps in the specification.">
+<style>
+ iframe { display:none }
+ form { display:none }
+</style>
+</head>
+<body>
+<div id="log"></div>
+<script src="../../resources/ranges.js"></script>
+<script>
+var errors = false;
+var encoder = euckrEncoder;
+var ranges = rangesAll;
+var separator = ",";
+function expect(result, codepoint) {
+ return "%" + result.replace(/ /g, "%");
+}
+</script>
+<script src="../../resources/encode-form-common.js"></script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/frame-ancestors-self-allow.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/frame-ancestors-self-allow.html
new file mode 100644
index 0000000000..a8a295dfc4
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/frame-ancestors-self-allow.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="support/frame-ancestors-test.sub.js"></script>
+</head>
+<body>
+ <script>
+ test = async_test("A 'frame-ancestors' CSP directive with a value 'self' should allow rendering.");
+
+ sameOriginFrameShouldBeAllowed("'self'");
+ </script>
+</body>
+</html>
+
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/grouping-dl.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/grouping-dl.html
new file mode 100644
index 0000000000..2394d6a929
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/grouping-dl.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>the dl element</title>
+ <link rel="author" title="dzenana" href="mailto:dzenana.trenutak@gmail.com">
+ <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-dl-element">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script>
+ "use strict";
+
+ // check that prototype matches spec's DOM interface
+ test(function () {
+ var testElement = document.createElement("dl");
+ assert_equals(Object.getPrototypeOf(testElement), HTMLDListElement.prototype, "HTMLDListElement.prototype should be used for dl");
+ }, "The prototype for dl is HTMLDListElement.prototype");
+
+ // Not checking: effects of markup on defining groups and the name-pair values within those groups
+
+ </script>
+</head>
+<body>
+ <h1>Description</h1>
+ <p>This test validates the dl element.</p>
+
+ <div id="log"></div>
+
+</body>
+</html>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/heavy-styling-005.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/heavy-styling-005.html
new file mode 100644
index 0000000000..2bbdb3cf73
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/heavy-styling-005.html
@@ -0,0 +1,15 @@
+<!DOCTYPe html>
+<meta charset='utf-8'>
+<title>drag and drop – feedback overlay for heavily styled elements – 005</title>
+<style>
+a {
+ display: block;
+ height: 200px;
+ width: 200px;
+ background-color: rgba(0,0,255,0.5);
+}
+</style>
+
+<p>Drag the blue box below downwards. The drag placeholder should resemble the blue box, including the text within it.</p>
+
+<a draggable="true" ondragstart="event.dataTransfer.effectAllowed ='copy'">TEST</a>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/htb-ltr-ltr.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/htb-ltr-ltr.html
new file mode 100644
index 0000000000..5a19c0e9cc
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/htb-ltr-ltr.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css2/visudet.html#abs-non-replaced-width" />
+<link rel="match" href="htb-ref.html">
+<meta name="assert" content="This test checks the static position of an out of flow absolute positioned element, under various conditions." />
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+.container {
+ position: relative;
+ background: green;
+ color: green;
+ font: 16px/1 Ahem;
+ border: solid black 3px;
+ width: 400px;
+ margin: 16px 0;
+}
+.red { color: red; }
+.cb { position: relative; }
+.rtl { direction: rtl; }
+.ltr { direction: ltr; }
+.inline { display: inline; }
+.abs { position: absolute; }
+
+.indent { text-indent: 20px; }
+* { text-indent: initial; }
+</style>
+
+There should be no red.
+<div class="container ltr">
+ XXX<span class="ltr">XX<div class="abs inline">XXXXX</div><span class="red">XXXXX</span></span>
+</div>
+
+<div class="container ltr indent">
+ XXX<span class="ltr">XX<div class="abs inline">XXXXX</div><span class="red">XXXXX</span></span>
+</div>
+
+<div class="container ltr">
+ XXX<span class="ltr">XX<div class="abs block">XXXXX</div><br><span class="red">XXXXX</span></span>
+</div>
+
+<div class="container ltr indent">
+ XXX<span class="ltr">XX<div class="abs block">XXXXX</div><br><span class="red">XXXXX</span></span>
+</div>
+
+<div class="container ltr">
+ XXX<span class="ltr cb">XX<div class="abs inline">XXXXX</div><span class="red">XXXXX</span></span>
+</div>
+
+<div class="container ltr indent">
+ XXX<span class="ltr cb">XX<div class="abs inline">XXXXX</div><span class="red">XXXXX</span></span>
+</div>
+
+<div class="container ltr">
+ XXX<span class="ltr cb">XX<div class="abs block">XXXXX</div><br><span class="red">XXXXX</span></span>
+</div>
+
+<div class="container ltr indent">
+ XXX<span class="ltr cb">XX<div class="abs block">XXXXX</div><br><span class="red">XXXXX</span></span>
+</div>
+
+<div class="container ltr">
+ <span class="cb">XXX<span class="ltr">XX<div class="abs inline">XXXXX</div><span class="red">XXXXX</span></span></span>
+</div>
+
+<div class="container ltr indent">
+ <span class="cb">XXX<span class="ltr">XX<div class="abs inline">XXXXX</div><span class="red">XXXXX</span></span></span>
+</div>
+
+<div class="container ltr">
+ <span class="cb">XXX<span class="ltr">XX<div class="abs block">XXXXX</div><br><span class="red">XXXXX</span></span></span>
+</div>
+
+<div class="container ltr indent">
+ <span class="cb">XXX<span class="ltr">XX<div class="abs block">XXXXX</div><br><span class="red">XXXXX</span></span></span>
+</div>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/idbindex_get8.htm b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/idbindex_get8.htm
new file mode 100644
index 0000000000..9bfc48422f
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/idbindex_get8.htm
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>IDBIndex.get() - throw InvalidStateError on index deleted by aborted upgrade</title>
+<link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idb">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=support.js></script>
+<div id="log"></div>
+<script>
+ var db,
+ t = async_test();
+
+ var open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ var store = db.createObjectStore("store", { keyPath: "key" });
+ var index = store.createIndex("index", "indexedProperty");
+ store.add({ key: 1, indexedProperty: "data" });
+
+ e.target.transaction.abort();
+
+ assert_throws_dom("InvalidStateError", function(){
+ index.get("data");
+ });
+ t.done();
+ }
+</script>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/idlharness.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/idlharness.html
new file mode 100644
index 0000000000..ecc601bcf6
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/idlharness.html
@@ -0,0 +1,34 @@
+<!doctype html>
+<title>CSS Fonts IDL tests</title>
+<link rel="help" href="https://drafts.csswg.org/css-fonts-4/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/WebIDLParser.js"></script>
+<script src="/resources/idlharness.js"></script>
+
+<style>
+ div { display: block; }
+</style>
+<style>
+ @font-face {
+ font-family: fwf;
+ src: url(support/fonts/FontWithFancyFeatures.otf);
+ }
+</style>
+
+<script>
+ "use strict";
+
+ idl_test(
+ ["css-fonts"],
+ ["cssom"],
+ idl_array => {
+ idl_array.add_objects({
+ CSSRule: ['cssRule'],
+ CSSFontFaceRule: ['cssFontFaceRule'],
+ });
+ self.cssRule = document.styleSheets[0].cssRules[0];
+ self.cssFontFaceRule = document.styleSheets[1].cssRules[0];
+ }
+ );
+</script>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/li-type-unsupported-ref.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/li-type-unsupported-ref.html
new file mode 100644
index 0000000000..4fbc5aca97
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/li-type-unsupported-ref.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>li@type: unsupported types</title>
+<li>first item</li>
+<li>second item</li>
+<ol>
+ <li>first ordered item</li>
+ <li>second ordered item</li>
+</ol>
+<ul>
+ <li>first unordered item</li>
+ <li>second unordered item</li>
+</ul>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/moz-css21-float-page-break-inside-avoid-6.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/moz-css21-float-page-break-inside-avoid-6.html
new file mode 100644
index 0000000000..3cd0a5fb1c
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/moz-css21-float-page-break-inside-avoid-6.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en-US" class="reftest-paged">
+<head>
+ <title>CSS Test: CSS 2.1 page-break-inside:avoid</title>
+ <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=685012">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/page.html#propdef-page-break-inside">
+ <link rel="match" href="moz-css21-float-page-break-inside-avoid-6-ref.html">
+ <meta name="flags" content="paged">
+<style type="text/css">
+@page { size:5in 3in; margin:0.5in; }
+html,body {
+ color:black; background-color:white; font-size:16px; padding:0; margin:0; height:100%;
+}
+p { height:60%; width:90%; margin:0; background-color:blue; border:1px solid black; }
+.test { page-break-inside:avoid; float:left; }
+</style>
+</head>
+<body><p>1</p><p class="test">2</p></body>
+</html>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/shape-outside-content-box-002.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/shape-outside-content-box-002.html
new file mode 100644
index 0000000000..e2040763df
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/shape-outside-content-box-002.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+
+<html>
+ <title>CSS Shape Test: float right, content-box</title>
+ <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
+ <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+ <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#shapes-from-box-values">
+ <link rel="match" href="shape-outside-content-box-002-ref.html">
+ <meta name="flags" content="">
+ <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the content-box value.">
+ <style>
+ .container {
+ direction: rtl;
+ width: 175px;
+ line-height: 0;
+ }
+
+ .shape {
+ float: right;
+ shape-outside: content-box;
+ box-sizing: content-box;
+ height: 25px;
+ width: 25px;
+ padding: 25px;
+ border: 25px solid lightgreen;
+ margin: 25px;
+ background-color: orange;
+ }
+
+ .box {
+ display: inline-block;
+ width: 50px;
+ height: 25px;
+ background-color: blue;
+ }
+
+ .longbox {
+ display: inline-block;
+ width: 175px;
+ height: 25px;
+ background-color: blue;
+ }
+ </style>
+
+ <main class="container">
+ <div class="shape"></div>
+ <div class="shape"></div>
+ <div class="longbox"></div> <!-- Saturate the margin space -->
+ <div class="longbox"></div> <!-- Saturate the border space -->
+ <div class="longbox"></div> <!-- Saturate the padding space -->
+ <div class="box"></div>
+ <div class="longbox"></div> <!-- Saturate the padding space -->
+ <div class="longbox"></div> <!-- Saturate the border space -->
+ <div class="longbox"></div> <!-- Saturate the margin space -->
+
+ <div class="longbox"></div> <!-- Saturate the margin space -->
+ <div class="longbox"></div> <!-- Saturate the border space -->
+ <div class="longbox"></div> <!-- Saturate the padding space -->
+ <div class="box"></div>
+ <div class="longbox"></div> <!-- Saturate the padding space -->
+ <div class="longbox"></div> <!-- Saturate the border space -->
+ <div class="longbox"></div> <!-- Saturate the margin space -->
+ </main>
+</html>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/worker-constructor.https.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/worker-constructor.https.html
new file mode 100644
index 0000000000..6e127b11a5
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/random/worker-constructor.https.html
@@ -0,0 +1,86 @@
+<!doctype html>
+<html>
+<head>
+ <meta http-equiv="Content-Security-Policy" content="require-trusted-types-for 'script';">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<script>
+
+const test_url = "support/WorkerGlobalScope-importScripts.https.js"
+const trusted_url = trustedTypes.createPolicy("anythinggoes", {
+ createScriptURL: x => x}).createScriptURL(test_url);
+const default_url = "support/WorkerGlobalScope-importScripts.potato.js"
+
+async function service_worker(url) {
+ if (!('serviceWorker' in navigator)) return Promise.resolve();
+
+ const scope = 'support/some/scope/for/this/test';
+ const reg = await navigator.serviceWorker.getRegistration(scope);
+ if (reg) await reg.unregister();
+ return await navigator.serviceWorker.register(url, {scope});
+}
+
+// Most tests below don't need promises, but the ones related to
+// ServiceWorkers do. Since we can't mix promise and non-promise tests,
+// we'll just run the non-promise tests in the main function and return
+// an empty-resolved promise for those.
+// Since an active default policy will affect all subsequent DOM operations,
+// we're wrapping policy creation in a promise_test. Together, this will
+// force proper serialization of all tests.
+//
+// Generally, we don't actually care what the workers here do, we'll merely
+// check whether creation succeeds.
+
+promise_test(t => {
+ new Worker(trusted_url);
+ return Promise.resolve();
+}, "Create Worker via ScriptTestUrl");
+
+promise_test(t => {
+ new SharedWorker(trusted_url);
+ return Promise.resolve();
+}, "Create SharedWorker via ScriptTestUrl");
+
+promise_test(t => {
+ return service_worker(trusted_url);
+}, "Create ServiceWorker via ScriptTestUrl");
+
+promise_test(t => {
+ assert_throws_js(TypeError, () => new Worker(test_url));
+ return Promise.resolve();
+}, "Block Worker creation via string");
+
+promise_test(t => {
+ assert_throws_js(TypeError, () => new SharedWorker(test_url));
+ return Promise.resolve();
+}, "Block SharedWorker creation via string");
+
+promise_test(t => {
+ return promise_rejects_js(t, TypeError, service_worker(test_url));
+}, "Block ServiceWorker creation via String");
+
+// Tests with default policy.
+promise_test(t => {
+ trustedTypes.createPolicy("default", {
+ createScriptURL: s => s.replace("potato", "https") });
+ return Promise.resolve();
+}, "Setup default policy.");
+
+promise_test(t => {
+ new Worker(default_url);
+ return Promise.resolve();
+}, "Create Worker via string with default policy.");
+
+promise_test(t => {
+ new SharedWorker(default_url);
+ return Promise.resolve();
+}, "Create SharedWorker via string with default policy.");
+
+promise_test(t => {
+ return service_worker(default_url);
+}, "Create ServiceWorker via string with default policy.");
+
+</script>
+</body>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/2d.composite.image.destination-over.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/2d.composite.image.destination-over.html
new file mode 100644
index 0000000000..d742f84dfb
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/2d.composite.image.destination-over.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.composite.image.destination-over</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
+<body class="show_output">
+
+<h1>2d.composite.image.destination-over</h1>
+<p class="desc"></p>
+
+
+<p class="output">Actual output:</p>
+<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+<p class="output expectedtext">Expected output:<p><img src="2d.composite.image.destination-over.png" class="output expected" id="expected" alt="">
+<ul id="d"></ul>
+<script>
+var t = async_test("");
+_addTest(function(canvas, ctx) {
+
+
+ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
+ctx.fillRect(0, 0, 100, 50);
+ctx.globalCompositeOperation = 'destination-over';
+ctx.drawImage(document.getElementById('yellow75.png'), 0, 0);
+_assertPixelApprox(canvas, 50,25, 109,255,146,223, "50,25", "109,255,146,223", 5);
+
+
+});
+</script>
+<img src="/images/yellow75.png" id="yellow75.png" class="resource">
+
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/align-content-wrap-002.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/align-content-wrap-002.html
new file mode 100644
index 0000000000..a15f7ea844
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/align-content-wrap-002.html
@@ -0,0 +1,108 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-flexbox/#propdef-align-content" />
+<title>css-flexbox: Tests align-content with flex-wrap: wrap</title>
+<style>
+.flex-horizontal {
+ width:600px;
+ display:flex;
+ height:100px;
+ background:gray;
+ margin-bottom:100px;
+}
+.flex-vertical {
+ width:100px;
+ display:flex;
+ flex-direction: column;
+ height:600px;
+ background:gray;
+ margin-top:200px;
+ margin-bottom:100px;
+}
+.item-horizontal {
+ width:150px;
+ background:yellow;
+ margin:10px;
+ flex:none;
+}
+.item-vertical {
+ height:150px;
+ background:yellow;
+ margin:10px;
+ flex:none;
+}
+.content1-horizontal {
+ width:100px;
+ height:150px;
+ background:red;
+}
+.content2-horizontal {
+ width:100px;
+ height:100px;
+ background:red;
+}
+.content3-horizontal {
+ width:100px;
+ height:50px;
+ background:red;
+}
+.content1-vertical {
+ width:150px;
+ height:100px;
+ background:red;
+}
+.content2-vertical {
+ width:100px;
+ height:100px;
+ background:red;
+}
+.content3-vertical {
+ width:50px;
+ height:100px;
+ background:red;
+}
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/check-layout-th.js"></script>
+<body onload="checkLayout('.flex-horizontal, .flex-vertical');">
+<div id=log></div>
+<p>Test for crbug.com/362848: Flex box word-wrap is not adhering to spec</p>
+<div class="flex-horizontal">
+ <div class="item-horizontal" data-expected-height="80"><div class="content1-horizontal"></div></div>
+ <div class="item-horizontal" data-expected-height="80"><div class="content2-horizontal"></div></div>
+ <div class="item-horizontal" data-expected-height="80"><div class="content3-horizontal"></div></div>
+</div>
+
+<div class="flex-horizontal" style="flex-wrap:wrap;">
+ <div class="item-horizontal" data-expected-height="150"><div class="content1-horizontal"></div></div>
+ <div class="item-horizontal" data-expected-height="150"><div class="content2-horizontal"></div></div>
+ <div class="item-horizontal" data-expected-height="150"><div class="content3-horizontal"></div></div>
+</div>
+
+<div class="flex-horizontal" style="flex-wrap:wrap;">
+ <div class="item-horizontal" data-expected-height="150"><div class="content1-horizontal"></div></div>
+ <div class="item-horizontal" data-expected-height="150"><div class="content2-horizontal"></div></div>
+ <div class="item-horizontal" data-expected-height="150"><div class="content3-horizontal"></div></div>
+ <div class="item-horizontal" data-expected-height="150"><div class="content1-horizontal"></div></div>
+ <div class="item-horizontal" data-expected-height="150"><div class="content2-horizontal"></div></div>
+</div>
+
+<div class="flex-vertical">
+ <div class="item-vertical" data-expected-width="80"><div class="content1-vertical"></div></div>
+ <div class="item-vertical" data-expected-width="80"><div class="content2-vertical"></div></div>
+ <div class="item-vertical" data-expected-width="80"><div class="content3-vertical"></div></div>
+</div>
+
+<div class="flex-vertical" style="flex-wrap:wrap;">
+ <div class="item-vertical" data-expected-width="150"><div class="content1-vertical"></div></div>
+ <div class="item-vertical" data-expected-width="150"><div class="content2-vertical"></div></div>
+ <div class="item-vertical" data-expected-width="150"><div class="content3-vertical"></div></div>
+</div>
+
+<div class="flex-vertical" style="flex-wrap:wrap;">
+ <div class="item-vertical" data-expected-width="150"><div class="content1-vertical"></div></div>
+ <div class="item-vertical" data-expected-width="150"><div class="content2-vertical"></div></div>
+ <div class="item-vertical" data-expected-width="150"><div class="content3-vertical"></div></div>
+ <div class="item-vertical" data-expected-width="150"><div class="content1-vertical"></div></div>
+ <div class="item-vertical" data-expected-width="150"><div class="content2-vertical"></div></div>
+</div>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/big5_chars_extra.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/big5_chars_extra.html
new file mode 100644
index 0000000000..5ea8e5740d
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/big5_chars_extra.html
@@ -0,0 +1 @@
+<!doctype html><html><head><meta charset="big5"><title>big5 characters</title></head><body><span data-cp="C0" data-bytes="88 59">ˆY</span> <span data-cp="C1" data-bytes="88 57">ˆW</span> <span data-cp="C8" data-bytes="88 5D">ˆ]</span> <span data-cp="C9" data-bytes="88 5B">ˆ[</span> <span data-cp="CA" data-bytes="88 66">ˆf</span> <span data-cp="D2" data-bytes="88 61">ˆa</span> <span data-cp="D3" data-bytes="88 5F">ˆ_</span> <span data-cp="E0" data-bytes="88 6A">ˆj</span> <span data-cp="E1" data-bytes="88 68">ˆh</span> <span data-cp="E8" data-bytes="88 6F">ˆo</span> <span data-cp="E9" data-bytes="88 6D">ˆm</span> <span data-cp="EA" data-bytes="88 A7">ˆ§</span> <span data-cp="EC" data-bytes="88 73">ˆs</span> <span data-cp="ED" data-bytes="88 71">ˆq</span> <span data-cp="F2" data-bytes="88 77">ˆw</span> <span data-cp="F3" data-bytes="88 75">ˆu</span> <span data-cp="F9" data-bytes="88 7B">ˆ{</span> <span data-cp="FA" data-bytes="88 79">ˆy</span> <span data-cp="FC" data-bytes="88 A2">ˆ¢</span> <span data-cp="100" data-bytes="88 56">ˆV</span> <span data-cp="101" data-bytes="88 67">ˆg</span> <span data-cp="112" data-bytes="88 5A">ˆZ</span> <span data-cp="113" data-bytes="88 6C">ˆl</span> <span data-cp="11A" data-bytes="88 5C">ˆ\</span> <span data-cp="11B" data-bytes="88 6E">ˆn</span> <span data-cp="12B" data-bytes="88 70">ˆp</span> <span data-cp="14C" data-bytes="88 5E">ˆ^</span> <span data-cp="14D" data-bytes="88 74">ˆt</span> <span data-cp="16B" data-bytes="88 78">ˆx</span> <span data-cp="1CD" data-bytes="88 58">ˆX</span> <span data-cp="1CE" data-bytes="88 69">ˆi</span> <span data-cp="1D0" data-bytes="88 72">ˆr</span> <span data-cp="1D1" data-bytes="88 60">ˆ`</span> <span data-cp="1D2" data-bytes="88 76">ˆv</span> <span data-cp="1D4" data-bytes="88 7A">ˆz</span> <span data-cp="1D6" data-bytes="88 7C">ˆ|</span> <span data-cp="1D8" data-bytes="88 7D">ˆ}</span> <span data-cp="1DA" data-bytes="88 7E">ˆ~</span> <span data-cp="1DC" data-bytes="88 A1">ˆ¡</span> <span data-cp="251" data-bytes="88 6B">ˆk</span> <span data-cp="261" data-bytes="88 A8">ˆ¨</span> <span data-cp="1EBE" data-bytes="88 63">ˆc</span> <span data-cp="1EBF" data-bytes="88 A4">ˆ¤</span> <span data-cp="1EC0" data-bytes="88 65">ˆe</span> <span data-cp="1EC1" data-bytes="88 A6">ˆ¦</span> <span data-cp="23DA" data-bytes="88 A9">ˆ©</span> <span data-cp="23DB" data-bytes="88 AA">ˆª</span> <span data-cp="31C0" data-bytes="88 40">ˆ@</span> <span data-cp="31C1" data-bytes="88 41">ˆA</span> <span data-cp="31C2" data-bytes="88 42">ˆB</span> <span data-cp="31C3" data-bytes="88 43">ˆC</span> <span data-cp="31C4" data-bytes="88 44">ˆD</span> <span data-cp="31C5" data-bytes="88 46">ˆF</span> <span data-cp="31C6" data-bytes="88 49">ˆI</span> <span data-cp="31C7" data-bytes="88 4A">ˆJ</span> <span data-cp="31C8" data-bytes="88 4D">ˆM</span> <span data-cp="31C9" data-bytes="88 4F">ˆO</span> <span data-cp="31CA" data-bytes="88 50">ˆP</span> <span data-cp="31CB" data-bytes="88 51">ˆQ</span> <span data-cp="31CC" data-bytes="88 52">ˆR</span> <span data-cp="31CD" data-bytes="88 54">ˆT</span> <span data-cp="31CE" data-bytes="88 55">ˆU</span> <span data-cp="3435" data-bytes="92 77">’w</span> <span data-cp="3440" data-bytes="96 DF">–ß</span> <span data-cp="344A" data-bytes="8C F4">Œô</span> <span data-cp="344C" data-bytes="89 D5">‰Õ</span> <span data-cp="3464" data-bytes="93 CD">“Í</span> <span data-cp="3473" data-bytes="9B DF">›ß</span> <span data-cp="347D" data-bytes="89 DA">‰Ú</span> <span data-cp="347E" data-bytes="8F 59">Y</span> <span data-cp="3493" data-bytes="89 DB">‰Û</span> <span data-cp="3496" data-bytes="8F 5D">]</span> <span data-cp="34A5" data-bytes="89 DC">‰Ü</span> <span data-cp="34AF" data-bytes="96 F7">–÷</span> <span data-cp="34BC" data-bytes="8A DA">ŠÚ</span> <span data-cp="34C1" data-bytes="8B DC">‹Ü</span> <span data-cp="34C8" data-bytes="97 DB">—Û</span> <span data-cp="34DF" data-bytes="9E 53">žS</span> <span data-cp="34E4" data-bytes="9D AA">ª</span> <span data-cp="34E6" data-bytes="87 BE">‡¾</span> <span data-cp="34FB" data-bytes="9B EA">›ê</span> <span data-cp="3506" data-bytes="8A 6E">Šn</span> <span data-cp="353E" data-bytes="8B C8">‹È</span> <span data-cp="3551" data-bytes="89 E8">‰è</span> <span data-cp="3553" data-bytes="89 EA">‰ê</span> <span data-cp="3559" data-bytes="8C 4B">ŒK</span> <span data-cp="356D" data-bytes="89 ED">‰í</span> <span data-cp="3570" data-bytes="94 DD">”Ý</span> <span data-cp="3572" data-bytes="89 EE">‰î</span> <span data-cp="3577" data-bytes="9E B4">ž´</span> <span data-cp="3578" data-bytes="8A D3">ŠÓ</span> <span data-cp="3584" data-bytes="92 DB">’Û</span> <span data-cp="3597" data-bytes="94 DB">”Û</span> <span data-cp="3598" data-bytes="89 F9">‰ù</span> <span data-cp="35A5" data-bytes="89 FB">‰û</span> <span data-cp="35AD" data-bytes="9E FC">žü</span> <span data-cp="35BF" data-bytes="89 FC">‰ü</span> <span data-cp="35C1" data-bytes="89 BF">‰¿</span> <span data-cp="35C5" data-bytes="89 FE">‰þ</span> <span data-cp="35C7" data-bytes="89 E6">‰æ</span> <span data-cp="35CA" data-bytes="9D 46">F</span> <span data-cp="35CE" data-bytes="9D EE">î</span> <span data-cp="35D2" data-bytes="A0 7E"> ~</span> <span data-cp="35D6" data-bytes="A0 68"> h</span> <span data-cp="35DB" data-bytes="98 E9">˜é</span> <span data-cp="35DD" data-bytes="8B 68">‹h</span> <span data-cp="35F1" data-bytes="8D FD">ý</span> <span data-cp="35F2" data-bytes="8B BE">‹¾</span> <span data-cp="35F3" data-bytes="9F D9">ŸÙ</span> <span data-cp="35FB" data-bytes="8A EB">Šë</span> <span data-cp="35FE" data-bytes="9F D7">Ÿ×</span> <span data-cp="3609" data-bytes="8B 6A">‹j</span> <span data-cp="3618" data-bytes="9C 5C">œ\</span> <span data-cp="361A" data-bytes="8B B1">‹±</span> <span data-cp="3625" data-bytes="87 70">‡p</span> <span data-cp="362D" data-bytes="9D F3">ó</span> <span data-cp="3635" data-bytes="A0 D0"> Ð</span> <span data-cp="363E" data-bytes="92 E9">’é</span> <span data-cp="3647" data-bytes="9A EC">šì</span> <span data-cp="3648" data-bytes="8F AB">«</span> <span data-cp="364E" data-bytes="8E 45">ŽE</span> <span data-cp="365F" data-bytes="9C 6F">œo</span> <span data-cp="3661" data-bytes="8D 5C">\</span> <span data-cp="367A" data-bytes="9E DE">žÞ</span> <span data-cp="3681" data-bytes="89 EF">‰ï</span> <span data-cp="369A" data-bytes="96 E9">–é</span> <span data-cp="36A5" data-bytes="9E BB">ž»</span> <span data-cp="36AA" data-bytes="94 DE">”Þ</span> <span data-cp="36AC" data-bytes="9E B8">ž¸</span> <span data-cp="36B0" data-bytes="97 BA">—º</span> <span data-cp="36B5" data-bytes="95 D6">•Ö</span> <span data-cp="36B9" data-bytes="9C BB">œ»</span> <span data-cp="36BC" data-bytes="97 DA">—Ú</span> <span data-cp="36C1" data-bytes="8F 45">E</span> <span data-cp="36C4" data-bytes="91 58">‘X</span> <span data-cp="36C7" data-bytes="98 56">˜V</span> <span data-cp="36C8" data-bytes="9B 4D">›M</span> <span data-cp="36D3" data-bytes="93 5B">“[</span> <span data-cp="36D4" data-bytes="95 C7">•Ç</span> <span data-cp="36D6" data-bytes="97 E7">—ç</span> <span data-cp="36DD" data-bytes="93 59">“Y</span> <span data-cp="36E1" data-bytes="91 F5">‘õ</span> <span data-cp="36E2" data-bytes="97 B8">—¸</span> <span data-cp="36F5" data-bytes="92 FA">’ú</span> <span data-cp="3701" data-bytes="93 57">“W</span> <span data-cp="3703" data-bytes="8B A6">‹¦</span> <span data-cp="370A" data-bytes="97 B0">—°</span> <span data-cp="371C" data-bytes="9C A1">œ¡</span> <span data-cp="3722" data-bytes="91 F2">‘ò</span> <span data-cp="3723" data-bytes="91 F9">‘ù</span> <span data-cp="3725" data-bytes="8F F1">ñ</span> <span data-cp="372C" data-bytes="97 45">—E</span> <span data-cp="372D" data-bytes="98 53">˜S</span> <span data-cp="3733" data-bytes="92 51">’Q</span> <span data-cp="373A" data-bytes="9D AD">­</span> <span data-cp="3762" data-bytes="9B C2">›Â</span> <span data-cp="376F" data-bytes="9A 7B">š{</span> <span data-cp="3797" data-bytes="8B 60">‹`</span> <span data-cp="37A0" data-bytes="93 4B">“K</span> <span data-cp="37B9" data-bytes="9A BD">š½</span> <span data-cp="37BE" data-bytes="91 B7">‘·</span> <span data-cp="37D6" data-bytes="8D 4B">K</span> <span data-cp="37F2" data-bytes="95 B4">•´</span> <span data-cp="37FB" data-bytes="9E F0">žð</span> <span data-cp="380F" data-bytes="8D 64">d</span> <span data-cp="3819" data-bytes="92 69">’i</span> <span data-cp="3820" data-bytes="8D 67">g</span> <span data-cp="3838" data-bytes="8D 68">h</span> <span data-cp="3863" data-bytes="93 EB">“ë</span> <span data-cp="3875" data-bytes="87 7A">‡z</span> <span data-cp="38C3" data-bytes="91 66">‘f</span> <span data-cp="38D1" data-bytes="93 DD">“Ý</span> <span data-cp="38D4" data-bytes="8D 52">R</span> <span data-cp="38FA" data-bytes="8B CC">‹Ì</span> <span data-cp="3908" data-bytes="8D 6D">m</span> <span data-cp="3914" data-bytes="8D 6E">n</span> <span data-cp="3927" data-bytes="96 A8">–¨</span> <span data-cp="393F" data-bytes="8D 6F">o</span> <span data-cp="394D" data-bytes="8D 70">p</span> <span data-cp="3978" data-bytes="8C F3">Œó</span> <span data-cp="3980" data-bytes="90 60">`</span> <span data-cp="3989" data-bytes="8D 74">t</span> <span data-cp="398A" data-bytes="97 C3">—Ã</span> <span data-cp="3992" data-bytes="8A D0">ŠÐ</span> <span data-cp="3999" data-bytes="92 74">’t</span> <span data-cp="399B" data-bytes="9B BE">›¾</span> <span data-cp="39A1" data-bytes="9C C8">œÈ</span> <span data-cp="39A4" data-bytes="9C BA">œº</span> <span data-cp="39B8" data-bytes="8D 78">x</span> <span data-cp="39DC" data-bytes="9E B9">ž¹</span> <span data-cp="39E2" data-bytes="95 5A">•Z</span> <span data-cp="39E5" data-bytes="91 B4">‘´</span> <span data-cp="39EC" data-bytes="8A 48">ŠH</span> <span data-cp="39F8" data-bytes="8D 7D">}</span> <span data-cp="39FB" data-bytes="8A 7D">Š}</span> <span data-cp="39FE" data-bytes="8A C2">ŠÂ</span> <span data-cp="3A03" data-bytes="8D A1">¡</span> <span data-cp="3A06" data-bytes="8A D1">ŠÑ</span> <span data-cp="3A18" data-bytes="8B 47">‹G</span> <span data-cp="3A29" data-bytes="93 A4">“¤</span> <span data-cp="3A2A" data-bytes="9E DA">žÚ</span> <span data-cp="3A34" data-bytes="8A 51">ŠQ</span> <span data-cp="3A4B" data-bytes="8D A6">¦</span> <span data-cp="3A52" data-bytes="9E C5">žÅ</span> <span data-cp="3A5C" data-bytes="A0 78"> x</span> <span data-cp="3A5E" data-bytes="94 B5">”µ</span> <span data-cp="3A67" data-bytes="8A 6B">Šk</span> <span data-cp="3A97" data-bytes="8D AB">«</span> <span data-cp="3ABD" data-bytes="8D AD">­</span> <span data-cp="3AE0" data-bytes="93 C1">“Á</span> <span data-cp="3AF0" data-bytes="90 6F">o</span> <span data-cp="3AF2" data-bytes="8D B0">°</span> <span data-cp="3AF5" data-bytes="87 A2">‡¢</span> <span data-cp="3AFB" data-bytes="94 7E">”~</span> <span data-cp="3B0E" data-bytes="90 FA">ú</span> <span data-cp="3B19" data-bytes="94 79">”y</span> <span data-cp="3B22" data-bytes="8D B2">²</span> <span data-cp="3B39" data-bytes="99 7B">™{</span> <span data-cp="3B42" data-bytes="8D B4">´</span> <span data-cp="3B58" data-bytes="8D B7">·</span> <span data-cp="3B60" data-bytes="91 B3">‘³</span> <span data-cp="3B71" data-bytes="8D BB">»</span> <span data-cp="3B72" data-bytes="8D BA">º</span> <span data-cp="3B7B" data-bytes="8D BC">¼</span> <span data-cp="3B7C" data-bytes="90 44">D</span> <span data-cp="3B95" data-bytes="87 4B">‡K</span> <span data-cp="3B96" data-bytes="93 E4">“ä</span> <span data-cp="3B99" data-bytes="93 E0">“à</span> <span data-cp="3BBC" data-bytes="8D C3">Ã</span> <span data-cp="3BBE" data-bytes="9B B8">›¸</span> <span data-cp="3BC4" data-bytes="93 E9">“é</span> <span data-cp="3BD7" data-bytes="93 F6">“ö</span> <span data-cp="3BDD" data-bytes="8D C5">Å</span> <span data-cp="3BEC" data-bytes="8D CA">Ê</span> <span data-cp="3BF2" data-bytes="8D CC">Ì</span> <span data-cp="3BF4" data-bytes="93 B5">“µ</span> <span data-cp="3C11" data-bytes="9C F8">œø</span> <span data-cp="3C15" data-bytes="92 52">’R</span> <span data-cp="3C18" data-bytes="A0 E8"> è</span> <span data-cp="3C54" data-bytes="9C A5">œ¥</span> <span data-cp="3C8B" data-bytes="8C 56">ŒV</span> <span data-cp="3CCB" data-bytes="8D D6">Ö</span> <span data-cp="3CCD" data-bytes="97 C0">—À</span> <span data-cp="3CD1" data-bytes="A0 DE"> Þ</span> <span data-cp="3CD6" data-bytes="97 D2">—Ò</span> <span data-cp="3CEF" data-bytes="8D DB">Û</span> <span data-cp="3D12" data-bytes="8C EA">Œê</span> <span data-cp="3D13" data-bytes="8E AF">Ž¯</span> <span data-cp="3D1D" data-bytes="91 B5">‘µ</span> <span data-cp="3D46" data-bytes="8D EB">ë</span> <span data-cp="3D4C" data-bytes="97 C6">—Æ</span> <span data-cp="3D51" data-bytes="90 FC">ü</span> <span data-cp="3D62" data-bytes="96 D6">–Ö</span> <span data-cp="3D69" data-bytes="97 C5">—Å</span> <span data-cp="3D6A" data-bytes="8D EF">ï</span> <span data-cp="3D6F" data-bytes="97 D7">—×</span> <span data-cp="3D75" data-bytes="8D F0">ð</span> <span data-cp="3D7D" data-bytes="96 A6">–¦</span> <span data-cp="3D88" data-bytes="8C DF">Œß</span> <span data-cp="3D8A" data-bytes="8D F3">ó</span> <span data-cp="3D8F" data-bytes="94 49">”I</span> <span data-cp="3D91" data-bytes="8D F5">õ</span> <span data-cp="3DA5" data-bytes="98 72">˜r</span> <span data-cp="3DAD" data-bytes="8E 6B">Žk</span> <span data-cp="3DBF" data-bytes="8F 50">P</span> <span data-cp="3DC6" data-bytes="9D CC">Ì</span> <span data-cp="3DC9" data-bytes="8C 44">ŒD</span> <span data-cp="3DCC" data-bytes="99 6E">™n</span> <span data-cp="3DCD" data-bytes="94 A1">”¡</span> <span data-cp="3DD3" data-bytes="8F 63">c</span> <span data-cp="3DDB" data-bytes="A0 DA"> Ú</span> <span data-cp="3DE7" data-bytes="92 53">’S</span> <span data-cp="3DEB" data-bytes="9D B5">µ</span> <span data-cp="3DF3" data-bytes="98 79">˜y</span> <span data-cp="3DF4" data-bytes="87 6A">‡j</span> <span data-cp="3DF7" data-bytes="9D 5D">]</span> <span data-cp="3DFC" data-bytes="8D 63">c</span> <span data-cp="3DFD" data-bytes="96 69">–i</span> <span data-cp="3E06" data-bytes="9F 70">Ÿp</span> <span data-cp="3E43" data-bytes="8A C7">ŠÇ</span> <span data-cp="3E48" data-bytes="89 D7">‰×</span> <span data-cp="3E74" data-bytes="9E DD">žÝ</span> <span data-cp="3EA9" data-bytes="98 BC">˜¼</span> <span data-cp="3EAD" data-bytes="95 B0">•°</span> <span data-cp="3EB1" data-bytes="94 64">”d</span> <span data-cp="3EB8" data-bytes="93 6F">“o</span> <span data-cp="3EBF" data-bytes="94 B9">”¹</span> <span data-cp="3EC2" data-bytes="95 EC">•ì</span> <span data-cp="3EC7" data-bytes="91 EE">‘î</span> <span data-cp="3ECA" data-bytes="98 C3">˜Ã</span> <span data-cp="3ECC" data-bytes="95 F6">•ö</span> <span data-cp="3ED0" data-bytes="8F FD">ý</span> <span data-cp="3ED1" data-bytes="98 C5">˜Å</span> <span data-cp="3ED6" data-bytes="97 66">—f</span> <span data-cp="3EDA" data-bytes="97 DD">—Ý</span> <span data-cp="3EDB" data-bytes="8C AA">Œª</span> <span data-cp="3EDE" data-bytes="92 D2">’Ò</span> <span data-cp="3EE1" data-bytes="97 61">—a</span> <span data-cp="3EE2" data-bytes="98 CB">˜Ë</span> <span data-cp="3EE7" data-bytes="95 F0">•ð</span> <span data-cp="3EE9" data-bytes="97 5D">—]</span> <span data-cp="3EEB" data-bytes="91 E3">‘ã</span> <span data-cp="3EEC" data-bytes="87 7E">‡~</span> <span data-cp="3EF0" data-bytes="98 CC">˜Ì</span> <span data-cp="3EF3" data-bytes="94 69">”i</span> <span data-cp="3EF4" data-bytes="98 CD">˜Í</span> <span data-cp="3EFA" data-bytes="98 CE">˜Î</span> <span data-cp="3EFC" data-bytes="95 FC">•ü</span> <span data-cp="3EFF" data-bytes="94 A3">”£</span> <span data-cp="3F00" data-bytes="96 62">–b</span> <span data-cp="3F06" data-bytes="94 63">”c</span> <span data-cp="3F07" data-bytes="8D 47">G</span> <span data-cp="3F0E" data-bytes="98 D0">˜Ð</span> <span data-cp="3F53" data-bytes="98 D1">˜Ñ</span> <span data-cp="3F58" data-bytes="94 75">”u</span> <span data-cp="3F63" data-bytes="94 72">”r</span> <span data-cp="3F7C" data-bytes="98 D6">˜Ö</span> <span data-cp="3F93" data-bytes="8A F0">Šð</span> <span data-cp="3FC0" data-bytes="98 D9">˜Ù</span> <span data-cp="3FC8" data-bytes="8D 5A">Z</span> <span data-cp="3FD7" data-bytes="98 DB">˜Û</span> <span data-cp="3FDC" data-bytes="98 DD">˜Ý</span> <span data-cp="3FE5" data-bytes="98 A8">˜¨</span> <span data-cp="3FED" data-bytes="8A 6D">Šm</span> <span data-cp="3FF9" data-bytes="8A FB">Šû</span> <span data-cp="3FFA" data-bytes="8A AE">Š®</span> <span data-cp="4009" data-bytes="8C 5D">Œ]</span> <span data-cp="401D" data-bytes="98 E4">˜ä</span> <span data-cp="4039" data-bytes="98 E6">˜æ</span> <span data-cp="4045" data-bytes="98 E8">˜è</span> <span data-cp="4053" data-bytes="8A 4D">ŠM</span> <span data-cp="4057" data-bytes="92 57">’W</span> <span data-cp="4062" data-bytes="95 DF">•ß</span> <span data-cp="4065" data-bytes="A0 AC"> ¬</span> <span data-cp="406A" data-bytes="98 EB">˜ë</span> <span data-cp="406F" data-bytes="98 EC">˜ì</span> <span data-cp="4071" data-bytes="8C C3">ŒÃ</span> <span data-cp="40A8" data-bytes="98 F4">˜ô</span> <span data-cp="40B4" data-bytes="87 D9">‡Ù</span> <span data-cp="40BB" data-bytes="8A B8">Š¸</span> <span data-cp="40BF" data-bytes="9E E7">žç</span> <span data-cp="40C8" data-bytes="94 BC">”¼</span> <span data-cp="40DF" data-bytes="9C C6">œÆ</span> <span data-cp="40F8" data-bytes="8D 4A">J</span> <span data-cp="40FA" data-bytes="9E 7E">ž~</span> <span data-cp="4102" data-bytes="8D 44">D</span> <span data-cp="4103" data-bytes="98 FE">˜þ</span> <span data-cp="4109" data-bytes="99 40">™@</span> <span data-cp="410E" data-bytes="94 C9">”É</span> <span data-cp="4131" data-bytes="87 C6">‡Æ</span> <span data-cp="4132" data-bytes="94 D3">”Ó</span> <span data-cp="4167" data-bytes="99 46">™F</span> <span data-cp="416C" data-bytes="90 C0">À</span> <span data-cp="416E" data-bytes="94 D1">”Ñ</span> <span data-cp="417C" data-bytes="8D 4E">N</span> <span data-cp="417F" data-bytes="95 73">•s</span> <span data-cp="4181" data-bytes="87 CE">‡Î</span> <span data-cp="4190" data-bytes="93 C2">“Â</span> <span data-cp="41B2" data-bytes="99 48">™H</span> <span data-cp="41C4" data-bytes="99 4B">™K</span> <span data-cp="41CA" data-bytes="8E 55">ŽU</span> <span data-cp="41CF" data-bytes="99 4E">™N</span> <span data-cp="41DB" data-bytes="8E FE">Žþ</span> <span data-cp="41ED" data-bytes="8D 5F">_</span> <span data-cp="41EF" data-bytes="8E 59">ŽY</span> <span data-cp="41F9" data-bytes="94 EC">”ì</span> <span data-cp="4211" data-bytes="94 EF">”ï</span> <span data-cp="4223" data-bytes="8C 60">Œ`</span> <span data-cp="4240" data-bytes="8F 74">t</span> <span data-cp="4260" data-bytes="99 55">™U</span> <span data-cp="426A" data-bytes="95 44">•D</span> <span data-cp="4276" data-bytes="8C CB">ŒË</span> <span data-cp="427A" data-bytes="99 56">™V</span> <span data-cp="428C" data-bytes="99 59">™Y</span> <span data-cp="4294" data-bytes="99 5B">™[</span> <span data-cp="42A2" data-bytes="8C C4">ŒÄ</span> <span data-cp="42B9" data-bytes="90 B7">·</span> <span data-cp="42BC" data-bytes="97 43">—C</span> <span data-cp="42F4" data-bytes="95 CD">•Í</span> <span data-cp="42FB" data-bytes="97 C9">—É</span> <span data-cp="430A" data-bytes="87 AA">‡ª</span> <span data-cp="432B" data-bytes="8E B9">Ž¹</span> <span data-cp="436E" data-bytes="95 C6">•Æ</span> <span data-cp="4397" data-bytes="99 67">™g</span> <span data-cp="439A" data-bytes="8C E3">Œã</span> <span data-cp="43BA" data-bytes="8A B9">Š¹</span> <span data-cp="43C1" data-bytes="8D FC">ü</span> <span data-cp="43D9" data-bytes="8A 76">Šv</span> <span data-cp="43DF" data-bytes="9D 51">Q</span> <span data-cp="43ED" data-bytes="99 73">™s</span> <span data-cp="43F0" data-bytes="87 40">‡@</span> <span data-cp="43F2" data-bytes="9D 4F">O</span> <span data-cp="4401" data-bytes="99 7A">™z</span> <span data-cp="4402" data-bytes="95 64">•d</span> <span data-cp="4413" data-bytes="99 A1">™¡</span> <span data-cp="4425" data-bytes="99 A5">™¥</span> <span data-cp="442D" data-bytes="99 A7">™§</span> <span data-cp="447A" data-bytes="8E ED">Ží</span> <span data-cp="448F" data-bytes="99 AD">™­</span> <span data-cp="449F" data-bytes="94 6E">”n</span> <span data-cp="44A0" data-bytes="8F 70">p</span> <span data-cp="44B0" data-bytes="99 B3">™³</span> <span data-cp="44B7" data-bytes="A0 53"> S</span> <span data-cp="44BD" data-bytes="8D 5E">^</span> <span data-cp="44C0" data-bytes="96 5C">–\</span> <span data-cp="44C3" data-bytes="8C E0">Œà</span> <span data-cp="44CE" data-bytes="97 FE">—þ</span> <span data-cp="44DD" data-bytes="92 BD">’½</span> <span data-cp="44DE" data-bytes="8D 5D">]</span> <span data-cp="44DF" data-bytes="97 FD">—ý</span> <span data-cp="44E1" data-bytes="87 DB">‡Û</span> <span data-cp="44E4" data-bytes="8F 64">d</span> <span data-cp="44EA" data-bytes="95 62">•b</span> <span data-cp="44EB" data-bytes="97 CD">—Í</span> <span data-cp="44EC" data-bytes="9E 64">žd</span> <span data-cp="44F4" data-bytes="92 4C">’L</span> <span data-cp="4503" data-bytes="8E C9">ŽÉ</span> <span data-cp="4504" data-bytes="99 BC">™¼</span> <span data-cp="4509" data-bytes="9D A5">¥</span> <span data-cp="450B" data-bytes="8F 54">T</span> <span data-cp="4516" data-bytes="8F 7C">|</span> <span data-cp="451B" data-bytes="8D 55">U</span> <span data-cp="451D" data-bytes="8E A2">Ž¢</span> <span data-cp="4527" data-bytes="8F 7A">z</span> <span data-cp="452E" data-bytes="97 AE">—®</span> <span data-cp="4533" data-bytes="96 C8">–È</span> <span data-cp="4536" data-bytes="8C E4">Œä</span> <span data-cp="453B" data-bytes="99 C3">™Ã</span> <span data-cp="453D" data-bytes="90 D6">Ö</span> <span data-cp="453F" data-bytes="9C BE">œ¾</span> <span data-cp="4543" data-bytes="8F 76">v</span> <span data-cp="4551" data-bytes="94 70">”p</span> <span data-cp="4558" data-bytes="8C EF">Œï</span> <span data-cp="455C" data-bytes="8E C7">ŽÇ</span> <span data-cp="4561" data-bytes="8D 54">T</span> <span data-cp="4562" data-bytes="A0 F9"> ù</span> <span data-cp="456A" data-bytes="8F A9">©</span> <span data-cp="456D" data-bytes="8D 51">Q</span> <span data-cp="4577" data-bytes="99 C7">™Ç</span> <span data-cp="4578" data-bytes="87 44">‡D</span> <span data-cp="4585" data-bytes="90 D7">×</span> <span data-cp="45A6" data-bytes="87 43">‡C</span> <span data-cp="45B3" data-bytes="87 47">‡G</span> <span data-cp="45DA" data-bytes="87 58">‡X</span> <span data-cp="45E9" data-bytes="9E DF">žß</span> <span data-cp="45EA" data-bytes="8D 59">Y</span> <span data-cp="4603" data-bytes="87 42">‡B</span> <span data-cp="4606" data-bytes="99 CE">™Î</span> <span data-cp="460F" data-bytes="8F BA">º</span> <span data-cp="4615" data-bytes="8F EB">ë</span> <span data-cp="4617" data-bytes="99 CF">™Ï</span> <span data-cp="465B" data-bytes="8F C2">Â</span> <span data-cp="467A" data-bytes="92 C9">’É</span> <span data-cp="4680" data-bytes="97 DC">—Ü</span> <span data-cp="46A1" data-bytes="87 5D">‡]</span> <span data-cp="46AE" data-bytes="87 CC">‡Ì</span> <span data-cp="46BB" data-bytes="8D 45">E</span> <span data-cp="46CF" data-bytes="95 B3">•³</span> <span data-cp="46D0" data-bytes="9C 79">œy</span> <span data-cp="46F5" data-bytes="95 B2">•²</span> <span data-cp="46F7" data-bytes="8D 4C">L</span> <span data-cp="4713" data-bytes="8F DB">Û</span> <span data-cp="4718" data-bytes="9B E3">›ã</span> <span data-cp="4736" data-bytes="87 4C">‡L</span> <span data-cp="4744" data-bytes="87 4D">‡M</span> <span data-cp="474E" data-bytes="9E 7A">žz</span> <span data-cp="474F" data-bytes="87 57">‡W</span> <span data-cp="477C" data-bytes="9B EE">›î</span> <span data-cp="4798" data-bytes="99 DE">™Þ</span> <span data-cp="47D5" data-bytes="8A 52">ŠR</span> <span data-cp="47ED" data-bytes="99 E1">™á</span> <span data-cp="47F4" data-bytes="8A 67">Šg</span> <span data-cp="4800" data-bytes="8B B5">‹µ</span> <span data-cp="480B" data-bytes="8A AC">Š¬</span> <span data-cp="4837" data-bytes="99 E9">™é</span> <span data-cp="4871" data-bytes="97 DE">—Þ</span> <span data-cp="489B" data-bytes="95 D1">•Ñ</span> <span data-cp="48AD" data-bytes="99 F5">™õ</span> <span data-cp="48D0" data-bytes="9B A9">›©</span> <span data-cp="48F3" data-bytes="9E A4">ž¤</span> <span data-cp="48FA" data-bytes="9D 49">I</span> <span data-cp="4906" data-bytes="95 DB">•Û</span> <span data-cp="4911" data-bytes="89 C5">‰Å</span> <span data-cp="491E" data-bytes="99 F8">™ø</span> <span data-cp="4925" data-bytes="96 64">–d</span> <span data-cp="492A" data-bytes="90 55">U</span> <span data-cp="492D" data-bytes="96 D4">–Ô</span> <span data-cp="492F" data-bytes="87 C4">‡Ä</span> <span data-cp="4930" data-bytes="87 AE">‡®</span> <span data-cp="4935" data-bytes="97 7C">—|</span> <span data-cp="493C" data-bytes="96 4D">–M</span> <span data-cp="493E" data-bytes="97 E1">—á</span> <span data-cp="4945" data-bytes="9A 48">šH</span> <span data-cp="4951" data-bytes="9A 49">šI</span> <span data-cp="4965" data-bytes="90 AA">ª</span> <span data-cp="496A" data-bytes="9A 50">šP</span> <span data-cp="4972" data-bytes="93 47">“G</span> <span data-cp="4989" data-bytes="8E D8">ŽØ</span> <span data-cp="49A1" data-bytes="90 C9">É</span> <span data-cp="49A7" data-bytes="9A 55">šU</span> <span data-cp="49DF" data-bytes="90 BC">¼</span> <span data-cp="49E5" data-bytes="9A 58">šX</span> <span data-cp="49E7" data-bytes="8B B8">‹¸</span> <span data-cp="4A0F" data-bytes="90 D5">Õ</span> <span data-cp="4A1D" data-bytes="96 41">–A</span> <span data-cp="4A24" data-bytes="9A 5A">šZ</span> <span data-cp="4A35" data-bytes="9A 5C">š\</span> <span data-cp="4A96" data-bytes="97 C2">—Â</span> <span data-cp="4AA4" data-bytes="87 5C">‡\</span> <span data-cp="4AB4" data-bytes="8A BB">Š»</span> <span data-cp="4AB8" data-bytes="9B AA">›ª</span> <span data-cp="4AD1" data-bytes="90 F5">õ</span> <span data-cp="4AE4" data-bytes="9A 60">š`</span> <span data-cp="4AFF" data-bytes="91 45">‘E</span> <span data-cp="4B10" data-bytes="8C 58">ŒX</span> <span data-cp="4B19" data-bytes="9A 63">šc</span> <span data-cp="4B20" data-bytes="8C 49">ŒI</span> <span data-cp="4B2C" data-bytes="8B B6">‹¶</span> <span data-cp="4B6F" data-bytes="96 6B">–k</span> <span data-cp="4B70" data-bytes="9A 6E">šn</span> <span data-cp="4B72" data-bytes="91 4F">‘O</span> <span data-cp="4B7B" data-bytes="97 46">—F</span> <span data-cp="4B7E" data-bytes="A0 E6"> æ</span> <span data-cp="4B8E" data-bytes="92 D7">’×</span> <span data-cp="4B90" data-bytes="96 75">–u</span> <span data-cp="4B93" data-bytes="93 D4">“Ô</span> <span data-cp="4B96" data-bytes="91 BB">‘»</span> <span data-cp="4B97" data-bytes="96 79">–y</span> <span data-cp="4B9D" data-bytes="9A 70">šp</span> <span data-cp="4BBD" data-bytes="96 78">–x</span> <span data-cp="4BBE" data-bytes="91 CD">‘Í</span> <span data-cp="4BC0" data-bytes="9C 4A">œJ</span> <span data-cp="4C04" data-bytes="A0 6F"> o</span> <span data-cp="4C07" data-bytes="A0 6A"> j</span> <span data-cp="4C0E" data-bytes="91 5F">‘_</span> <span data-cp="4C32" data-bytes="87 41">‡A</span> <span data-cp="4C3B" data-bytes="9F A5">Ÿ¥</span> <span data-cp="4C3E" data-bytes="89 BA">‰º</span> <span data-cp="4C40" data-bytes="87 4F">‡O</span> <span data-cp="4C47" data-bytes="87 4E">‡N</span> <span data-cp="4C57" data-bytes="87 55">‡U</span> <span data-cp="4C5B" data-bytes="9E CD">žÍ</span> <span data-cp="4C6D" data-bytes="9A 79">šy</span> <span data-cp="4C77" data-bytes="8C F2">Œò</span> <span data-cp="4C7B" data-bytes="8D 57">W</span> <span data-cp="4C7D" data-bytes="9D CE">Î</span> <span data-cp="4C81" data-bytes="8C D2">ŒÒ</span> <span data-cp="4C85" data-bytes="87 59">‡Y</span> <span data-cp="4CA4" data-bytes="9D 73">s</span> <span data-cp="4CAE" data-bytes="96 B9">–¹</span> <span data-cp="4CB0" data-bytes="96 BC">–¼</span> <span data-cp="4CB7" data-bytes="9C D1">œÑ</span> <span data-cp="4CCD" data-bytes="89 B7">‰·</span> <span data-cp="4CE1" data-bytes="9E EE">žî</span> <span data-cp="4CE2" data-bytes="87 49">‡I</span> <span data-cp="4D07" data-bytes="87 5B">‡[</span> <span data-cp="4D09" data-bytes="9E C9">žÉ</span> <span data-cp="4D34" data-bytes="91 AE">‘®</span> <span data-cp="4D76" data-bytes="8D 58">X</span> <span data-cp="4D77" data-bytes="87 46">‡F</span> <span data-cp="4D89" data-bytes="8D 56">V</span> <span data-cp="4D91" data-bytes="9D 78">x</span> <span data-cp="4D9C" data-bytes="9D 7B">{</span> <span data-cp="4E04" data-bytes="9E B3">ž³</span> <span data-cp="4E1A" data-bytes="9E B2">ž²</span> <span data-cp="4E1C" data-bytes="9D D6">Ö</span> <span data-cp="4E21" data-bytes="99 4F">™O</span> <span data-cp="4E24" data-bytes="89 CE">‰Î</span> <span data-cp="4E28" data-bytes="8B C0">‹À</span> <span data-cp="4E2A" data-bytes="9F C4">ŸÄ</span> <span data-cp="4E2C" data-bytes="8B D4">‹Ô</span> <span data-cp="4E2F" data-bytes="8C 72">Œr</span> <span data-cp="4E37" data-bytes="8B F9">‹ù</span> <span data-cp="4E3D" data-bytes="89 46">‰F</span> <span data-cp="4E5B" data-bytes="8B C6">‹Æ</span> <span data-cp="4E6A" data-bytes="9C 57">œW</span> <span data-cp="4E78" data-bytes="9A FB">šû</span> <span data-cp="4E80" data-bytes="89 D0">‰Ð</span> <span data-cp="4E81" data-bytes="89 CF">‰Ï</span> <span data-cp="4E87" data-bytes="89 D1">‰Ñ</span> <span data-cp="4E89" data-bytes="89 E2">‰â</span> <span data-cp="4E98" data-bytes="92 7E">’~</span> <span data-cp="4E9A" data-bytes="9D BA">º</span> <span data-cp="4EA3" data-bytes="8C 6F">Œo</span> <span data-cp="4EBB" data-bytes="8B C7">‹Ç</span> <span data-cp="4EBC" data-bytes="92 6B">’k</span> <span data-cp="4EBF" data-bytes="89 D2">‰Ò</span> <span data-cp="4ECE" data-bytes="9F CF">ŸÏ</span> <span data-cp="4EEA" data-bytes="9D A9">©</span> <span data-cp="4EEB" data-bytes="89 D3">‰Ó</span> <span data-cp="4EEE" data-bytes="99 E2">™â</span> <span data-cp="4EF8" data-bytes="92 67">’g</span> <span data-cp="4F03" data-bytes="92 A4">’¤</span> <span data-cp="4F17" data-bytes="8C 73">Œs</span> <span data-cp="4F1A" data-bytes="89 4E">‰N</span> <span data-cp="4F28" data-bytes="89 4F">‰O</span> <span data-cp="4F29" data-bytes="92 78">’x</span> <span data-cp="4F32" data-bytes="91 B6">‘¶</span> <span data-cp="4F37" data-bytes="89 D4">‰Ô</span> <span data-cp="4F39" data-bytes="9F D2">ŸÒ</span> <span data-cp="4F42" data-bytes="92 A7">’§</span> <span data-cp="4F45" data-bytes="95 A2">•¢</span> <span data-cp="4F4B" data-bytes="92 6E">’n</span> <span data-cp="4F72" data-bytes="96 EA">–ê</span> <span data-cp="4F8A" data-bytes="92 6F">’o</span> <span data-cp="4FA2" data-bytes="92 A3">’£</span> <span data-cp="4FA8" data-bytes="89 50">‰P</span> <span data-cp="4FB0" data-bytes="98 66">˜f</span> <span data-cp="4FB4" data-bytes="8C F8">Œø</span> <span data-cp="4FBB" data-bytes="9C 53">œS</span> <span data-cp="4FBD" data-bytes="89 D6">‰Ö</span> <span data-cp="4FC8" data-bytes="98 B2">˜²</span> <span data-cp="4FCC" data-bytes="92 AB">’«</span> <span data-cp="4FE4" data-bytes="96 DE">–Þ</span> <span data-cp="4FE5" data-bytes="92 AC">’¬</span> <span data-cp="4FF0" data-bytes="8C 70">Œp</span> <span data-cp="4FF2" data-bytes="9F 6E">Ÿn</span> <span data-cp="4FF9" data-bytes="8E F2">Žò</span> <span data-cp="4FFD" data-bytes="9F 6C">Ÿl</span> <span data-cp="5003" data-bytes="89 D8">‰Ø</span> <span data-cp="502E" data-bytes="92 A8">’¨</span> <span data-cp="5034" data-bytes="91 63">‘c</span> <span data-cp="503B" data-bytes="8C 40">Œ@</span> <span data-cp="5056" data-bytes="9F 73">Ÿs</span> <span data-cp="5058" data-bytes="92 AD">’­</span> <span data-cp="5066" data-bytes="9B E9">›é</span> <span data-cp="506C" data-bytes="92 A9">’©</span> <span data-cp="5081" data-bytes="92 AA">’ª</span> <span data-cp="5088" data-bytes="89 D9">‰Ù</span> <span data-cp="50A6" data-bytes="9F A8">Ÿ¨</span> <span data-cp="50BC" data-bytes="8C 71">Œq</span> <span data-cp="50CD" data-bytes="92 A1">’¡</span> <span data-cp="50D0" data-bytes="90 E3">ã</span> <span data-cp="50D9" data-bytes="A0 A6"> ¦</span> <span data-cp="50DF" data-bytes="94 AB">”«</span> <span data-cp="50ED" data-bytes="9F CB">ŸË</span> <span data-cp="50F4" data-bytes="97 C4">—Ä</span> <span data-cp="50FC" data-bytes="92 AE">’®</span> <span data-cp="510D" data-bytes="92 A2">’¢</span> <span data-cp="512B" data-bytes="92 68">’h</span> <span data-cp="5156" data-bytes="89 51">‰Q</span> <span data-cp="5159" data-bytes="92 AF">’¯</span> <span data-cp="515B" data-bytes="92 B0">’°</span> <span data-cp="515D" data-bytes="92 B1">’±</span> <span data-cp="515E" data-bytes="92 B2">’²</span> <span data-cp="5174" data-bytes="89 52">‰R</span> <span data-cp="5179" data-bytes="94 5A">”Z</span> <span data-cp="5186" data-bytes="89 DD">‰Ý</span> <span data-cp="519A" data-bytes="9E 52">žR</span> <span data-cp="519C" data-bytes="89 53">‰S</span> <span data-cp="51A7" data-bytes="9E 55">žU</span> <span data-cp="51A8" data-bytes="92 BA">’º</span> <span data-cp="51AE" data-bytes="8C 5B">Œ[</span> <span data-cp="51B4" data-bytes="9A 68">šh</span> <span data-cp="51C3" data-bytes="92 BB">’»</span> <span data-cp="51D2" data-bytes="9B B4">›´</span> <span data-cp="51DB" data-bytes="89 DF">‰ß</span> <span data-cp="51E4" data-bytes="89 54">‰T</span> <span data-cp="51FC" data-bytes="89 E0">‰à</span> <span data-cp="51FE" data-bytes="9F 4F">ŸO</span> <span data-cp="5205" data-bytes="89 E1">‰á</span> <span data-cp="521F" data-bytes="9F CD">ŸÍ</span> <span data-cp="5220" data-bytes="A0 E7"> ç</span> <span data-cp="5227" data-bytes="89 A6">‰¦</span> <span data-cp="5234" data-bytes="9E FA">žú</span> <span data-cp="524F" data-bytes="87 BC">‡¼</span> <span data-cp="5259" data-bytes="92 C4">’Ä</span> <span data-cp="5260" data-bytes="9F 6F">Ÿo</span> <span data-cp="5268" data-bytes="8B B0">‹°</span> <span data-cp="5273" data-bytes="9F AC">Ÿ¬</span> <span data-cp="5279" data-bytes="89 E3">‰ã</span> <span data-cp="528F" data-bytes="9B D3">›Ó</span> <span data-cp="5290" data-bytes="89 E4">‰ä</span> <span data-cp="529A" data-bytes="9F D5">ŸÕ</span> <span data-cp="52A1" data-bytes="89 55">‰U</span> <span data-cp="52A4" data-bytes="92 C5">’Å</span> <span data-cp="52A8" data-bytes="89 56">‰V</span> <span data-cp="52CC" data-bytes="9E DC">žÜ</span> <span data-cp="52D1" data-bytes="9F 71">Ÿq</span> <span data-cp="52E1" data-bytes="92 C7">’Ç</span> <span data-cp="5301" data-bytes="9A 4C">šL</span> <span data-cp="5324" data-bytes="8C 68">Œh</span> <span data-cp="5327" data-bytes="89 E5">‰å</span> <span data-cp="532C" data-bytes="9F 7D">Ÿ}</span> <span data-cp="5332" data-bytes="A0 A9"> ©</span> <span data-cp="533B" data-bytes="89 57">‰W</span> <span data-cp="534E" data-bytes="89 58">‰X</span> <span data-cp="535D" data-bytes="8B E3">‹ã</span> <span data-cp="535F" data-bytes="8B 61">‹a</span> <span data-cp="5364" data-bytes="9A F1">šñ</span> <span data-cp="5367" data-bytes="9E B7">ž·</span> <span data-cp="537D" data-bytes="9E BA">žº</span> <span data-cp="53A2" data-bytes="9C E0">œà</span> <span data-cp="53A9" data-bytes="89 E7">‰ç</span> <span data-cp="53AA" data-bytes="A0 7A"> z</span> <span data-cp="53B0" data-bytes="89 E9">‰é</span> <span data-cp="53C2" data-bytes="89 EB">‰ë</span> <span data-cp="53CC" data-bytes="90 C8">È</span> <span data-cp="53D0" data-bytes="92 DA">’Ú</span> <span data-cp="53D1" data-bytes="89 59">‰Y</span> <span data-cp="53D2" data-bytes="9C F5">œõ</span> <span data-cp="53D8" data-bytes="89 5A">‰Z</span> <span data-cp="53DA" data-bytes="9F A2">Ÿ¢</span> <span data-cp="53F7" data-bytes="8F AD">­</span> <span data-cp="5414" data-bytes="96 EF">–ï</span> <span data-cp="5416" data-bytes="9D EC">ì</span> <span data-cp="541A" data-bytes="9D CA">Ê</span> <span data-cp="5423" data-bytes="89 EC">‰ì</span> <span data-cp="5432" data-bytes="9D E2">â</span> <span data-cp="5434" data-bytes="8C 75">Œu</span> <span data-cp="544B" data-bytes="9E C0">žÀ</span> <span data-cp="544C" data-bytes="87 C5">‡Å</span> <span data-cp="544D" data-bytes="9E 56">žV</span> <span data-cp="5469" data-bytes="9F 79">Ÿy</span> <span data-cp="546A" data-bytes="9A C7">šÇ</span> <span data-cp="5485" data-bytes="98 A1">˜¡</span> <span data-cp="5493" data-bytes="89 F0">‰ð</span> <span data-cp="5494" data-bytes="9E 47">žG</span> <span data-cp="5497" data-bytes="9D F7">÷</span> <span data-cp="549C" data-bytes="9F D3">ŸÓ</span> <span data-cp="549E" data-bytes="9A CA">šÊ</span> <span data-cp="54A3" data-bytes="89 F1">‰ñ</span> <span data-cp="54B2" data-bytes="8E 5A">ŽZ</span> <span data-cp="54B4" data-bytes="89 F2">‰ò</span> <span data-cp="54B9" data-bytes="89 F3">‰ó</span> <span data-cp="54CB" data-bytes="92 5D">’]</span> <span data-cp="54CC" data-bytes="8B 51">‹Q</span> <span data-cp="54CD" data-bytes="92 E0">’à</span> <span data-cp="54D0" data-bytes="89 F4">‰ô</span> <span data-cp="54DA" data-bytes="9F D4">ŸÔ</span> <span data-cp="54E3" data-bytes="8A 79">Šy</span> <span data-cp="54EF" data-bytes="89 F5">‰õ</span> <span data-cp="5502" data-bytes="97 A7">—§</span> <span data-cp="550D" data-bytes="93 BA">“º</span> <span data-cp="5513" data-bytes="9E 58">žX</span> <span data-cp="5518" data-bytes="89 F6">‰ö</span> <span data-cp="551E" data-bytes="9E 57">žW</span> <span data-cp="5523" data-bytes="89 F7">‰÷</span> <span data-cp="5525" data-bytes="8A 41">ŠA</span> <span data-cp="5528" data-bytes="89 F8">‰ø</span> <span data-cp="553F" data-bytes="89 FA">‰ú</span> <span data-cp="5569" data-bytes="9E 4E">žN</span> <span data-cp="556B" data-bytes="94 DC">”Ü</span> <span data-cp="5571" data-bytes="95 DA">•Ú</span> <span data-cp="5572" data-bytes="9D F8">ø</span> <span data-cp="5573" data-bytes="9F 6A">Ÿj</span> <span data-cp="5579" data-bytes="8A B7">Š·</span> <span data-cp="5590" data-bytes="8A 46">ŠF</span> <span data-cp="55B0" data-bytes="91 48">‘H</span> <span data-cp="55B4" data-bytes="92 DE">’Þ</span> <span data-cp="55B9" data-bytes="8B 53">‹S</span> <span data-cp="55BA" data-bytes="9D F6">ö</span> <span data-cp="55BC" data-bytes="9B DA">›Ú</span> <span data-cp="55C1" data-bytes="9D 7E">~</span> <span data-cp="55D7" data-bytes="89 FD">‰ý</span> <span data-cp="55D8" data-bytes="99 E4">™ä</span> <span data-cp="55DE" data-bytes="9E 43">žC</span> <span data-cp="55EA" data-bytes="9D E9">é</span> <span data-cp="55EC" data-bytes="8F 52">R</span> <span data-cp="55F0" data-bytes="9D F5">õ</span> <span data-cp="55F1" data-bytes="9D F0">ð</span> <span data-cp="55F5" data-bytes="99 E7">™ç</span> <span data-cp="55FB" data-bytes="8B BD">‹½</span> <span data-cp="5605" data-bytes="9D EF">ï</span> <span data-cp="5611" data-bytes="9F B7">Ÿ·</span> <span data-cp="561E" data-bytes="9D D0">Ð</span> <span data-cp="5620" data-bytes="9F EB">Ÿë</span> <span data-cp="5621" data-bytes="8D A9">©</span> <span data-cp="5622" data-bytes="9D CF">Ï</span> <span data-cp="5623" data-bytes="98 E1">˜á</span> <span data-cp="5625" data-bytes="9D E5">å</span> <span data-cp="562D" data-bytes="9D C8">È</span> <span data-cp="5643" data-bytes="9D EB">ë</span> <span data-cp="5650" data-bytes="9A A2">š¢</span> <span data-cp="5652" data-bytes="8A D6">ŠÖ</span> <span data-cp="5654" data-bytes="9A 5F">š_</span> <span data-cp="565D" data-bytes="9E F5">žõ</span> <span data-cp="5661" data-bytes="8F B7">·</span> <span data-cp="567A" data-bytes="9A D2">šÒ</span> <span data-cp="567B" data-bytes="9E 6A">žj</span> <span data-cp="567C" data-bytes="9E E8">žè</span> <span data-cp="5689" data-bytes="8B BF">‹¿</span> <span data-cp="568A" data-bytes="91 C2">‘Â</span> <span data-cp="568B" data-bytes="9D 62">b</span> <span data-cp="5692" data-bytes="92 60">’`</span> <span data-cp="569E" data-bytes="92 5E">’^</span> <span data-cp="569F" data-bytes="91 C1">‘Á</span> <span data-cp="56A1" data-bytes="8A C5">ŠÅ</span> <span data-cp="56A4" data-bytes="97 A3">—£</span> <span data-cp="56AF" data-bytes="8B 6C">‹l</span> <span data-cp="56B1" data-bytes="8D 7E">~</span> <span data-cp="56B9" data-bytes="9C 54">œT</span> <span data-cp="56BF" data-bytes="9D BD">½</span> <span data-cp="56D6" data-bytes="9C C5">œÅ</span> <span data-cp="56E2" data-bytes="89 5B">‰[</span> <span data-cp="56FB" data-bytes="87 65">‡e</span> <span data-cp="56FD" data-bytes="98 C7">˜Ç</span> <span data-cp="5715" data-bytes="9C EE">œî</span> <span data-cp="571D" data-bytes="92 E2">’â</span> <span data-cp="5732" data-bytes="94 A7">”§</span> <span data-cp="573D" data-bytes="8C CC">ŒÌ</span> <span data-cp="573F" data-bytes="9B D4">›Ô</span> <span data-cp="5754" data-bytes="99 E5">™å</span> <span data-cp="5757" data-bytes="9A C2">šÂ</span> <span data-cp="575B" data-bytes="91 FB">‘û</span> <span data-cp="575F" data-bytes="A0 73"> s</span> <span data-cp="5767" data-bytes="9F 72">Ÿr</span> <span data-cp="577A" data-bytes="9F CC">ŸÌ</span> <span data-cp="577E" data-bytes="98 A5">˜¥</span> <span data-cp="577F" data-bytes="92 E8">’è</span> <span data-cp="5788" data-bytes="9B BC">›¼</span> <span data-cp="578A" data-bytes="96 F3">–ó</span> <span data-cp="578D" data-bytes="92 E7">’ç</span> <span data-cp="579C" data-bytes="8B 7D">‹}</span> <span data-cp="57A1" data-bytes="9B F4">›ô</span> <span data-cp="57A7" data-bytes="9E F7">ž÷</span> <span data-cp="57AA" data-bytes="9E C1">žÁ</span> <span data-cp="57B3" data-bytes="87 C3">‡Ã</span> <span data-cp="57B4" data-bytes="99 6F">™o</span> <span data-cp="57BB" data-bytes="96 F1">–ñ</span> <span data-cp="57BE" data-bytes="8E 41">ŽA</span> <span data-cp="57C4" data-bytes="95 4A">•J</span> <span data-cp="57C8" data-bytes="97 E6">—æ</span> <span data-cp="57D7" data-bytes="96 F5">–õ</span> <span data-cp="57DD" data-bytes="92 E6">’æ</span> <span data-cp="57DE" data-bytes="9F 42">ŸB</span> <span data-cp="57EF" data-bytes="99 A9">™©</span> <span data-cp="5812" data-bytes="97 E5">—å</span> <span data-cp="5818" data-bytes="87 C8">‡È</span> <span data-cp="5822" data-bytes="96 7D">–}</span> <span data-cp="583A" data-bytes="99 A2">™¢</span> <span data-cp="5840" data-bytes="9A BB">š»</span> <span data-cp="5844" data-bytes="9A 65">še</span> <span data-cp="5847" data-bytes="94 4E">”N</span> <span data-cp="585F" data-bytes="99 DF">™ß</span> <span data-cp="5869" data-bytes="98 E3">˜ã</span> <span data-cp="586C" data-bytes="92 54">’T</span> <span data-cp="5872" data-bytes="96 7B">–{</span> <span data-cp="5873" data-bytes="8A AF">Š¯</span> <span data-cp="5892" data-bytes="8C 77">Œw</span> <span data-cp="5896" data-bytes="87 B0">‡°</span> <span data-cp="5899" data-bytes="8B AF">‹¯</span> <span data-cp="589A" data-bytes="9E BD">ž½</span> <span data-cp="58A7" data-bytes="9E E6">žæ</span> <span data-cp="58B0" data-bytes="8E E1">Žá</span> <span data-cp="58B5" data-bytes="9B 7D">›}</span> <span data-cp="58B6" data-bytes="9C 7E">œ~</span> <span data-cp="58CB" data-bytes="92 EA">’ê</span> <span data-cp="58D0" data-bytes="8C 78">Œx</span> <span data-cp="58F0" data-bytes="89 5C">‰\</span> <span data-cp="58F2" data-bytes="98 F0">˜ð</span> <span data-cp="58F3" data-bytes="96 F2">–ò</span> <span data-cp="5902" data-bytes="8B C1">‹Á</span> <span data-cp="5904" data-bytes="89 5D">‰]</span> <span data-cp="5905" data-bytes="89 DE">‰Þ</span> <span data-cp="5907" data-bytes="89 5E">‰^</span> <span data-cp="591D" data-bytes="87 68">‡h</span> <span data-cp="5932" data-bytes="89 5F">‰_</span> <span data-cp="5934" data-bytes="89 60">‰`</span> <span data-cp="5965" data-bytes="9B CD">›Í</span> <span data-cp="5975" data-bytes="9D D3">Ó</span> <span data-cp="5989" data-bytes="98 4C">˜L</span> <span data-cp="5994" data-bytes="97 52">—R</span> <span data-cp="599A" data-bytes="95 C3">•Ã</span> <span data-cp="599F" data-bytes="9B B6">›¶</span> <span data-cp="59AC" data-bytes="9A B9">š¹</span> <span data-cp="59B0" data-bytes="97 B3">—³</span> <span data-cp="59B7" data-bytes="9F 74">Ÿt</span> <span data-cp="59B8" data-bytes="92 F1">’ñ</span> <span data-cp="59BF" data-bytes="8C FA">Œú</span> <span data-cp="59C4" data-bytes="97 DF">—ß</span> <span data-cp="59EB" data-bytes="98 77">˜w</span> <span data-cp="59EF" data-bytes="98 54">˜T</span> <span data-cp="59F0" data-bytes="95 C5">•Å</span> <span data-cp="59F8" data-bytes="9D 55">U</span> <span data-cp="5A02" data-bytes="95 7E">•~</span> <span data-cp="5A0B" data-bytes="97 42">—B</span> <span data-cp="5A0D" data-bytes="94 E6">”æ</span> <span data-cp="5A12" data-bytes="92 F5">’õ</span> <span data-cp="5A1A" data-bytes="8C C5">ŒÅ</span> <span data-cp="5A21" data-bytes="92 FD">’ý</span> <span data-cp="5A27" data-bytes="9C 51">œQ</span> <span data-cp="5A2A" data-bytes="94 E9">”é</span> <span data-cp="5A2B" data-bytes="98 5C">˜\</span> <span data-cp="5A2C" data-bytes="92 F0">’ð</span> <span data-cp="5A3D" data-bytes="94 4C">”L</span> <span data-cp="5A45" data-bytes="91 6B">‘k</span> <span data-cp="5A54" data-bytes="8B 78">‹x</span> <span data-cp="5A59" data-bytes="94 E2">”â</span> <span data-cp="5A61" data-bytes="98 4F">˜O</span> <span data-cp="5A67" data-bytes="9C D0">œÐ</span> <span data-cp="5A68" data-bytes="92 71">’q</span> <span data-cp="5A6B" data-bytes="93 65">“e</span> <span data-cp="5A6E" data-bytes="98 5B">˜[</span> <span data-cp="5A71" data-bytes="98 50">˜P</span> <span data-cp="5A79" data-bytes="97 BC">—¼</span> <span data-cp="5A7E" data-bytes="92 F3">’ó</span> <span data-cp="5A81" data-bytes="93 40">“@</span> <span data-cp="5A82" data-bytes="98 4D">˜M</span> <span data-cp="5A86" data-bytes="95 72">•r</span> <span data-cp="5A99" data-bytes="92 EB">’ë</span> <span data-cp="5AA1" data-bytes="97 B7">—·</span> <span data-cp="5AA4" data-bytes="87 6F">‡o</span> <span data-cp="5AC3" data-bytes="90 A7">§</span> <span data-cp="5ACE" data-bytes="97 41">—A</span> <span data-cp="5ACF" data-bytes="92 F4">’ô</span> <span data-cp="5AD1" data-bytes="87 72">‡r</span> <span data-cp="5AE4" data-bytes="95 77">•w</span> <span data-cp="5AF0" data-bytes="9E E2">žâ</span> <span data-cp="5AF2" data-bytes="8F 78">x</span> <span data-cp="5AFE" data-bytes="96 72">–r</span> <span data-cp="5B0D" data-bytes="9E B5">žµ</span> <span data-cp="5B11" data-bytes="96 4B">–K</span> <span data-cp="5B15" data-bytes="8C AC">Œ¬</span> <span data-cp="5B1F" data-bytes="A0 FA"> ú</span> <span data-cp="5B28" data-bytes="96 FC">–ü</span> <span data-cp="5B2B" data-bytes="95 75">•u</span> <span data-cp="5B41" data-bytes="90 DA">Ú</span> <span data-cp="5B44" data-bytes="93 67">“g</span> <span data-cp="5B4A" data-bytes="90 DF">ß</span> <span data-cp="5B4F" data-bytes="93 54">“T</span> <span data-cp="5B66" data-bytes="89 61">‰a</span> <span data-cp="5B68" data-bytes="8B B4">‹´</span> <span data-cp="5B6D" data-bytes="9D C0">À</span> <span data-cp="5B74" data-bytes="8E 48">ŽH</span> <span data-cp="5B90" data-bytes="9E 67">žg</span> <span data-cp="5B96" data-bytes="8C D9">ŒÙ</span> <span data-cp="5B9E" data-bytes="89 62">‰b</span> <span data-cp="5B9F" data-bytes="89 63">‰c</span> <span data-cp="5BB7" data-bytes="87 73">‡s</span> <span data-cp="5BC3" data-bytes="9F 6B">Ÿk</span> <span data-cp="5BDB" data-bytes="87 6D">‡m</span> <span data-cp="5C10" data-bytes="9C BC">œ¼</span> <span data-cp="5C1C" data-bytes="8B 5D">‹]</span> <span data-cp="5C1E" data-bytes="93 4C">“L</span> <span data-cp="5C20" data-bytes="9A E2">šâ</span> <span data-cp="5C23" data-bytes="8B C9">‹É</span> <span data-cp="5C4A" data-bytes="9F C9">ŸÉ</span> <span data-cp="5C53" data-bytes="9F 44">ŸD</span> <span data-cp="5C5E" data-bytes="98 ED">˜í</span> <span data-cp="5C78" data-bytes="8C E9">Œé</span> <span data-cp="5C99" data-bytes="8D F2">ò</span> <span data-cp="5C9A" data-bytes="89 64">‰d</span> <span data-cp="5C9E" data-bytes="93 4D">“M</span> <span data-cp="5CC1" data-bytes="A0 F2"> ò</span> <span data-cp="5CC2" data-bytes="98 68">˜h</span> <span data-cp="5CD1" data-bytes="9F 58">ŸX</span> <span data-cp="5CD5" data-bytes="8C E6">Œæ</span> <span data-cp="5CE5" data-bytes="8D 73">s</span> <span data-cp="5CF5" data-bytes="8C 48">ŒH</span> <span data-cp="5CFC" data-bytes="87 74">‡t</span> <span data-cp="5D15" data-bytes="8D A8">¨</span> <span data-cp="5D2C" data-bytes="9C 75">œu</span> <span data-cp="5D2F" data-bytes="98 78">˜x</span> <span data-cp="5D3E" data-bytes="8D 60">`</span> <span data-cp="5D48" data-bytes="8D 61">a</span> <span data-cp="5D56" data-bytes="8D 62">b</span> <span data-cp="5D57" data-bytes="A0 A1"> ¡</span> <span data-cp="5D5B" data-bytes="9C 40">œ@</span> <span data-cp="5D70" data-bytes="98 AD">˜­</span> <span data-cp="5D74" data-bytes="9E EA">žê</span> <span data-cp="5D78" data-bytes="8C EC">Œì</span> <span data-cp="5D7B" data-bytes="8C D4">ŒÔ</span> <span data-cp="5D85" data-bytes="9C EB">œë</span> <span data-cp="5D8E" data-bytes="9F 51">ŸQ</span> <span data-cp="5DA4" data-bytes="8D 65">e</span> <span data-cp="5DAB" data-bytes="9C F1">œñ</span> <span data-cp="5DB9" data-bytes="8D 66">f</span> <span data-cp="5DC1" data-bytes="96 54">–T</span> <span data-cp="5DF5" data-bytes="9F CE">ŸÎ</span> <span data-cp="5E0B" data-bytes="9A E4">šä</span> <span data-cp="5E12" data-bytes="9F 75">Ÿu</span> <span data-cp="5E42" data-bytes="8D 69">i</span> <span data-cp="5E48" data-bytes="93 4F">“O</span> <span data-cp="5E5E" data-bytes="93 4E">“N</span> <span data-cp="5E86" data-bytes="89 65">‰e</span> <span data-cp="5E92" data-bytes="8C 7A">Œz</span> <span data-cp="5E99" data-bytes="8C 7B">Œ{</span> <span data-cp="5EBD" data-bytes="8D 6A">j</span> <span data-cp="5ECD" data-bytes="93 53">“S</span> <span data-cp="5ED0" data-bytes="9D FB">û</span> <span data-cp="5EF8" data-bytes="90 59">Y</span> <span data-cp="5F0C" data-bytes="93 61">“a</span> <span data-cp="5F0E" data-bytes="93 62">“b</span> <span data-cp="5F25" data-bytes="8D 6B">k</span> <span data-cp="5F3B" data-bytes="8C FE">Œþ</span> <span data-cp="5F4D" data-bytes="95 B8">•¸</span> <span data-cp="5F51" data-bytes="8B CA">‹Ê</span> <span data-cp="5F5C" data-bytes="98 7A">˜z</span> <span data-cp="5F83" data-bytes="8D 6C">l</span> <span data-cp="5FB1" data-bytes="9B 70">›p</span> <span data-cp="5FBA" data-bytes="A0 51"> Q</span> <span data-cp="5FC2" data-bytes="8C 7C">Œ|</span> <span data-cp="5FC4" data-bytes="8B CB">‹Ë</span> <span data-cp="5FDB" data-bytes="93 6E">“n</span> <span data-cp="603B" data-bytes="89 66">‰f</span> <span data-cp="6062" data-bytes="9E A9">ž©</span> <span data-cp="6075" data-bytes="93 7A">“z</span> <span data-cp="6077" data-bytes="A0 E0"> à</span> <span data-cp="607E" data-bytes="93 6B">“k</span> <span data-cp="60A4" data-bytes="A0 DC"> Ü</span> <span data-cp="60A7" data-bytes="94 68">”h</span> <span data-cp="60D7" data-bytes="8D 71">q</span> <span data-cp="60DE" data-bytes="9B EC">›ì</span> <span data-cp="60E3" data-bytes="99 BA">™º</span> <span data-cp="60E7" data-bytes="9A D0">šÐ</span> <span data-cp="60E8" data-bytes="9A 61">ša</span> <span data-cp="60E9" data-bytes="A0 E5"> å</span> <span data-cp="60FD" data-bytes="A0 5B"> [</span> <span data-cp="6107" data-bytes="96 AC">–¬</span> <span data-cp="610C" data-bytes="97 40">—@</span> <span data-cp="6119" data-bytes="9E F1">žñ</span> <span data-cp="6122" data-bytes="8C 4D">ŒM</span> <span data-cp="6130" data-bytes="9F 7E">Ÿ~</span> <span data-cp="613D" data-bytes="8D 72">r</span> <span data-cp="6150" data-bytes="96 A9">–©</span> <span data-cp="6159" data-bytes="A0 6E"> n</span> <span data-cp="616F" data-bytes="A0 74"> t</span> <span data-cp="617D" data-bytes="A0 71"> q</span> <span data-cp="6195" data-bytes="9C 50">œP</span> <span data-cp="6198" data-bytes="93 79">“y</span> <span data-cp="6199" data-bytes="93 78">“x</span> <span data-cp="619C" data-bytes="A0 DD"> Ý</span> <span data-cp="61B7" data-bytes="8D 75">u</span> <span data-cp="61B9" data-bytes="8D 76">v</span> <span data-cp="61C0" data-bytes="93 74">“t</span> <span data-cp="61CF" data-bytes="8D 77">w</span> <span data-cp="61DA" data-bytes="90 C3">Ã</span> <span data-cp="61E2" data-bytes="A0 79"> y</span> <span data-cp="622C" data-bytes="8D 79">y</span> <span data-cp="6237" data-bytes="8B FC">‹ü</span> <span data-cp="6239" data-bytes="A0 76"> v</span> <span data-cp="624C" data-bytes="8B CD">‹Í</span> <span data-cp="6268" data-bytes="9F 5A">ŸZ</span> <span data-cp="6282" data-bytes="9F F4">Ÿô</span> <span data-cp="6285" data-bytes="9F BA">Ÿº</span> <span data-cp="6290" data-bytes="8D 7A">z</span> <span data-cp="629D" data-bytes="9E 45">žE</span> <span data-cp="62A4" data-bytes="93 B0">“°</span> <span data-cp="62A6" data-bytes="A0 75"> u</span> <span data-cp="62C1" data-bytes="87 DD">‡Ý</span> <span data-cp="62C3" data-bytes="9B 46">›F</span> <span data-cp="62CE" data-bytes="A0 77"> w</span> <span data-cp="62D0" data-bytes="9D C4">Ä</span> <span data-cp="62E5" data-bytes="8D 7B">{</span> <span data-cp="6318" data-bytes="8D 7C">|</span> <span data-cp="632E" data-bytes="9E D6">žÖ</span> <span data-cp="6331" data-bytes="93 AC">“¬</span> <span data-cp="6335" data-bytes="9F 5B">Ÿ[</span> <span data-cp="6337" data-bytes="93 A9">“©</span> <span data-cp="6364" data-bytes="A0 7C"> |</span> <span data-cp="6379" data-bytes="8A C1">ŠÁ</span> <span data-cp="637F" data-bytes="9F B4">Ÿ´</span> <span data-cp="63B9" data-bytes="9E 4C">žL</span> <span data-cp="63C1" data-bytes="8F C5">Å</span> <span data-cp="63D1" data-bytes="93 AD">“­</span> <span data-cp="63DE" data-bytes="9D C3">Ã</span> <span data-cp="63E2" data-bytes="8D A2">¢</span> <span data-cp="63E6" data-bytes="9D 4A">J</span> <span data-cp="63FB" data-bytes="8D A3">£</span> <span data-cp="63FC" data-bytes="9E 4B">žK</span> <span data-cp="63FE" data-bytes="9E 4D">žM</span> <span data-cp="6407" data-bytes="8D A4">¤</span> <span data-cp="6432" data-bytes="8A FD">Šý</span> <span data-cp="643B" data-bytes="93 B2">“²</span> <span data-cp="645A" data-bytes="8D A5">¥</span> <span data-cp="6471" data-bytes="93 A1">“¡</span> <span data-cp="647C" data-bytes="8A C6">ŠÆ</span> <span data-cp="648D" data-bytes="8A 5B">Š[</span> <span data-cp="6491" data-bytes="89 4D">‰M</span> <span data-cp="64B4" data-bytes="8A 78">Šx</span> <span data-cp="64B6" data-bytes="93 AB">“«</span> <span data-cp="64C0" data-bytes="8D A7">§</span> <span data-cp="64D3" data-bytes="9F 45">ŸE</span> <span data-cp="64DD" data-bytes="8A 56">ŠV</span> <span data-cp="64E7" data-bytes="8E E6">Žæ</span> <span data-cp="64EA" data-bytes="8A A4">Š¤</span> <span data-cp="650A" data-bytes="89 43">‰C</span> <span data-cp="6511" data-bytes="93 F3">“ó</span> <span data-cp="651F" data-bytes="9E A2">ž¢</span> <span data-cp="6530" data-bytes="9D C7">Ç</span> <span data-cp="6535" data-bytes="8B CE">‹Î</span> <span data-cp="656B" data-bytes="93 B3">“³</span> <span data-cp="6586" data-bytes="8D AC">¬</span> <span data-cp="6589" data-bytes="89 67">‰g</span> <span data-cp="658B" data-bytes="8C 7E">Œ~</span> <span data-cp="65BE" data-bytes="9C F3">œó</span> <span data-cp="65D4" data-bytes="95 BB">•»</span> <span data-cp="65FF" data-bytes="8D AE">®</span> <span data-cp="661E" data-bytes="93 DB">“Û</span> <span data-cp="6630" data-bytes="93 D5">“Õ</span> <span data-cp="6648" data-bytes="9B 71">›q</span> <span data-cp="664D" data-bytes="87 64">‡d</span> <span data-cp="6653" data-bytes="8D AF">¯</span> <span data-cp="6660" data-bytes="87 B5">‡µ</span> <span data-cp="6663" data-bytes="93 D8">“Ø</span> <span data-cp="666B" data-bytes="93 D3">“Ó</span> <span data-cp="667D" data-bytes="8E 76">Žv</span> <span data-cp="668E" data-bytes="93 D1">“Ñ</span> <span data-cp="6692" data-bytes="8D B1">±</span> <span data-cp="669A" data-bytes="98 59">˜Y</span> <span data-cp="66B6" data-bytes="9C BF">œ¿</span> <span data-cp="66BF" data-bytes="9B 72">›r</span> <span data-cp="66CE" data-bytes="93 BE">“¾</span> <span data-cp="66E7" data-bytes="8C DB">ŒÛ</span> <span data-cp="66F1" data-bytes="9D F1">ñ</span> <span data-cp="670C" data-bytes="A0 BB"> »</span> <span data-cp="670E" data-bytes="9B 7E">›~</span> <span data-cp="6716" data-bytes="8D B3">³</span> <span data-cp="6719" data-bytes="8C 52">ŒR</span> <span data-cp="671E" data-bytes="9A E8">šè</span> <span data-cp="6725" data-bytes="8E DC">ŽÜ</span> <span data-cp="6736" data-bytes="9C F9">œù</span> <span data-cp="6761" data-bytes="98 E7">˜ç</span> <span data-cp="676B" data-bytes="8C CA">ŒÊ</span> <span data-cp="676E" data-bytes="87 75">‡u</span> <span data-cp="6782" data-bytes="87 BA">‡º</span> <span data-cp="678F" data-bytes="93 E5">“å</span> <span data-cp="67A0" data-bytes="9A 59">šY</span> <span data-cp="67A4" data-bytes="8D B5">µ</span> <span data-cp="67BF" data-bytes="8F 7D">}</span> <span data-cp="67D6" data-bytes="95 47">•G</span> <span data-cp="67F9" data-bytes="92 50">’P</span> <span data-cp="67FE" data-bytes="89 68">‰h</span> <span data-cp="6800" data-bytes="8D B6">¶</span> <span data-cp="6802" data-bytes="A0 7D"> }</span> <span data-cp="6803" data-bytes="98 FC">˜ü</span> <span data-cp="6804" data-bytes="89 69">‰i</span> <span data-cp="6810" data-bytes="92 56">’V</span> <span data-cp="681E" data-bytes="93 E8">“è</span> <span data-cp="6836" data-bytes="9C E3">œã</span> <span data-cp="6847" data-bytes="96 40">–@</span> <span data-cp="684A" data-bytes="8D B8">¸</span> <span data-cp="6855" data-bytes="9B 4A">›J</span> <span data-cp="6856" data-bytes="8F B9">¹</span> <span data-cp="6865" data-bytes="89 6A">‰j</span> <span data-cp="6884" data-bytes="8D B9">¹</span> <span data-cp="6888" data-bytes="91 7E">‘~</span> <span data-cp="6898" data-bytes="93 F4">“ô</span> <span data-cp="68B6" data-bytes="93 E7">“ç</span> <span data-cp="68B9" data-bytes="97 EF">—ï</span> <span data-cp="68C5" data-bytes="96 A5">–¥</span> <span data-cp="6909" data-bytes="8D BD">½</span> <span data-cp="6918" data-bytes="9B A1">›¡</span> <span data-cp="6919" data-bytes="8C A2">Œ¢</span> <span data-cp="691A" data-bytes="9A B7">š·</span> <span data-cp="691B" data-bytes="8E FC">Žü</span> <span data-cp="692C" data-bytes="9F A1">Ÿ¡</span> <span data-cp="6943" data-bytes="8D BE">¾</span> <span data-cp="6946" data-bytes="89 A4">‰¤</span> <span data-cp="6955" data-bytes="9A D9">šÙ</span> <span data-cp="6964" data-bytes="8D C0">À</span> <span data-cp="6967" data-bytes="97 F0">—ð</span> <span data-cp="6972" data-bytes="93 B4">“´</span> <span data-cp="6980" data-bytes="9F A7">Ÿ§</span> <span data-cp="6985" data-bytes="8D C2">Â</span> <span data-cp="698A" data-bytes="99 B6">™¶</span> <span data-cp="699F" data-bytes="8D C1">Á</span> <span data-cp="69A2" data-bytes="8E 46">ŽF</span> <span data-cp="69B2" data-bytes="A0 D1"> Ñ</span> <span data-cp="69C0" data-bytes="9F CA">ŸÊ</span> <span data-cp="69D1" data-bytes="92 CF">’Ï</span> <span data-cp="69D5" data-bytes="9C F4">œô</span> <span data-cp="69D6" data-bytes="8D C4">Ä</span> <span data-cp="69E9" data-bytes="9B 4C">›L</span> <span data-cp="6A03" data-bytes="9C DE">œÞ</span> <span data-cp="6A0C" data-bytes="98 6C">˜l</span> <span data-cp="6A1A" data-bytes="97 F9">—ù</span> <span data-cp="6A1C" data-bytes="95 58">•X</span> <span data-cp="6A29" data-bytes="87 B6">‡¶</span> <span data-cp="6A2B" data-bytes="98 5E">˜^</span> <span data-cp="6A2D" data-bytes="94 CD">”Í</span> <span data-cp="6A33" data-bytes="93 EE">“î</span> <span data-cp="6A43" data-bytes="8C A3">Œ£</span> <span data-cp="6A4C" data-bytes="93 F5">“õ</span> <span data-cp="6A52" data-bytes="93 EF">“ï</span> <span data-cp="6A53" data-bytes="8E EA">Žê</span> <span data-cp="6A57" data-bytes="8F 5B">[</span> <span data-cp="6A63" data-bytes="8C 5E">Œ^</span> <span data-cp="6A65" data-bytes="8D C6">Æ</span> <span data-cp="6A71" data-bytes="8D C8">È</span> <span data-cp="6A74" data-bytes="8D C7">Ç</span> <span data-cp="6A7A" data-bytes="93 F7">“÷</span> <span data-cp="6A82" data-bytes="8D C9">É</span> <span data-cp="6A8F" data-bytes="96 70">–p</span> <span data-cp="6A99" data-bytes="8D CB">Ë</span> <span data-cp="6AA7" data-bytes="8F 65">e</span> <span data-cp="6AAB" data-bytes="8D CD">Í</span> <span data-cp="6AB1" data-bytes="9D A8">¨</span> <span data-cp="6AB2" data-bytes="94 F9">”ù</span> <span data-cp="6AB5" data-bytes="8D CE">Î</span> <span data-cp="6ABE" data-bytes="93 EA">“ê</span> <span data-cp="6AC9" data-bytes="93 F0">“ð</span> <span data-cp="6ACA" data-bytes="9F B6">Ÿ¶</span> <span data-cp="6AD4" data-bytes="8D CF">Ï</span> <span data-cp="6AD8" data-bytes="97 63">—c</span> <span data-cp="6AF6" data-bytes="8D D0">Ð</span> <span data-cp="6B05" data-bytes="93 F1">“ñ</span> <span data-cp="6B52" data-bytes="9F DB">ŸÛ</span> <span data-cp="6B57" data-bytes="93 F8">“ø</span> <span data-cp="6B6F" data-bytes="8B F7">‹÷</span> <span data-cp="6B7A" data-bytes="8B CF">‹Ï</span> <span data-cp="6B81" data-bytes="8D D1">Ñ</span> <span data-cp="6BC1" data-bytes="8D D2">Ò</span> <span data-cp="6BEA" data-bytes="8D D3">Ó</span> <span data-cp="6BFA" data-bytes="9F E7">Ÿç</span> <span data-cp="6C1C" data-bytes="90 BD">½</span> <span data-cp="6C31" data-bytes="9F D0">ŸÐ</span> <span data-cp="6C35" data-bytes="8B D0">‹Ð</span> <span data-cp="6C39" data-bytes="9C AE">œ®</span> <span data-cp="6C3A" data-bytes="8B D1">‹Ñ</span> <span data-cp="6C3D" data-bytes="8A DB">ŠÛ</span> <span data-cp="6C4A" data-bytes="9E FD">žý</span> <span data-cp="6C58" data-bytes="95 CE">•Î</span> <span data-cp="6C75" data-bytes="8D D4">Ô</span> <span data-cp="6C7F" data-bytes="8E E3">Žã</span> <span data-cp="6C9F" data-bytes="90 76">v</span> <span data-cp="6CA2" data-bytes="98 C6">˜Æ</span> <span data-cp="6CAA" data-bytes="8D D5">Õ</span> <span data-cp="6CAF" data-bytes="97 D1">—Ñ</span> <span data-cp="6CB2" data-bytes="9E B6">ž¶</span> <span data-cp="6CCE" data-bytes="A0 42"> B</span> <span data-cp="6CDF" data-bytes="98 73">˜s</span> <span data-cp="6CEA" data-bytes="9F FC">Ÿü</span> <span data-cp="6CFF" data-bytes="8C A5">Œ¥</span> <span data-cp="6D02" data-bytes="8D D7">×</span> <span data-cp="6D05" data-bytes="92 FB">’û</span> <span data-cp="6D06" data-bytes="8D D8">Ø</span> <span data-cp="6D24" data-bytes="94 4F">”O</span> <span data-cp="6D26" data-bytes="8D D9">Ù</span> <span data-cp="6D4E" data-bytes="89 6B">‰k</span> <span data-cp="6D57" data-bytes="97 CE">—Î</span> <span data-cp="6D67" data-bytes="94 47">”G</span> <span data-cp="6D72" data-bytes="92 B7">’·</span> <span data-cp="6D81" data-bytes="8D DA">Ú</span> <span data-cp="6D8F" data-bytes="9C 5A">œZ</span> <span data-cp="6DA4" data-bytes="8D DC">Ü</span> <span data-cp="6DA5" data-bytes="94 44">”D</span> <span data-cp="6DB1" data-bytes="8D DD">Ý</span> <span data-cp="6DB9" data-bytes="A0 D6"> Ö</span> <span data-cp="6DFE" data-bytes="8C 41">ŒA</span> <span data-cp="6E02" data-bytes="97 D5">—Õ</span> <span data-cp="6E04" data-bytes="94 4A">”J</span> <span data-cp="6E0A" data-bytes="94 4D">”M</span> <span data-cp="6E0F" data-bytes="97 CB">—Ë</span> <span data-cp="6E15" data-bytes="8D DE">Þ</span> <span data-cp="6E18" data-bytes="8D DF">ß</span> <span data-cp="6E29" data-bytes="8D E0">à</span> <span data-cp="6E57" data-bytes="8C DD">ŒÝ</span> <span data-cp="6E76" data-bytes="92 B3">’³</span> <span data-cp="6E86" data-bytes="8D E1">á</span> <span data-cp="6E8B" data-bytes="95 D3">•Ó</span> <span data-cp="6E9A" data-bytes="89 C1">‰Á</span> <span data-cp="6EB8" data-bytes="9C B7">œ·</span> <span data-cp="6EBB" data-bytes="8D E3">ã</span> <span data-cp="6EDA" data-bytes="8D E5">å</span> <span data-cp="6EDD" data-bytes="89 47">‰G</span> <span data-cp="6EE2" data-bytes="8D E4">ä</span> <span data-cp="6EE8" data-bytes="8D E7">ç</span> <span data-cp="6EE9" data-bytes="8D E8">è</span> <span data-cp="6F0B" data-bytes="94 45">”E</span> <span data-cp="6F0C" data-bytes="97 D6">—Ö</span> <span data-cp="6F17" data-bytes="98 44">˜D</span> <span data-cp="6F24" data-bytes="8D E9">é</span> <span data-cp="6F34" data-bytes="8D EA">ê</span> <span data-cp="6F56" data-bytes="9D A7">§</span> <span data-cp="6F79" data-bytes="95 D2">•Ò</span> <span data-cp="6F81" data-bytes="8D ED">í</span> <span data-cp="6FB5" data-bytes="9C DC">œÜ</span> <span data-cp="6FB6" data-bytes="9B F6">›ö</span> <span data-cp="6FBB" data-bytes="95 CF">•Ï</span> <span data-cp="6FBE" data-bytes="8D EE">î</span> <span data-cp="6FD9" data-bytes="96 EC">–ì</span> <span data-cp="6FDA" data-bytes="96 EB">–ë</span> <span data-cp="6FF6" data-bytes="90 B6">¶</span> <span data-cp="7003" data-bytes="98 AB">˜«</span> <span data-cp="701E" data-bytes="96 ED">–í</span> <span data-cp="702C" data-bytes="8D F4">ô</span> <span data-cp="704D" data-bytes="8C 67">Œg</span> <span data-cp="7050" data-bytes="8D F6">ö</span> <span data-cp="7054" data-bytes="8D F7">÷</span> <span data-cp="705C" data-bytes="8F FA">ú</span> <span data-cp="7067" data-bytes="97 D0">—Ð</span> <span data-cp="706C" data-bytes="8B D2">‹Ò</span> <span data-cp="706E" data-bytes="87 DE">‡Þ</span> <span data-cp="706F" data-bytes="8D F8">ø</span> <span data-cp="7075" data-bytes="90 D9">Ù</span> <span data-cp="7077" data-bytes="8C 47">ŒG</span> <span data-cp="707F" data-bytes="8D F9">ù</span> <span data-cp="7089" data-bytes="8D FA">ú</span> <span data-cp="708F" data-bytes="90 A6">¦</span> <span data-cp="70A0" data-bytes="99 70">™p</span> <span data-cp="70A3" data-bytes="91 EB">‘ë</span> <span data-cp="70A5" data-bytes="97 70">—p</span> <span data-cp="70A6" data-bytes="98 6F">˜o</span> <span data-cp="70B9" data-bytes="98 F2">˜ò</span> <span data-cp="70BB" data-bytes="9A FC">šü</span> <span data-cp="70BC" data-bytes="89 6C">‰l</span> <span data-cp="70C0" data-bytes="99 5E">™^</span> <span data-cp="70C4" data-bytes="95 BD">•½</span> <span data-cp="70D0" data-bytes="91 E6">‘æ</span> <span data-cp="70F1" data-bytes="94 54">”T</span> <span data-cp="70F5" data-bytes="99 B8">™¸</span> <span data-cp="70FE" data-bytes="97 E9">—é</span> <span data-cp="7105" data-bytes="93 46">“F</span> <span data-cp="711D" data-bytes="98 63">˜c</span> <span data-cp="7129" data-bytes="95 BC">•¼</span> <span data-cp="7133" data-bytes="98 70">˜p</span> <span data-cp="7134" data-bytes="96 F6">–ö</span> <span data-cp="7135" data-bytes="8E A9">Ž©</span> <span data-cp="713B" data-bytes="94 51">”Q</span> <span data-cp="713E" data-bytes="8E 43">ŽC</span> <span data-cp="7140" data-bytes="8B 5A">‹Z</span> <span data-cp="7151" data-bytes="9B F5">›õ</span> <span data-cp="7157" data-bytes="8C EE">Œî</span> <span data-cp="7162" data-bytes="A0 DF"> ß</span> <span data-cp="716B" data-bytes="97 7E">—~</span> <span data-cp="7171" data-bytes="9B D5">›Õ</span> <span data-cp="7173" data-bytes="9A C3">šÃ</span> <span data-cp="7175" data-bytes="97 C8">—È</span> <span data-cp="7176" data-bytes="A0 DB"> Û</span> <span data-cp="7177" data-bytes="91 D0">‘Ð</span> <span data-cp="717A" data-bytes="9F E4">Ÿä</span> <span data-cp="717C" data-bytes="8F DD">Ý</span> <span data-cp="717E" data-bytes="91 E9">‘é</span> <span data-cp="7188" data-bytes="98 E0">˜à</span> <span data-cp="718C" data-bytes="92 CA">’Ê</span> <span data-cp="718E" data-bytes="98 57">˜W</span> <span data-cp="7191" data-bytes="8C 51">ŒQ</span> <span data-cp="7198" data-bytes="9B 49">›I</span> <span data-cp="71A2" data-bytes="9D 76">v</span> <span data-cp="71A3" data-bytes="9E AF">ž¯</span> <span data-cp="71AD" data-bytes="9C CC">œÌ</span> <span data-cp="71B7" data-bytes="8D F1">ñ</span> <span data-cp="71D1" data-bytes="8E 53">ŽS</span> <span data-cp="71DF" data-bytes="9C 62">œb</span> <span data-cp="71EB" data-bytes="96 F9">–ù</span> <span data-cp="71F5" data-bytes="98 BF">˜¿</span> <span data-cp="71F6" data-bytes="9E 49">žI</span> <span data-cp="7200" data-bytes="8C A7">Œ§</span> <span data-cp="7201" data-bytes="9B 76">›v</span> <span data-cp="7209" data-bytes="9B CA">›Ê</span> <span data-cp="720F" data-bytes="92 DC">’Ü</span> <span data-cp="7216" data-bytes="91 CC">‘Ì</span> <span data-cp="7217" data-bytes="91 E2">‘â</span> <span data-cp="7225" data-bytes="87 5F">‡_</span> <span data-cp="722B" data-bytes="8B D3">‹Ó</span> <span data-cp="7250" data-bytes="94 55">”U</span> <span data-cp="725C" data-bytes="8D BF">¿</span> <span data-cp="7266" data-bytes="9E 78">žx</span> <span data-cp="7287" data-bytes="94 56">”V</span> <span data-cp="728F" data-bytes="9D 61">a</span> <span data-cp="7294" data-bytes="94 57">”W</span> <span data-cp="729F" data-bytes="99 66">™f</span> <span data-cp="72AD" data-bytes="8B D5">‹Õ</span> <span data-cp="72B2" data-bytes="A0 69"> i</span> <span data-cp="72CD" data-bytes="98 B4">˜´</span> <span data-cp="72E2" data-bytes="A0 49"> I</span> <span data-cp="7302" data-bytes="A0 4C"> L</span> <span data-cp="7304" data-bytes="9E 65">že</span> <span data-cp="7310" data-bytes="98 B5">˜µ</span> <span data-cp="732A" data-bytes="99 75">™u</span> <span data-cp="732C" data-bytes="A0 65"> e</span> <span data-cp="7338" data-bytes="98 B7">˜·</span> <span data-cp="7339" data-bytes="98 B8">˜¸</span> <span data-cp="7341" data-bytes="98 BA">˜º</span> <span data-cp="7348" data-bytes="98 BB">˜»</span> <span data-cp="734F" data-bytes="9F BC">Ÿ¼</span> <span data-cp="7371" data-bytes="A0 4A"> J</span> <span data-cp="7374" data-bytes="9E C7">žÇ</span> <span data-cp="738C" data-bytes="8C A9">Œ©</span> <span data-cp="738F" data-bytes="98 AE">˜®</span> <span data-cp="7398" data-bytes="92 D6">’Ö</span> <span data-cp="739E" data-bytes="91 D4">‘Ô</span> <span data-cp="73BA" data-bytes="8C 53">ŒS</span> <span data-cp="73C4" data-bytes="87 BF">‡¿</span> <span data-cp="73D0" data-bytes="94 C5">”Å</span> <span data-cp="73E1" data-bytes="98 C1">˜Á</span> <span data-cp="73E2" data-bytes="97 5C">—\</span> <span data-cp="73E6" data-bytes="97 73">—s</span> <span data-cp="73F3" data-bytes="97 64">—d</span> <span data-cp="73F9" data-bytes="96 4E">–N</span> <span data-cp="73FB" data-bytes="97 65">—e</span> <span data-cp="7402" data-bytes="8C 5A">ŒZ</span> <span data-cp="7411" data-bytes="89 A1">‰¡</span> <span data-cp="7412" data-bytes="95 FA">•ú</span> <span data-cp="7414" data-bytes="92 D4">’Ô</span> <span data-cp="7419" data-bytes="98 C8">˜È</span> <span data-cp="741C" data-bytes="90 EF">ï</span> <span data-cp="741E" data-bytes="98 C9">˜É</span> <span data-cp="741F" data-bytes="98 CA">˜Ê</span> <span data-cp="7437" data-bytes="94 6D">”m</span> <span data-cp="7438" data-bytes="94 B7">”·</span> <span data-cp="743C" data-bytes="94 6B">”k</span> <span data-cp="7443" data-bytes="92 FC">’ü</span> <span data-cp="7445" data-bytes="95 EB">•ë</span> <span data-cp="7448" data-bytes="97 6E">—n</span> <span data-cp="744C" data-bytes="87 B8">‡¸</span> <span data-cp="7456" data-bytes="92 D5">’Õ</span> <span data-cp="7461" data-bytes="87 78">‡x</span> <span data-cp="7468" data-bytes="94 7A">”z</span> <span data-cp="746B" data-bytes="95 FB">•û</span> <span data-cp="7479" data-bytes="92 D1">’Ñ</span> <span data-cp="747A" data-bytes="94 5D">”]</span> <span data-cp="748C" data-bytes="93 44">“D</span> <span data-cp="748D" data-bytes="8E A6">Ž¦</span> <span data-cp="7499" data-bytes="92 D3">’Ó</span> <span data-cp="749B" data-bytes="94 B8">”¸</span> <span data-cp="749D" data-bytes="87 79">‡y</span> <span data-cp="74B4" data-bytes="97 5E">—^</span> <span data-cp="74B9" data-bytes="8C AD">Œ­</span> <span data-cp="74C6" data-bytes="87 C1">‡Á</span> <span data-cp="74CC" data-bytes="94 6A">”j</span> <span data-cp="74D0" data-bytes="93 E3">“ã</span> <span data-cp="74D3" data-bytes="98 CF">˜Ï</span> <span data-cp="74E7" data-bytes="A0 D9"> Ù</span> <span data-cp="74F0" data-bytes="A0 BF"> ¿</span> <span data-cp="74F1" data-bytes="A0 4D"> M</span> <span data-cp="74F2" data-bytes="A0 B8"> ¸</span> <span data-cp="74F8" data-bytes="A0 CE"> Î</span> <span data-cp="7505" data-bytes="A0 B7"> ·</span> <span data-cp="7519" data-bytes="89 C3">‰Ã</span> <span data-cp="7534" data-bytes="9D F4">ô</span> <span data-cp="7535" data-bytes="89 6D">‰m</span> <span data-cp="753B" data-bytes="9C 7B">œ{</span> <span data-cp="7542" data-bytes="98 D2">˜Ò</span> <span data-cp="7546" data-bytes="9F A9">Ÿ©</span> <span data-cp="7551" data-bytes="97 D9">—Ù</span> <span data-cp="7553" data-bytes="A0 C4"> Ä</span> <span data-cp="7555" data-bytes="94 76">”v</span> <span data-cp="7560" data-bytes="99 78">™x</span> <span data-cp="756D" data-bytes="98 D3">˜Ó</span> <span data-cp="7572" data-bytes="98 D4">˜Ô</span> <span data-cp="757A" data-bytes="9F B9">Ÿ¹</span> <span data-cp="7583" data-bytes="94 71">”q</span> <span data-cp="758D" data-bytes="98 D5">˜Õ</span> <span data-cp="75B1" data-bytes="9E 5C">ž\</span> <span data-cp="75C3" data-bytes="A0 44"> D</span> <span data-cp="75C8" data-bytes="98 D7">˜×</span> <span data-cp="75DC" data-bytes="98 D8">˜Ø</span> <span data-cp="75F9" data-bytes="9E EF">žï</span> <span data-cp="7607" data-bytes="9F FE">Ÿþ</span> <span data-cp="763B" data-bytes="9D DD">Ý</span> <span data-cp="7640" data-bytes="9E E1">žá</span> <span data-cp="764D" data-bytes="98 DA">˜Ú</span> <span data-cp="764E" data-bytes="9D DF">ß</span> <span data-cp="7654" data-bytes="9E EB">žë</span> <span data-cp="7666" data-bytes="9E 59">žY</span> <span data-cp="7667" data-bytes="A0 5C"> \</span> <span data-cp="7673" data-bytes="94 77">”w</span> <span data-cp="7674" data-bytes="98 DC">˜Ü</span> <span data-cp="767A" data-bytes="98 DE">˜Þ</span> <span data-cp="76D6" data-bytes="9F C2">ŸÂ</span> <span data-cp="76D9" data-bytes="8C 6B">Œk</span> <span data-cp="770C" data-bytes="98 C4">˜Ä</span> <span data-cp="770E" data-bytes="94 B0">”°</span> <span data-cp="770F" data-bytes="94 B1">”±</span> <span data-cp="7724" data-bytes="A0 C1"> Á</span> <span data-cp="772B" data-bytes="A0 CD"> Í</span> <span data-cp="7743" data-bytes="98 E5">˜å</span> <span data-cp="7772" data-bytes="91 E4">‘ä</span> <span data-cp="7777" data-bytes="8F C7">Ç</span> <span data-cp="7778" data-bytes="94 AE">”®</span> <span data-cp="777A" data-bytes="8A 4F">ŠO</span> <span data-cp="777B" data-bytes="94 B2">”²</span> <span data-cp="7793" data-bytes="8F D4">Ô</span> <span data-cp="7798" data-bytes="98 EA">˜ê</span> <span data-cp="77B9" data-bytes="9D E0">à</span> <span data-cp="77BE" data-bytes="98 EE">˜î</span> <span data-cp="77C3" data-bytes="95 C4">•Ä</span> <span data-cp="77CB" data-bytes="98 EF">˜ï</span> <span data-cp="77D7" data-bytes="9B 78">›x</span> <span data-cp="77DD" data-bytes="8C 6E">Œn</span> <span data-cp="77FE" data-bytes="A0 AE"> ®</span> <span data-cp="7808" data-bytes="9D 4C">L</span> <span data-cp="7818" data-bytes="98 F1">˜ñ</span> <span data-cp="781C" data-bytes="98 F3">˜ó</span> <span data-cp="781E" data-bytes="94 C1">”Á</span> <span data-cp="7839" data-bytes="98 F5">˜õ</span> <span data-cp="783D" data-bytes="96 E2">–â</span> <span data-cp="7842" data-bytes="94 50">”P</span> <span data-cp="7844" data-bytes="96 A2">–¢</span> <span data-cp="7847" data-bytes="98 F6">˜ö</span> <span data-cp="784B" data-bytes="96 E5">–å</span> <span data-cp="7851" data-bytes="98 F7">˜÷</span> <span data-cp="7853" data-bytes="A0 46"> F</span> <span data-cp="7854" data-bytes="96 E3">–ã</span> <span data-cp="7866" data-bytes="98 F8">˜ø</span> <span data-cp="787A" data-bytes="9E E4">žä</span> <span data-cp="7888" data-bytes="94 C3">”Ã</span> <span data-cp="788D" data-bytes="94 C2">”Â</span> <span data-cp="78B6" data-bytes="96 E4">–ä</span> <span data-cp="78B8" data-bytes="89 AC">‰¬</span> <span data-cp="78B9" data-bytes="96 DB">–Û</span> <span data-cp="78D2" data-bytes="94 C4">”Ä</span> <span data-cp="78D8" data-bytes="9F FB">Ÿû</span> <span data-cp="78E4" data-bytes="8C 59">ŒY</span> <span data-cp="78EE" data-bytes="93 C9">“É</span> <span data-cp="78F0" data-bytes="94 E8">”è</span> <span data-cp="78F5" data-bytes="90 C5">Å</span> <span data-cp="7906" data-bytes="A0 A8"> ¨</span> <span data-cp="7932" data-bytes="98 FD">˜ý</span> <span data-cp="7933" data-bytes="98 FB">˜û</span> <span data-cp="7936" data-bytes="8E BF">Ž¿</span> <span data-cp="793B" data-bytes="8B D8">‹Ø</span> <span data-cp="7958" data-bytes="8F 68">h</span> <span data-cp="7959" data-bytes="94 C6">”Æ</span> <span data-cp="7962" data-bytes="9D EA">ê</span> <span data-cp="797E" data-bytes="9C DA">œÚ</span> <span data-cp="7983" data-bytes="9C 72">œr</span> <span data-cp="7987" data-bytes="89 C9">‰É</span> <span data-cp="7991" data-bytes="99 41">™A</span> <span data-cp="7999" data-bytes="99 42">™B</span> <span data-cp="799B" data-bytes="94 CA">”Ê</span> <span data-cp="799F" data-bytes="91 D7">‘×</span> <span data-cp="79A5" data-bytes="94 CC">”Ì</span> <span data-cp="79C4" data-bytes="97 A8">—¨</span> <span data-cp="79CA" data-bytes="8C DE">ŒÞ</span> <span data-cp="79D0" data-bytes="87 B3">‡³</span> <span data-cp="79E2" data-bytes="96 D1">–Ñ</span> <span data-cp="79E3" data-bytes="9C BD">œ½</span> <span data-cp="79F1" data-bytes="94 D5">”Õ</span> <span data-cp="79F4" data-bytes="94 D0">”Ð</span> <span data-cp="7A06" data-bytes="99 44">™D</span> <span data-cp="7A2A" data-bytes="8C 63">Œc</span> <span data-cp="7A2C" data-bytes="87 BB">‡»</span> <span data-cp="7A2D" data-bytes="A0 B3"> ³</span> <span data-cp="7A32" data-bytes="87 B4">‡´</span> <span data-cp="7A3A" data-bytes="94 CF">”Ï</span> <span data-cp="7A3E" data-bytes="9F FA">Ÿú</span> <span data-cp="7A43" data-bytes="91 E5">‘å</span> <span data-cp="7A45" data-bytes="9C 6A">œj</span> <span data-cp="7A49" data-bytes="8E 49">ŽI</span> <span data-cp="7A65" data-bytes="8E 4C">ŽL</span> <span data-cp="7A72" data-bytes="87 C9">‡É</span> <span data-cp="7A7D" data-bytes="8E 4D">ŽM</span> <span data-cp="7A83" data-bytes="9A 73">šs</span> <span data-cp="7A91" data-bytes="99 47">™G</span> <span data-cp="7A93" data-bytes="8C B1">Œ±</span> <span data-cp="7AB0" data-bytes="8E 50">ŽP</span> <span data-cp="7ABB" data-bytes="8E 4F">ŽO</span> <span data-cp="7ABC" data-bytes="99 49">™I</span> <span data-cp="7AC2" data-bytes="8E 51">ŽQ</span> <span data-cp="7AC3" data-bytes="8E 52">ŽR</span> <span data-cp="7AC8" data-bytes="9A B2">š²</span> <span data-cp="7AC9" data-bytes="89 A5">‰¥</span> <span data-cp="7ACF" data-bytes="99 4C">™L</span> <span data-cp="7AD3" data-bytes="9F F8">Ÿø</span> <span data-cp="7ADA" data-bytes="8E 56">ŽV</span> <span data-cp="7ADB" data-bytes="99 4D">™M</span> <span data-cp="7ADC" data-bytes="91 CA">‘Ê</span> <span data-cp="7ADD" data-bytes="8E 57">ŽW</span> <span data-cp="7AE2" data-bytes="94 E1">”á</span> <span data-cp="7AE7" data-bytes="90 47">G</span> <span data-cp="7AE9" data-bytes="8F D8">Ø</span> <span data-cp="7AEA" data-bytes="8E 58">ŽX</span> <span data-cp="7AFC" data-bytes="87 A3">‡£</span> <span data-cp="7AFE" data-bytes="94 EB">”ë</span> <span data-cp="7B0B" data-bytes="8E 5C">Ž\</span> <span data-cp="7B0C" data-bytes="95 53">•S</span> <span data-cp="7B14" data-bytes="9F E5">Ÿå</span> <span data-cp="7B1F" data-bytes="9F 56">ŸV</span> <span data-cp="7B27" data-bytes="95 4F">•O</span> <span data-cp="7B29" data-bytes="8E 5E">Ž^</span> <span data-cp="7B39" data-bytes="99 6A">™j</span> <span data-cp="7B42" data-bytes="9C 64">œd</span> <span data-cp="7B43" data-bytes="9C D9">œÙ</span> <span data-cp="7B51" data-bytes="9D 5A">Z</span> <span data-cp="7B55" data-bytes="8E 5D">Ž]</span> <span data-cp="7B62" data-bytes="99 50">™P</span> <span data-cp="7B6C" data-bytes="99 51">™Q</span> <span data-cp="7B6F" data-bytes="8E 62">Žb</span> <span data-cp="7B7B" data-bytes="99 52">™R</span> <span data-cp="7B92" data-bytes="8E 68">Žh</span> <span data-cp="7BA2" data-bytes="8E 61">Ža</span> <span data-cp="7BA3" data-bytes="9F 59">ŸY</span> <span data-cp="7BAE" data-bytes="87 D0">‡Ð</span> <span data-cp="7BB2" data-bytes="8B B3">‹³</span> <span data-cp="7BB8" data-bytes="8E 69">Ži</span> <span data-cp="7BC5" data-bytes="87 B9">‡¹</span> <span data-cp="7BCF" data-bytes="9F 5D">Ÿ]</span> <span data-cp="7BD0" data-bytes="8E 66">Žf</span> <span data-cp="7BEC" data-bytes="8C B2">Œ²</span> <span data-cp="7BFA" data-bytes="8E 6E">Žn</span> <span data-cp="7BFC" data-bytes="9F 64">Ÿd</span> <span data-cp="7C06" data-bytes="8E 6F">Žo</span> <span data-cp="7C12" data-bytes="99 53">™S</span> <span data-cp="7C1B" data-bytes="99 54">™T</span> <span data-cp="7C35" data-bytes="8E 70">Žp</span> <span data-cp="7C42" data-bytes="9F 61">Ÿa</span> <span data-cp="7C44" data-bytes="8E 72">Žr</span> <span data-cp="7C51" data-bytes="A0 6B"> k</span> <span data-cp="7C56" data-bytes="9F 40">Ÿ@</span> <span data-cp="7C5D" data-bytes="94 ED">”í</span> <span data-cp="7C6D" data-bytes="94 EE">”î</span> <span data-cp="7C70" data-bytes="9F BD">Ÿ½</span> <span data-cp="7C74" data-bytes="8E 7B">Ž{</span> <span data-cp="7C7B" data-bytes="99 57">™W</span> <span data-cp="7C7C" data-bytes="94 F7">”÷</span> <span data-cp="7C7E" data-bytes="9F 5F">Ÿ_</span> <span data-cp="7C83" data-bytes="8E 73">Žs</span> <span data-cp="7C86" data-bytes="9F 62">Ÿb</span> <span data-cp="7C8E" data-bytes="94 F6">”ö</span> <span data-cp="7C9C" data-bytes="99 58">™X</span> <span data-cp="7CA6" data-bytes="8E 75">Žu</span> <span data-cp="7CAC" data-bytes="90 72">r</span> <span data-cp="7CAE" data-bytes="94 F8">”ø</span> <span data-cp="7CB8" data-bytes="99 5A">™Z</span> <span data-cp="7CC2" data-bytes="A0 B0"> °</span> <span data-cp="7CC3" data-bytes="8C B3">Œ³</span> <span data-cp="7CC7" data-bytes="8E 79">Žy</span> <span data-cp="7CC9" data-bytes="8E 78">Žx</span> <span data-cp="7CCD" data-bytes="94 F3">”ó</span> <span data-cp="7CCE" data-bytes="8E 7E">Ž~</span> <span data-cp="7CD3" data-bytes="98 AF">˜¯</span> <span data-cp="7CDA" data-bytes="A0 B2"> ²</span> <span data-cp="7CE6" data-bytes="8E 7A">Žz</span> <span data-cp="7CED" data-bytes="99 5C">™\</span> <span data-cp="7CF3" data-bytes="8E 7C">Ž|</span> <span data-cp="7CF5" data-bytes="8E 7D">Ž}</span> <span data-cp="7CF9" data-bytes="8B D9">‹Ù</span> <span data-cp="7CFC" data-bytes="89 A2">‰¢</span> <span data-cp="7D25" data-bytes="9E D7">ž×</span> <span data-cp="7D4D" data-bytes="A0 B6"> ¶</span> <span data-cp="7D5A" data-bytes="9E 42">žB</span> <span data-cp="7D5D" data-bytes="8E A4">Ž¤</span> <span data-cp="7D89" data-bytes="8E A7">Ž§</span> <span data-cp="7D8B" data-bytes="8C 76">Œv</span> <span data-cp="7D95" data-bytes="87 67">‡g</span> <span data-cp="7D97" data-bytes="95 42">•B</span> <span data-cp="7DA4" data-bytes="98 7D">˜}</span> <span data-cp="7DA8" data-bytes="97 55">—U</span> <span data-cp="7DAB" data-bytes="8E A8">Ž¨</span> <span data-cp="7DB3" data-bytes="8E AA">Žª</span> <span data-cp="7DCD" data-bytes="89 A3">‰£</span> <span data-cp="7DCF" data-bytes="99 60">™`</span> <span data-cp="7DD0" data-bytes="99 62">™b</span> <span data-cp="7DD2" data-bytes="8E AB">Ž«</span> <span data-cp="7DD3" data-bytes="94 FC">”ü</span> <span data-cp="7DD4" data-bytes="99 61">™a</span> <span data-cp="7DDC" data-bytes="94 FA">”ú</span> <span data-cp="7DE4" data-bytes="8E AE">Ž®</span> <span data-cp="7DE5" data-bytes="8E B2">Ž²</span> <span data-cp="7DF5" data-bytes="8E B0">Ž°</span> <span data-cp="7DFD" data-bytes="99 63">™c</span> <span data-cp="7DFE" data-bytes="97 AA">—ª</span> <span data-cp="7E07" data-bytes="94 FB">”û</span> <span data-cp="7E1D" data-bytes="8E B4">Ž´</span> <span data-cp="7E27" data-bytes="8E BB">Ž»</span> <span data-cp="7E5B" data-bytes="8C DC">ŒÜ</span> <span data-cp="7E65" data-bytes="98 76">˜v</span> <span data-cp="7E67" data-bytes="8E A1">Ž¡</span> <span data-cp="7E6C" data-bytes="8C B4">Œ´</span> <span data-cp="7E6E" data-bytes="8E B7">Ž·</span> <span data-cp="7E7F" data-bytes="9D A6">¦</span> <span data-cp="7E87" data-bytes="9B 7B">›{</span> <span data-cp="7E8E" data-bytes="9E B0">ž°</span> <span data-cp="7E92" data-bytes="8E B8">Ž¸</span> <span data-cp="7E9F" data-bytes="9D 70">p</span> <span data-cp="7EA4" data-bytes="89 6E">‰n</span> <span data-cp="7EAC" data-bytes="89 6F">‰o</span> <span data-cp="7EBA" data-bytes="89 70">‰p</span> <span data-cp="7EC7" data-bytes="89 71">‰q</span> <span data-cp="7ECF" data-bytes="89 72">‰r</span> <span data-cp="7EDF" data-bytes="89 73">‰s</span> <span data-cp="7F06" data-bytes="89 74">‰t</span> <span data-cp="7F37" data-bytes="89 75">‰u</span> <span data-cp="7F40" data-bytes="8E BC">Ž¼</span> <span data-cp="7F41" data-bytes="8E BD">Ž½</span> <span data-cp="7F47" data-bytes="8E BE">Ž¾</span> <span data-cp="7F49" data-bytes="9D D1">Ñ</span> <span data-cp="7F4E" data-bytes="94 FD">”ý</span> <span data-cp="7F52" data-bytes="8B D7">‹×</span> <span data-cp="7F53" data-bytes="8B DA">‹Ú</span> <span data-cp="7F71" data-bytes="A0 E2"> â</span> <span data-cp="7F78" data-bytes="9F E9">Ÿé</span> <span data-cp="7F93" data-bytes="8A E7">Šç</span> <span data-cp="7F97" data-bytes="8E C2">ŽÂ</span> <span data-cp="7FA3" data-bytes="8E C4">ŽÄ</span> <span data-cp="7FAE" data-bytes="99 64">™d</span> <span data-cp="7FB4" data-bytes="99 65">™e</span> <span data-cp="7FDD" data-bytes="95 4E">•N</span> <span data-cp="7FE7" data-bytes="98 B3">˜³</span> <span data-cp="7FFA" data-bytes="8E CB">ŽË</span> <span data-cp="8002" data-bytes="8B DF">‹ß</span> <span data-cp="8005" data-bytes="8E CD">ŽÍ</span> <span data-cp="8008" data-bytes="8E CE">ŽÎ</span> <span data-cp="801D" data-bytes="8E CF">ŽÏ</span> <span data-cp="8020" data-bytes="99 68">™h</span> <span data-cp="8025" data-bytes="99 69">™i</span> <span data-cp="8028" data-bytes="8E D0">ŽÐ</span> <span data-cp="802E" data-bytes="99 6B">™k</span> <span data-cp="802F" data-bytes="8E D1">ŽÑ</span> <span data-cp="8031" data-bytes="99 6C">™l</span> <span data-cp="803B" data-bytes="8E D4">ŽÔ</span> <span data-cp="803C" data-bytes="8E D5">ŽÕ</span> <span data-cp="8054" data-bytes="99 6D">™m</span> <span data-cp="805B" data-bytes="A0 BE"> ¾</span> <span data-cp="8061" data-bytes="8E D6">ŽÖ</span> <span data-cp="8062" data-bytes="A0 BC"> ¼</span> <span data-cp="8063" data-bytes="A0 B5"> µ</span> <span data-cp="8066" data-bytes="A0 B4"> ´</span> <span data-cp="8080" data-bytes="8B E0">‹à</span> <span data-cp="809F" data-bytes="89 B5">‰µ</span> <span data-cp="80A7" data-bytes="8E DD">ŽÝ</span> <span data-cp="80B6" data-bytes="9E 5D">ž]</span> <span data-cp="80B7" data-bytes="99 71">™q</span> <span data-cp="80BC" data-bytes="89 AE">‰®</span> <span data-cp="80BD" data-bytes="9D E8">è</span> <span data-cp="80C6" data-bytes="95 65">•e</span> <span data-cp="80E9" data-bytes="99 72">™r</span> <span data-cp="80EC" data-bytes="8B 5C">‹\</span> <span data-cp="80F6" data-bytes="89 B1">‰±</span> <span data-cp="8103" data-bytes="A0 C0"> À</span> <span data-cp="8107" data-bytes="8E DF">Žß</span> <span data-cp="8109" data-bytes="95 66">•f</span> <span data-cp="810C" data-bytes="99 74">™t</span> <span data-cp="810E" data-bytes="99 76">™v</span> <span data-cp="8112" data-bytes="99 77">™w</span> <span data-cp="8114" data-bytes="99 79">™y</span> <span data-cp="8117" data-bytes="9D DA">Ú</span> <span data-cp="811A" data-bytes="8E E0">Žà</span> <span data-cp="812A" data-bytes="93 5C">“\</span> <span data-cp="8132" data-bytes="9D E6">æ</span> <span data-cp="8134" data-bytes="8B 5F">‹_</span> <span data-cp="8137" data-bytes="95 63">•c</span> <span data-cp="8142" data-bytes="95 67">•g</span> <span data-cp="8148" data-bytes="9D E3">ã</span> <span data-cp="8156" data-bytes="99 7C">™|</span> <span data-cp="8159" data-bytes="99 7D">™}</span> <span data-cp="815A" data-bytes="99 7E">™~</span> <span data-cp="816C" data-bytes="8C FB">Œû</span> <span data-cp="816D" data-bytes="8B 5B">‹[</span> <span data-cp="817C" data-bytes="99 A3">™£</span> <span data-cp="8184" data-bytes="99 A4">™¤</span> <span data-cp="8193" data-bytes="99 A6">™¦</span> <span data-cp="81A5" data-bytes="99 A8">™¨</span> <span data-cp="81AA" data-bytes="8A BE">Š¾</span> <span data-cp="81B6" data-bytes="9E 61">ža</span> <span data-cp="81C1" data-bytes="99 AA">™ª</span> <span data-cp="81C8" data-bytes="A0 C8"> È</span> <span data-cp="81E4" data-bytes="99 AB">™«</span> <span data-cp="81F6" data-bytes="98 C2">˜Â</span> <span data-cp="8218" data-bytes="8E E8">Žè</span> <span data-cp="821A" data-bytes="A0 BA"> º</span> <span data-cp="8229" data-bytes="8E EE">Žî</span> <span data-cp="822D" data-bytes="9E BF">ž¿</span> <span data-cp="823E" data-bytes="89 C2">‰Â</span> <span data-cp="8254" data-bytes="99 AC">™¬</span> <span data-cp="8262" data-bytes="95 6B">•k</span> <span data-cp="8265" data-bytes="95 6C">•l</span> <span data-cp="8276" data-bytes="99 AF">™¯</span> <span data-cp="8279" data-bytes="99 4A">™J</span> <span data-cp="827A" data-bytes="89 76">‰v</span> <span data-cp="827B" data-bytes="8F 48">H</span> <span data-cp="82A6" data-bytes="99 AE">™®</span> <span data-cp="82AA" data-bytes="8E FB">Žû</span> <span data-cp="82BF" data-bytes="8C D0">ŒÐ</span> <span data-cp="82C4" data-bytes="8B 52">‹R</span> <span data-cp="82CA" data-bytes="99 B0">™°</span> <span data-cp="82CF" data-bytes="89 77">‰w</span> <span data-cp="82D0" data-bytes="8F 41">A</span> <span data-cp="82D8" data-bytes="99 B1">™±</span> <span data-cp="82E2" data-bytes="8F 49">I</span> <span data-cp="82F7" data-bytes="9D E4">ä</span> <span data-cp="82F8" data-bytes="8C B5">Œµ</span> <span data-cp="82FD" data-bytes="9B 54">›T</span> <span data-cp="82FF" data-bytes="99 B2">™²</span> <span data-cp="830B" data-bytes="9E 68">žh</span> <span data-cp="8318" data-bytes="8F 4A">J</span> <span data-cp="831A" data-bytes="8F 42">B</span> <span data-cp="831D" data-bytes="8F 51">Q</span> <span data-cp="833D" data-bytes="98 46">˜F</span> <span data-cp="8357" data-bytes="99 B4">™´</span> <span data-cp="8362" data-bytes="8E F5">Žõ</span> <span data-cp="8366" data-bytes="9C CD">œÍ</span> <span data-cp="836F" data-bytes="89 78">‰x</span> <span data-cp="8385" data-bytes="8F 53">S</span> <span data-cp="8391" data-bytes="8F 6F">o</span> <span data-cp="839C" data-bytes="8E 63">Žc</span> <span data-cp="83AC" data-bytes="8F 56">V</span> <span data-cp="83BE" data-bytes="9F C6">ŸÆ</span> <span data-cp="83C1" data-bytes="8F 57">W</span> <span data-cp="83CF" data-bytes="9C 77">œw</span> <span data-cp="83D3" data-bytes="8F 58">X</span> <span data-cp="83ED" data-bytes="98 48">˜H</span> <span data-cp="8405" data-bytes="99 B7">™·</span> <span data-cp="840F" data-bytes="8F 6E">n</span> <span data-cp="8414" data-bytes="96 65">–e</span> <span data-cp="8418" data-bytes="9D E7">ç</span> <span data-cp="841C" data-bytes="9E 62">žb</span> <span data-cp="8420" data-bytes="96 CC">–Ì</span> <span data-cp="8421" data-bytes="8E 67">Žg</span> <span data-cp="8426" data-bytes="98 7E">˜~</span> <span data-cp="843E" data-bytes="97 FC">—ü</span> <span data-cp="8448" data-bytes="98 F9">˜ù</span> <span data-cp="844A" data-bytes="8F 66">f</span> <span data-cp="8453" data-bytes="95 6E">•n</span> <span data-cp="8455" data-bytes="92 45">’E</span> <span data-cp="8458" data-bytes="8F 60">`</span> <span data-cp="845C" data-bytes="9E D1">žÑ</span> <span data-cp="8464" data-bytes="99 B9">™¹</span> <span data-cp="8471" data-bytes="8F 62">b</span> <span data-cp="8472" data-bytes="97 4C">—L</span> <span data-cp="847F" data-bytes="91 C7">‘Ç</span> <span data-cp="8480" data-bytes="95 5F">•_</span> <span data-cp="8484" data-bytes="87 AB">‡«</span> <span data-cp="8488" data-bytes="99 BB">™»</span> <span data-cp="8492" data-bytes="8E 6D">Žm</span> <span data-cp="8493" data-bytes="8F 71">q</span> <span data-cp="8496" data-bytes="94 CB">”Ë</span> <span data-cp="84A3" data-bytes="95 B1">•±</span> <span data-cp="84A8" data-bytes="8F 69">i</span> <span data-cp="84AD" data-bytes="9A F2">šò</span> <span data-cp="84BD" data-bytes="96 C3">–Ã</span> <span data-cp="84BE" data-bytes="99 BD">™½</span> <span data-cp="84DA" data-bytes="A0 CF"> Ï</span> <span data-cp="84DE" data-bytes="8F 6D">m</span> <span data-cp="84E1" data-bytes="99 BE">™¾</span> <span data-cp="84E2" data-bytes="8E F4">Žô</span> <span data-cp="84E4" data-bytes="8F 72">r</span> <span data-cp="84E5" data-bytes="95 E4">•ä</span> <span data-cp="84F8" data-bytes="99 BF">™¿</span> <span data-cp="8503" data-bytes="92 42">’B</span> <span data-cp="8504" data-bytes="87 D7">‡×</span> <span data-cp="8510" data-bytes="99 C0">™À</span> <span data-cp="8534" data-bytes="8F 77">w</span> <span data-cp="8538" data-bytes="99 C1">™Á</span> <span data-cp="854B" data-bytes="8F 40">@</span> <span data-cp="8552" data-bytes="99 C2">™Â</span> <span data-cp="855A" data-bytes="8F 5C">\</span> <span data-cp="855F" data-bytes="8C BD">Œ½</span> <span data-cp="856F" data-bytes="99 C4">™Ä</span> <span data-cp="8570" data-bytes="99 C5">™Å</span> <span data-cp="8573" data-bytes="8F 7B">{</span> <span data-cp="8593" data-bytes="87 76">‡v</span> <span data-cp="8597" data-bytes="8C B6">Œ¶</span> <span data-cp="85C1" data-bytes="8F A3">£</span> <span data-cp="85D6" data-bytes="8C CE">ŒÎ</span> <span data-cp="85E0" data-bytes="99 C6">™Æ</span> <span data-cp="85EE" data-bytes="96 CD">–Í</span> <span data-cp="85FC" data-bytes="96 C7">–Ç</span> <span data-cp="8602" data-bytes="8F A5">¥</span> <span data-cp="860F" data-bytes="8C 61">Œa</span> <span data-cp="8610" data-bytes="95 70">•p</span> <span data-cp="8613" data-bytes="87 AF">‡¯</span> <span data-cp="8614" data-bytes="93 68">“h</span> <span data-cp="8616" data-bytes="8F 7E">~</span> <span data-cp="8628" data-bytes="8F AA">ª</span> <span data-cp="862F" data-bytes="A0 50"> P</span> <span data-cp="8642" data-bytes="90 D3">Ó</span> <span data-cp="8645" data-bytes="95 56">•V</span> <span data-cp="866C" data-bytes="8F B8">¸</span> <span data-cp="8672" data-bytes="99 C8">™È</span> <span data-cp="867E" data-bytes="8F AF">¯</span> <span data-cp="8692" data-bytes="99 C9">™É</span> <span data-cp="86A0" data-bytes="95 79">•y</span> <span data-cp="86AD" data-bytes="9F 49">ŸI</span> <span data-cp="86B2" data-bytes="99 CA">™Ê</span> <span data-cp="86EF" data-bytes="99 CB">™Ë</span> <span data-cp="8770" data-bytes="9D D5">Õ</span> <span data-cp="8771" data-bytes="8F B0">°</span> <span data-cp="8786" data-bytes="9E 5F">ž_</span> <span data-cp="878B" data-bytes="99 CD">™Í</span> <span data-cp="878C" data-bytes="A0 C9"> É</span> <span data-cp="87A5" data-bytes="9A DB">šÛ</span> <span data-cp="87A9" data-bytes="A0 C6"> Æ</span> <span data-cp="87B1" data-bytes="8F B4">´</span> <span data-cp="87C1" data-bytes="A0 D7"> ×</span> <span data-cp="87CE" data-bytes="A0 C7"> Ç</span> <span data-cp="87D6" data-bytes="A0 43"> C</span> <span data-cp="87DA" data-bytes="8F B5">µ</span> <span data-cp="87EE" data-bytes="8F B2">²</span> <span data-cp="87F5" data-bytes="A0 61"> a</span> <span data-cp="8804" data-bytes="9E 5E">ž^</span> <span data-cp="880F" data-bytes="8F B6">¶</span> <span data-cp="8818" data-bytes="9F E8">Ÿè</span> <span data-cp="8827" data-bytes="9C B2">œ²</span> <span data-cp="882D" data-bytes="95 7C">•|</span> <span data-cp="8842" data-bytes="9F C7">ŸÇ</span> <span data-cp="8845" data-bytes="8F BB">»</span> <span data-cp="8846" data-bytes="8F BC">¼</span> <span data-cp="884F" data-bytes="8F EC">ì</span> <span data-cp="885E" data-bytes="8F C0">À</span> <span data-cp="8860" data-bytes="93 6A">“j</span> <span data-cp="8864" data-bytes="8B E4">‹ä</span> <span data-cp="8865" data-bytes="9C 7C">œ|</span> <span data-cp="886E" data-bytes="95 A1">•¡</span> <span data-cp="8887" data-bytes="95 A3">•£</span> <span data-cp="888F" data-bytes="8C 45">ŒE</span> <span data-cp="8890" data-bytes="8C B8">Œ¸</span> <span data-cp="889C" data-bytes="8F C1">Á</span> <span data-cp="889D" data-bytes="87 B7">‡·</span> <span data-cp="88A0" data-bytes="A0 52"> R</span> <span data-cp="88AE" data-bytes="99 D0">™Ð</span> <span data-cp="88B4" data-bytes="8F C3">Ã</span> <span data-cp="88B5" data-bytes="8F C4">Ä</span> <span data-cp="88BF" data-bytes="95 A4">•¤</span> <span data-cp="88C5" data-bytes="8F C6">Æ</span> <span data-cp="88C7" data-bytes="9E 60">ž`</span> <span data-cp="88E6" data-bytes="95 A5">•¥</span> <span data-cp="88F5" data-bytes="9C B3">œ³</span> <span data-cp="88FF" data-bytes="99 D1">™Ñ</span> <span data-cp="8924" data-bytes="99 D2">™Ò</span> <span data-cp="8943" data-bytes="9C C2">œÂ</span> <span data-cp="8947" data-bytes="99 D3">™Ó</span> <span data-cp="894D" data-bytes="95 A7">•§</span> <span data-cp="8954" data-bytes="95 A9">•©</span> <span data-cp="8965" data-bytes="95 A6">•¦</span> <span data-cp="8977" data-bytes="9C 5D">œ]</span> <span data-cp="8980" data-bytes="98 E2">˜â</span> <span data-cp="8987" data-bytes="8F C9">É</span> <span data-cp="8989" data-bytes="A0 C2"> Â</span> <span data-cp="898A" data-bytes="8F CA">Ê</span> <span data-cp="8991" data-bytes="99 D4">™Ô</span> <span data-cp="8994" data-bytes="A0 B9"> ¹</span> <span data-cp="89A5" data-bytes="9B 58">›X</span> <span data-cp="89A6" data-bytes="8F CB">Ë</span> <span data-cp="89A7" data-bytes="8F CD">Í</span> <span data-cp="89A9" data-bytes="8F CC">Ì</span> <span data-cp="89BC" data-bytes="8F CE">Î</span> <span data-cp="89C1" data-bytes="8B E5">‹å</span> <span data-cp="89C6" data-bytes="89 79">‰y</span> <span data-cp="89E7" data-bytes="8F D0">Ð</span> <span data-cp="8A1C" data-bytes="95 B6">•¶</span> <span data-cp="8A29" data-bytes="99 D6">™Ö</span> <span data-cp="8A2B" data-bytes="95 E5">•å</span> <span data-cp="8A38" data-bytes="99 D7">™×</span> <span data-cp="8A3D" data-bytes="95 B5">•µ</span> <span data-cp="8A49" data-bytes="A0 CA"> Ê</span> <span data-cp="8A67" data-bytes="9F FD">Ÿý</span> <span data-cp="8A7E" data-bytes="A0 58"> X</span> <span data-cp="8A90" data-bytes="8F D6">Ö</span> <span data-cp="8A94" data-bytes="99 D8">™Ø</span> <span data-cp="8A9C" data-bytes="8F D3">Ó</span> <span data-cp="8AA9" data-bytes="8F E5">å</span> <span data-cp="8AAF" data-bytes="8F E9">é</span> <span data-cp="8AB4" data-bytes="99 D9">™Ù</span> <span data-cp="8ACC" data-bytes="8C F7">Œ÷</span> <span data-cp="8ADA" data-bytes="92 7C">’|</span> <span data-cp="8AEA" data-bytes="9C 45">œE</span> <span data-cp="8AF9" data-bytes="8C E8">Œè</span> <span data-cp="8B0C" data-bytes="8F DE">Þ</span> <span data-cp="8B1F" data-bytes="8F DF">ß</span> <span data-cp="8B2D" data-bytes="A0 4B"> K</span> <span data-cp="8B3F" data-bytes="8F E2">â</span> <span data-cp="8B43" data-bytes="A0 CC"> Ì</span> <span data-cp="8B4C" data-bytes="8F E3">ã</span> <span data-cp="8B4D" data-bytes="8F E4">ä</span> <span data-cp="8B5E" data-bytes="9B C4">›Ä</span> <span data-cp="8B62" data-bytes="9B FC">›ü</span> <span data-cp="8B69" data-bytes="96 4C">–L</span> <span data-cp="8B81" data-bytes="9A F6">šö</span> <span data-cp="8B83" data-bytes="8C AE">Œ®</span> <span data-cp="8B8F" data-bytes="87 CB">‡Ë</span> <span data-cp="8B90" data-bytes="8F E7">ç</span> <span data-cp="8B9B" data-bytes="8F E8">è</span> <span data-cp="8BA0" data-bytes="8B E7">‹ç</span> <span data-cp="8BBE" data-bytes="89 7A">‰z</span> <span data-cp="8BE2" data-bytes="89 7B">‰{</span> <span data-cp="8C51" data-bytes="99 DA">™Ú</span> <span data-cp="8C9B" data-bytes="8F ED">í</span> <span data-cp="8C9F" data-bytes="95 C0">•À</span> <span data-cp="8CAD" data-bytes="A0 CB"> Ë</span> <span data-cp="8CCD" data-bytes="9E 48">žH</span> <span data-cp="8CD4" data-bytes="99 DB">™Û</span> <span data-cp="8CD6" data-bytes="8F F3">ó</span> <span data-cp="8CDB" data-bytes="8F F9">ù</span> <span data-cp="8CE9" data-bytes="95 C1">•Á</span> <span data-cp="8CEB" data-bytes="A0 4E"> N</span> <span data-cp="8CF2" data-bytes="99 DC">™Ü</span> <span data-cp="8CF7" data-bytes="A0 64"> d</span> <span data-cp="8D03" data-bytes="8F F7">÷</span> <span data-cp="8D0B" data-bytes="89 B0">‰°</span> <span data-cp="8D0C" data-bytes="A0 48"> H</span> <span data-cp="8D11" data-bytes="8F FB">û</span> <span data-cp="8D12" data-bytes="8F F6">ö</span> <span data-cp="8D18" data-bytes="9D DC">Ü</span> <span data-cp="8D1C" data-bytes="99 DD">™Ý</span> <span data-cp="8D1D" data-bytes="8B E8">‹è</span> <span data-cp="8D77" data-bytes="8F FE">þ</span> <span data-cp="8D7A" data-bytes="92 C1">’Á</span> <span data-cp="8D82" data-bytes="9F D6">ŸÖ</span> <span data-cp="8DA6" data-bytes="A0 D2"> Ò</span> <span data-cp="8DA9" data-bytes="90 40">@</span> <span data-cp="8DC0" data-bytes="8A C4">ŠÄ</span> <span data-cp="8DC3" data-bytes="99 E0">™à</span> <span data-cp="8DD4" data-bytes="9F F0">Ÿð</span> <span data-cp="8E01" data-bytes="9F F3">Ÿó</span> <span data-cp="8E0E" data-bytes="9D BF">¿</span> <span data-cp="8E28" data-bytes="9F F6">Ÿö</span> <span data-cp="8E2A" data-bytes="95 C8">•È</span> <span data-cp="8E2D" data-bytes="9E 5A">žZ</span> <span data-cp="8E3A" data-bytes="99 E3">™ã</span> <span data-cp="8E46" data-bytes="8A 4A">ŠJ</span> <span data-cp="8E4F" data-bytes="9F F1">Ÿñ</span> <span data-cp="8E68" data-bytes="8A A7">Š§</span> <span data-cp="8E71" data-bytes="99 E6">™æ</span> <span data-cp="8E75" data-bytes="9F F7">Ÿ÷</span> <span data-cp="8E77" data-bytes="9F ED">Ÿí</span> <span data-cp="8E7E" data-bytes="8A 5C">Š\</span> <span data-cp="8E80" data-bytes="9D AE">®</span> <span data-cp="8EA7" data-bytes="95 C9">•É</span> <span data-cp="8EAD" data-bytes="90 48">H</span> <span data-cp="8EB0" data-bytes="99 E8">™è</span> <span data-cp="8EB6" data-bytes="90 49">I</span> <span data-cp="8EB9" data-bytes="8C BA">Œº</span> <span data-cp="8EBC" data-bytes="90 B1">±</span> <span data-cp="8EC3" data-bytes="90 4A">J</span> <span data-cp="8ECE" data-bytes="99 EA">™ê</span> <span data-cp="8EDA" data-bytes="9B D1">›Ñ</span> <span data-cp="8EE2" data-bytes="99 EB">™ë</span> <span data-cp="8EE4" data-bytes="99 EC">™ì</span> <span data-cp="8EED" data-bytes="99 ED">™í</span> <span data-cp="8EF2" data-bytes="99 EE">™î</span> <span data-cp="8F0B" data-bytes="9D 57">W</span> <span data-cp="8F19" data-bytes="90 4C">L</span> <span data-cp="8F2D" data-bytes="90 4D">M</span> <span data-cp="8F30" data-bytes="95 CB">•Ë</span> <span data-cp="8F36" data-bytes="9C 42">œB</span> <span data-cp="8F41" data-bytes="97 E2">—â</span> <span data-cp="8F4A" data-bytes="95 CC">•Ì</span> <span data-cp="8F5C" data-bytes="9F 78">Ÿx</span> <span data-cp="8F66" data-bytes="89 7C">‰|</span> <span data-cp="8F67" data-bytes="89 7D">‰}</span> <span data-cp="8F6E" data-bytes="89 7E">‰~</span> <span data-cp="8F93" data-bytes="99 5D">™]</span> <span data-cp="8FA0" data-bytes="9B 5A">›Z</span> <span data-cp="8FA5" data-bytes="90 50">P</span> <span data-cp="8FA7" data-bytes="8C 4F">ŒO</span> <span data-cp="8FB3" data-bytes="90 54">T</span> <span data-cp="8FB6" data-bytes="9A A8">š¨</span> <span data-cp="8FB7" data-bytes="99 EF">™ï</span> <span data-cp="8FB9" data-bytes="9D A3">£</span> <span data-cp="8FBA" data-bytes="9D A1">¡</span> <span data-cp="8FBB" data-bytes="99 43">™C</span> <span data-cp="8FBC" data-bytes="99 45">™E</span> <span data-cp="8FBE" data-bytes="9D 7D">}</span> <span data-cp="8FC1" data-bytes="99 F0">™ð</span> <span data-cp="8FCA" data-bytes="99 F1">™ñ</span> <span data-cp="8FCC" data-bytes="99 F2">™ò</span> <span data-cp="8FCF" data-bytes="8C BC">Œ¼</span> <span data-cp="8FD0" data-bytes="9D 60">`</span> <span data-cp="8FDA" data-bytes="A0 A3"> £</span> <span data-cp="8FF9" data-bytes="90 5B">[</span> <span data-cp="9008" data-bytes="9E DB">žÛ</span> <span data-cp="9012" data-bytes="9D 79">y</span> <span data-cp="9033" data-bytes="99 F3">™ó</span> <span data-cp="9037" data-bytes="90 62">b</span> <span data-cp="9046" data-bytes="87 BD">‡½</span> <span data-cp="904C" data-bytes="9F 55">ŸU</span> <span data-cp="9056" data-bytes="9B F9">›ù</span> <span data-cp="9061" data-bytes="90 65">e</span> <span data-cp="9064" data-bytes="96 E0">–à</span> <span data-cp="906C" data-bytes="98 BE">˜¾</span> <span data-cp="9097" data-bytes="95 D9">•Ù</span> <span data-cp="90A8" data-bytes="90 68">h</span> <span data-cp="90AE" data-bytes="90 6C">l</span> <span data-cp="90BB" data-bytes="95 D8">•Ø</span> <span data-cp="90C4" data-bytes="90 6A">j</span> <span data-cp="90FD" data-bytes="90 6D">m</span> <span data-cp="9104" data-bytes="9C 68">œh</span> <span data-cp="9151" data-bytes="9F B2">Ÿ²</span> <span data-cp="9159" data-bytes="9F AE">Ÿ®</span> <span data-cp="915C" data-bytes="9F B0">Ÿ°</span> <span data-cp="915E" data-bytes="89 AD">‰­</span> <span data-cp="9167" data-bytes="90 6E">n</span> <span data-cp="9170" data-bytes="9E 71">žq</span> <span data-cp="9176" data-bytes="9E 4A">žJ</span> <span data-cp="917C" data-bytes="9F DC">ŸÜ</span> <span data-cp="918C" data-bytes="89 AB">‰«</span> <span data-cp="918E" data-bytes="9F B8">Ÿ¸</span> <span data-cp="91A9" data-bytes="90 70">p</span> <span data-cp="91B6" data-bytes="8B 63">‹c</span> <span data-cp="91BB" data-bytes="95 DC">•Ü</span> <span data-cp="91C4" data-bytes="90 71">q</span> <span data-cp="91D4" data-bytes="9B DE">›Þ</span> <span data-cp="91DF" data-bytes="89 49">‰I</span> <span data-cp="91E5" data-bytes="96 5B">–[</span> <span data-cp="91F6" data-bytes="8C 50">ŒP</span> <span data-cp="91FA" data-bytes="94 A6">”¦</span> <span data-cp="91FE" data-bytes="8F D5">Õ</span> <span data-cp="9208" data-bytes="9E 73">žs</span> <span data-cp="920E" data-bytes="90 75">u</span> <span data-cp="9213" data-bytes="99 F7">™÷</span> <span data-cp="9218" data-bytes="87 B2">‡²</span> <span data-cp="9221" data-bytes="8C BF">Œ¿</span> <span data-cp="9228" data-bytes="99 F9">™ù</span> <span data-cp="922A" data-bytes="96 63">–c</span> <span data-cp="922B" data-bytes="95 B9">•¹</span> <span data-cp="9235" data-bytes="94 D4">”Ô</span> <span data-cp="9241" data-bytes="90 77">w</span> <span data-cp="9244" data-bytes="90 AB">«</span> <span data-cp="9255" data-bytes="9D 4D">M</span> <span data-cp="9258" data-bytes="99 FA">™ú</span> <span data-cp="925D" data-bytes="92 E3">’ã</span> <span data-cp="925F" data-bytes="97 BB">—»</span> <span data-cp="9262" data-bytes="90 78">x</span> <span data-cp="926B" data-bytes="99 FB">™û</span> <span data-cp="926E" data-bytes="97 E0">—à</span> <span data-cp="9277" data-bytes="96 DC">–Ü</span> <span data-cp="9281" data-bytes="9C A8">œ¨</span> <span data-cp="9284" data-bytes="97 72">—r</span> <span data-cp="9289" data-bytes="94 40">”@</span> <span data-cp="928F" data-bytes="92 F2">’ò</span> <span data-cp="92AE" data-bytes="99 FD">™ý</span> <span data-cp="92B1" data-bytes="99 FC">™ü</span> <span data-cp="92B9" data-bytes="90 7A">z</span> <span data-cp="92BA" data-bytes="96 4A">–J</span> <span data-cp="92BE" data-bytes="96 D8">–Ø</span> <span data-cp="92BF" data-bytes="99 FE">™þ</span> <span data-cp="92D4" data-bytes="90 4B">K</span> <span data-cp="92E3" data-bytes="9A 40">š@</span> <span data-cp="92E5" data-bytes="97 5B">—[</span> <span data-cp="92EB" data-bytes="9A 41">šA</span> <span data-cp="92EC" data-bytes="91 DD">‘Ý</span> <span data-cp="92F2" data-bytes="93 FC">“ü</span> <span data-cp="92F3" data-bytes="9A 42">šB</span> <span data-cp="92F4" data-bytes="9A 43">šC</span> <span data-cp="92F6" data-bytes="96 59">–Y</span> <span data-cp="92FD" data-bytes="9A 44">šD</span> <span data-cp="9303" data-bytes="90 51">Q</span> <span data-cp="9307" data-bytes="94 BF">”¿</span> <span data-cp="932C" data-bytes="90 A2">¢</span> <span data-cp="9330" data-bytes="9C AB">œ«</span> <span data-cp="9331" data-bytes="97 76">—v</span> <span data-cp="9342" data-bytes="94 A8">”¨</span> <span data-cp="9343" data-bytes="9A 45">šE</span> <span data-cp="9345" data-bytes="9D E1">á</span> <span data-cp="9348" data-bytes="96 D9">–Ù</span> <span data-cp="935F" data-bytes="97 74">—t</span> <span data-cp="9366" data-bytes="92 E5">’å</span> <span data-cp="9368" data-bytes="96 45">–E</span> <span data-cp="9369" data-bytes="91 DA">‘Ú</span> <span data-cp="936B" data-bytes="90 A3">£</span> <span data-cp="936E" data-bytes="92 C8">’È</span> <span data-cp="9373" data-bytes="90 AF">¯</span> <span data-cp="9374" data-bytes="97 BF">—¿</span> <span data-cp="9378" data-bytes="91 4C">‘L</span> <span data-cp="937D" data-bytes="96 7A">–z</span> <span data-cp="9381" data-bytes="91 DE">‘Þ</span> <span data-cp="9384" data-bytes="9A 46">šF</span> <span data-cp="9386" data-bytes="97 79">—y</span> <span data-cp="9387" data-bytes="94 6C">”l</span> <span data-cp="9390" data-bytes="98 58">˜X</span> <span data-cp="939C" data-bytes="92 66">’f</span> <span data-cp="93A0" data-bytes="93 FB">“û</span> <span data-cp="93AD" data-bytes="9A 47">šG</span> <span data-cp="93B8" data-bytes="97 49">—I</span> <span data-cp="93BB" data-bytes="97 48">—H</span> <span data-cp="93BD" data-bytes="93 4A">“J</span> <span data-cp="93BF" data-bytes="9C E2">œâ</span> <span data-cp="93C6" data-bytes="92 64">’d</span> <span data-cp="93CB" data-bytes="91 DF">‘ß</span> <span data-cp="93DB" data-bytes="96 D7">–×</span> <span data-cp="93E0" data-bytes="93 43">“C</span> <span data-cp="93F3" data-bytes="91 DB">‘Û</span> <span data-cp="93F4" data-bytes="8C 6A">Œj</span> <span data-cp="9401" data-bytes="97 AF">—¯</span> <span data-cp="9404" data-bytes="95 DD">•Ý</span> <span data-cp="9408" data-bytes="93 48">“H</span> <span data-cp="9417" data-bytes="9A 4B">šK</span> <span data-cp="941D" data-bytes="9A 4D">šM</span> <span data-cp="9424" data-bytes="91 BC">‘¼</span> <span data-cp="9425" data-bytes="90 E2">â</span> <span data-cp="9426" data-bytes="90 B4">´</span> <span data-cp="9427" data-bytes="95 E1">•á</span> <span data-cp="942D" data-bytes="9A 4E">šN</span> <span data-cp="942F" data-bytes="87 AD">‡­</span> <span data-cp="943E" data-bytes="9A 4F">šO</span> <span data-cp="944D" data-bytes="96 DD">–Ý</span> <span data-cp="9454" data-bytes="9A 51">šQ</span> <span data-cp="9458" data-bytes="96 A7">–§</span> <span data-cp="945B" data-bytes="90 B0">°</span> <span data-cp="9465" data-bytes="9C 4E">œN</span> <span data-cp="9467" data-bytes="94 43">”C</span> <span data-cp="946C" data-bytes="8E BA">Žº</span> <span data-cp="9479" data-bytes="9A 52">šR</span> <span data-cp="9485" data-bytes="8B E9">‹é</span> <span data-cp="949F" data-bytes="9C AF">œ¯</span> <span data-cp="94A2" data-bytes="8B FD">‹ý</span> <span data-cp="94C1" data-bytes="9A BC">š¼</span> <span data-cp="94C3" data-bytes="9A B8">š¸</span> <span data-cp="94DC" data-bytes="9A AE">š®</span> <span data-cp="94F6" data-bytes="9A A7">š§</span> <span data-cp="952D" data-bytes="9A 53">šS</span> <span data-cp="9547" data-bytes="9D 74">t</span> <span data-cp="9578" data-bytes="8B EA">‹ê</span> <span data-cp="957F" data-bytes="8B EB">‹ë</span> <span data-cp="9585" data-bytes="90 B2">²</span> <span data-cp="9596" data-bytes="95 E9">•é</span> <span data-cp="9597" data-bytes="95 E8">•è</span> <span data-cp="9599" data-bytes="95 E6">•æ</span> <span data-cp="95A0" data-bytes="90 B5">µ</span> <span data-cp="95A2" data-bytes="9A 54">šT</span> <span data-cp="95A6" data-bytes="90 B3">³</span> <span data-cp="95A7" data-bytes="95 E7">•ç</span> <span data-cp="95AA" data-bytes="8B 50">‹P</span> <span data-cp="95E8" data-bytes="8B EC">‹ì</span> <span data-cp="95F4" data-bytes="9A 56">šV</span> <span data-cp="961D" data-bytes="8B FB">‹û</span> <span data-cp="9633" data-bytes="9A 57">šW</span> <span data-cp="9638" data-bytes="A0 AA"> ª</span> <span data-cp="9641" data-bytes="9F A6">Ÿ¦</span> <span data-cp="9645" data-bytes="99 CC">™Ì</span> <span data-cp="9656" data-bytes="9C 59">œY</span> <span data-cp="9669" data-bytes="99 B5">™µ</span> <span data-cp="967B" data-bytes="90 BE">¾</span> <span data-cp="9681" data-bytes="9F AF">Ÿ¯</span> <span data-cp="968F" data-bytes="95 F2">•ò</span> <span data-cp="9696" data-bytes="90 BF">¿</span> <span data-cp="96A3" data-bytes="90 C1">Á</span> <span data-cp="96B6" data-bytes="90 C4">Ä</span> <span data-cp="96BD" data-bytes="90 C7">Ç</span> <span data-cp="96F4" data-bytes="92 E4">’ä</span> <span data-cp="9703" data-bytes="9F 52">ŸR</span> <span data-cp="971B" data-bytes="90 DB">Û</span> <span data-cp="9721" data-bytes="A0 66"> f</span> <span data-cp="9731" data-bytes="90 D2">Ò</span> <span data-cp="9734" data-bytes="87 6B">‡k</span> <span data-cp="9736" data-bytes="90 D4">Ô</span> <span data-cp="9740" data-bytes="9A 5B">š[</span> <span data-cp="9741" data-bytes="95 FD">•ý</span> <span data-cp="974A" data-bytes="87 B1">‡±</span> <span data-cp="9751" data-bytes="8B C4">‹Ä</span> <span data-cp="9755" data-bytes="8C 66">Œf</span> <span data-cp="9757" data-bytes="90 DE">Þ</span> <span data-cp="975C" data-bytes="90 DC">Ü</span> <span data-cp="975D" data-bytes="96 44">–D</span> <span data-cp="975F" data-bytes="90 E1">á</span> <span data-cp="976D" data-bytes="9E 46">žF</span> <span data-cp="9771" data-bytes="96 51">–Q</span> <span data-cp="9789" data-bytes="90 E6">æ</span> <span data-cp="979B" data-bytes="96 50">–P</span> <span data-cp="979F" data-bytes="90 E7">ç</span> <span data-cp="97B1" data-bytes="90 E8">è</span> <span data-cp="97B2" data-bytes="9A 5D">š]</span> <span data-cp="97B4" data-bytes="9F 7A">Ÿz</span> <span data-cp="97B8" data-bytes="9B 5C">›\</span> <span data-cp="97BA" data-bytes="9F 7C">Ÿ|</span> <span data-cp="97BE" data-bytes="90 E9">é</span> <span data-cp="97C0" data-bytes="90 EA">ê</span> <span data-cp="97C2" data-bytes="9A 5E">š^</span> <span data-cp="97C8" data-bytes="9F 76">Ÿv</span> <span data-cp="97D2" data-bytes="90 EB">ë</span> <span data-cp="97E0" data-bytes="90 EC">ì</span> <span data-cp="97E6" data-bytes="8B EE">‹î</span> <span data-cp="97EE" data-bytes="90 EE">î</span> <span data-cp="97F2" data-bytes="91 C6">‘Æ</span> <span data-cp="97F5" data-bytes="90 F2">ò</span> <span data-cp="97FF" data-bytes="90 F1">ñ</span> <span data-cp="9815" data-bytes="8A 74">Št</span> <span data-cp="981F" data-bytes="96 57">–W</span> <span data-cp="9823" data-bytes="9C EF">œï</span> <span data-cp="982E" data-bytes="9F DF">Ÿß</span> <span data-cp="9833" data-bytes="90 F7">÷</span> <span data-cp="9834" data-bytes="90 F6">ö</span> <span data-cp="9847" data-bytes="9B 5E">›^</span> <span data-cp="984B" data-bytes="90 F8">ø</span> <span data-cp="9856" data-bytes="8C FC">Œü</span> <span data-cp="9866" data-bytes="90 F9">ù</span> <span data-cp="9868" data-bytes="8C C9">ŒÉ</span> <span data-cp="9875" data-bytes="8B EF">‹ï</span> <span data-cp="98B4" data-bytes="9F E0">Ÿà</span> <span data-cp="98B7" data-bytes="91 42">‘B</span> <span data-cp="98B9" data-bytes="9A 62">šb</span> <span data-cp="98C3" data-bytes="95 69">•i</span> <span data-cp="98C7" data-bytes="91 44">‘D</span> <span data-cp="98C8" data-bytes="91 43">‘C</span> <span data-cp="98CA" data-bytes="91 41">‘A</span> <span data-cp="98CE" data-bytes="8B F0">‹ð</span> <span data-cp="98DC" data-bytes="96 60">–`</span> <span data-cp="98DE" data-bytes="8B F1">‹ñ</span> <span data-cp="98E0" data-bytes="99 F6">™ö</span> <span data-cp="98E1" data-bytes="91 49">‘I</span> <span data-cp="98E6" data-bytes="91 4A">‘J</span> <span data-cp="98EC" data-bytes="91 4B">‘K</span> <span data-cp="98F1" data-bytes="9A 64">šd</span> <span data-cp="98F5" data-bytes="8A BF">Š¿</span> <span data-cp="990E" data-bytes="9A 66">šf</span> <span data-cp="9919" data-bytes="9A 67">šg</span> <span data-cp="991C" data-bytes="9A 69">ši</span> <span data-cp="9937" data-bytes="9A 6A">šj</span> <span data-cp="9938" data-bytes="96 52">–R</span> <span data-cp="9939" data-bytes="91 4D">‘M</span> <span data-cp="993B" data-bytes="96 66">–f</span> <span data-cp="9940" data-bytes="9F 7B">Ÿ{</span> <span data-cp="9942" data-bytes="9A 6B">šk</span> <span data-cp="994A" data-bytes="A0 6C"> l</span> <span data-cp="994D" data-bytes="96 67">–g</span> <span data-cp="995D" data-bytes="9A 6C">šl</span> <span data-cp="9962" data-bytes="9A 6D">šm</span> <span data-cp="9963" data-bytes="8B F2">‹ò</span> <span data-cp="999B" data-bytes="96 6A">–j</span> <span data-cp="99AA" data-bytes="96 6C">–l</span> <span data-cp="99B8" data-bytes="91 C4">‘Ä</span> <span data-cp="99BC" data-bytes="96 77">–w</span> <span data-cp="99C4" data-bytes="99 F4">™ô</span> <span data-cp="99C5" data-bytes="9A 6F">šo</span> <span data-cp="99D6" data-bytes="9B C6">›Æ</span> <span data-cp="99DA" data-bytes="9F AB">Ÿ«</span> <span data-cp="99E0" data-bytes="8C BE">Œ¾</span> <span data-cp="99E1" data-bytes="8E C1">ŽÁ</span> <span data-cp="99E6" data-bytes="95 55">•U</span> <span data-cp="99F5" data-bytes="91 52">‘R</span> <span data-cp="9A0C" data-bytes="91 53">‘S</span> <span data-cp="9A10" data-bytes="91 55">‘U</span> <span data-cp="9A1F" data-bytes="95 5D">•]</span> <span data-cp="9A21" data-bytes="96 71">–q</span> <span data-cp="9A26" data-bytes="9C 6D">œm</span> <span data-cp="9A2F" data-bytes="96 73">–s</span> <span data-cp="9A3B" data-bytes="91 54">‘T</span> <span data-cp="9A3C" data-bytes="9A 71">šq</span> <span data-cp="9A58" data-bytes="91 56">‘V</span> <span data-cp="9A5C" data-bytes="96 6D">–m</span> <span data-cp="9A63" data-bytes="95 57">•W</span> <span data-cp="9A6C" data-bytes="89 C6">‰Æ</span> <span data-cp="9A8F" data-bytes="89 C7">‰Ç</span> <span data-cp="9AB2" data-bytes="8A 6A">Šj</span> <span data-cp="9AB6" data-bytes="8B 57">‹W</span> <span data-cp="9ABA" data-bytes="9F E1">Ÿá</span> <span data-cp="9ABD" data-bytes="9B 5F">›_</span> <span data-cp="9AD7" data-bytes="A0 5D"> ]</span> <span data-cp="9AE0" data-bytes="91 5B">‘[</span> <span data-cp="9AE2" data-bytes="91 5C">‘\</span> <span data-cp="9AF4" data-bytes="91 5E">‘^</span> <span data-cp="9AFF" data-bytes="9F 5C">Ÿ\</span> <span data-cp="9B02" data-bytes="9F 57">ŸW</span> <span data-cp="9B09" data-bytes="9F 65">Ÿe</span> <span data-cp="9B0F" data-bytes="9A 72">šr</span> <span data-cp="9B14" data-bytes="91 60">‘`</span> <span data-cp="9B2A" data-bytes="9F 5E">Ÿ^</span> <span data-cp="9B2D" data-bytes="91 61">‘a</span> <span data-cp="9B2E" data-bytes="9F 60">Ÿ`</span> <span data-cp="9B34" data-bytes="91 64">‘d</span> <span data-cp="9B39" data-bytes="9F 41">ŸA</span> <span data-cp="9B40" data-bytes="91 69">‘i</span> <span data-cp="9B50" data-bytes="91 68">‘h</span> <span data-cp="9B69" data-bytes="9A 74">št</span> <span data-cp="9B7F" data-bytes="96 B2">–²</span> <span data-cp="9B81" data-bytes="9A 75">šu</span> <span data-cp="9B8B" data-bytes="9E E9">žé</span> <span data-cp="9B8D" data-bytes="8B BA">‹º</span> <span data-cp="9B8E" data-bytes="91 6D">‘m</span> <span data-cp="9B8F" data-bytes="A0 60"> `</span> <span data-cp="9B97" data-bytes="9F DE">ŸÞ</span> <span data-cp="9B9D" data-bytes="9F C3">ŸÃ</span> <span data-cp="9B9F" data-bytes="96 B5">–µ</span> <span data-cp="9BB0" data-bytes="A0 67"> g</span> <span data-cp="9BCF" data-bytes="96 B3">–³</span> <span data-cp="9BDD" data-bytes="9A 76">šv</span> <span data-cp="9BE9" data-bytes="95 D5">•Õ</span> <span data-cp="9BED" data-bytes="9E CA">žÊ</span> <span data-cp="9BF1" data-bytes="9A 77">šw</span> <span data-cp="9BF4" data-bytes="9A 78">šx</span> <span data-cp="9BFF" data-bytes="91 70">‘p</span> <span data-cp="9C02" data-bytes="91 6F">‘o</span> <span data-cp="9C0A" data-bytes="9F A3">Ÿ£</span> <span data-cp="9C0C" data-bytes="91 71">‘q</span> <span data-cp="9C10" data-bytes="96 B1">–±</span> <span data-cp="9C15" data-bytes="9F 63">Ÿc</span> <span data-cp="9C1B" data-bytes="9F 67">Ÿg</span> <span data-cp="9C1F" data-bytes="8B B9">‹¹</span> <span data-cp="9C20" data-bytes="9A 7A">šz</span> <span data-cp="9C26" data-bytes="8B 56">‹V</span> <span data-cp="9C2F" data-bytes="9A DA">šÚ</span> <span data-cp="9C35" data-bytes="96 B0">–°</span> <span data-cp="9C3A" data-bytes="9A 7E">š~</span> <span data-cp="9C45" data-bytes="9D DE">Þ</span> <span data-cp="9C4F" data-bytes="96 AD">–­</span> <span data-cp="9C53" data-bytes="96 AE">–®</span> <span data-cp="9C5D" data-bytes="9E A1">ž¡</span> <span data-cp="9C72" data-bytes="9E 50">žP</span> <span data-cp="9C7B" data-bytes="96 AF">–¯</span> <span data-cp="9C7C" data-bytes="8B F4">‹ô</span> <span data-cp="9D02" data-bytes="9F A4">Ÿ¤</span> <span data-cp="9D0C" data-bytes="96 BD">–½</span> <span data-cp="9D16" data-bytes="96 F4">–ô</span> <span data-cp="9D21" data-bytes="96 B8">–¸</span> <span data-cp="9D39" data-bytes="91 A7">‘§</span> <span data-cp="9D44" data-bytes="A0 5E"> ^</span> <span data-cp="9D49" data-bytes="9A 7D">š}</span> <span data-cp="9D4E" data-bytes="89 48">‰H</span> <span data-cp="9D50" data-bytes="9E B1">ž±</span> <span data-cp="9D5E" data-bytes="9D DB">Û</span> <span data-cp="9D6D" data-bytes="95 BF">•¿</span> <span data-cp="9D6E" data-bytes="8A 73">Šs</span> <span data-cp="9D7C" data-bytes="9E FE">žþ</span> <span data-cp="9D7E" data-bytes="91 7A">‘z</span> <span data-cp="9D83" data-bytes="91 7B">‘{</span> <span data-cp="9D93" data-bytes="9A A3">š£</span> <span data-cp="9DA5" data-bytes="96 C2">–Â</span> <span data-cp="9DAB" data-bytes="9F 77">Ÿw</span> <span data-cp="9DBD" data-bytes="9A A4">š¤</span> <span data-cp="9DC0" data-bytes="9A A5">š¥</span> <span data-cp="9DC4" data-bytes="91 A1">‘¡</span> <span data-cp="9DC9" data-bytes="89 B8">‰¸</span> <span data-cp="9DD4" data-bytes="91 73">‘s</span> <span data-cp="9DF0" data-bytes="9C 6B">œk</span> <span data-cp="9DFC" data-bytes="9A A6">š¦</span> <span data-cp="9E0A" data-bytes="89 BD">‰½</span> <span data-cp="9E0C" data-bytes="89 B9">‰¹</span> <span data-cp="9E0E" data-bytes="91 7D">‘}</span> <span data-cp="9E18" data-bytes="96 BB">–»</span> <span data-cp="9E1C" data-bytes="9F F2">Ÿò</span> <span data-cp="9E1F" data-bytes="8B F5">‹õ</span> <span data-cp="9E7B" data-bytes="9A A9">š©</span> <span data-cp="9E81" data-bytes="9F 54">ŸT</span> <span data-cp="9E84" data-bytes="9F E3">Ÿã</span> <span data-cp="9E85" data-bytes="9E ED">ží</span> <span data-cp="9E90" data-bytes="91 AA">‘ª</span> <span data-cp="9E95" data-bytes="91 AB">‘«</span> <span data-cp="9E96" data-bytes="A0 70"> p</span> <span data-cp="9E98" data-bytes="9F 6D">Ÿm</span> <span data-cp="9E9E" data-bytes="91 AC">‘¬</span> <span data-cp="9EA2" data-bytes="91 AD">‘­</span> <span data-cp="9EA6" data-bytes="A0 FD"> ý</span> <span data-cp="9EA8" data-bytes="9F E2">Ÿâ</span> <span data-cp="9EAA" data-bytes="91 AF">‘¯</span> <span data-cp="9EAB" data-bytes="9E 41">žA</span> <span data-cp="9EAC" data-bytes="9A AA">šª</span> <span data-cp="9EAF" data-bytes="91 B0">‘°</span> <span data-cp="9EB1" data-bytes="9A AB">š«</span> <span data-cp="9EBD" data-bytes="9A AC">š¬</span> <span data-cp="9EBF" data-bytes="9A 4A">šJ</span> <span data-cp="9EC1" data-bytes="91 B2">‘²</span> <span data-cp="9EC4" data-bytes="8B F6">‹ö</span> <span data-cp="9EC6" data-bytes="9A AD">š­</span> <span data-cp="9EC7" data-bytes="89 B6">‰¶</span> <span data-cp="9EE2" data-bytes="9A AF">š¯</span> <span data-cp="9EF1" data-bytes="9A B0">š°</span> <span data-cp="9EF8" data-bytes="9A B1">š±</span> <span data-cp="9EFE" data-bytes="9A A1">š¡</span> <span data-cp="9F02" data-bytes="91 B9">‘¹</span> <span data-cp="9F08" data-bytes="91 BA">‘º</span> <span data-cp="9F16" data-bytes="91 BF">‘¿</span> <span data-cp="9F17" data-bytes="91 BE">‘¾</span> <span data-cp="9F26" data-bytes="A0 41"> A</span> <span data-cp="9F27" data-bytes="8B B7">‹·</span> <span data-cp="9F39" data-bytes="91 C0">‘À</span> <span data-cp="9F44" data-bytes="9A B3">š³</span> <span data-cp="9F45" data-bytes="91 C3">‘Ã</span> <span data-cp="9F50" data-bytes="A0 FC"> ü</span> <span data-cp="9F53" data-bytes="9F EE">Ÿî</span> <span data-cp="9F5A" data-bytes="9F 69">Ÿi</span> <span data-cp="9F62" data-bytes="91 C8">‘È</span> <span data-cp="9F69" data-bytes="91 C9">‘É</span> <span data-cp="9F7F" data-bytes="8D E6">æ</span> <span data-cp="9F8E" data-bytes="91 CB">‘Ë</span> <span data-cp="9F96" data-bytes="87 AC">‡¬</span> <span data-cp="9F97" data-bytes="87 A4">‡¤</span> <span data-cp="9F99" data-bytes="89 C8">‰È</span> <span data-cp="9F9F" data-bytes="8D AA">ª</span> <span data-cp="9FA5" data-bytes="9F DD">ŸÝ</span> <span data-cp="9FA6" data-bytes="8C 43">ŒC</span> <span data-cp="9FA7" data-bytes="8C 6D">Œm</span> <span data-cp="9FA8" data-bytes="8C 74">Œt</span> <span data-cp="9FA9" data-bytes="8C B7">Œ·</span> <span data-cp="9FAA" data-bytes="8C B9">Œ¹</span> <span data-cp="9FAB" data-bytes="8C BB">Œ»</span> <span data-cp="9FAC" data-bytes="8C C0">ŒÀ</span> <span data-cp="9FAD" data-bytes="8C D7">Œ×</span> <span data-cp="9FAE" data-bytes="8C D8">ŒØ</span> <span data-cp="9FAF" data-bytes="8C DA">ŒÚ</span> <span data-cp="9FB2" data-bytes="8C ED">Œí</span> <span data-cp="9FB3" data-bytes="8D 48">H</span> <span data-cp="9FC7" data-bytes="87 C2">‡Â</span> <span data-cp="9FC8" data-bytes="87 D2">‡Ò</span> <span data-cp="9FC9" data-bytes="87 D6">‡Ö</span> <span data-cp="9FCA" data-bytes="87 DA">‡Ú</span> <span data-cp="9FCB" data-bytes="87 DF">‡ß</span> <span data-cp="F907" data-bytes="8B F8">‹ø</span> </body></html>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/fetch.http.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/fetch.http.html
new file mode 100644
index 0000000000..d0cb7206f8
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/fetch.http.html
@@ -0,0 +1,143 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! Generated by `common/security-features/tools/generate.py --spec referrer-policy/4K-1/` -->
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta name="timeout" content="long">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/security-features/resources/common.sub.js"></script>
+ <script src="../../../../generic/test-case.sub.js"></script>
+ <script src="../../../generic/test-case.sub.js"></script>
+ </head>
+ <body>
+ <script>
+ TestCase(
+ [
+ {
+ "expectation": "stripped-referrer",
+ "origin": "cross-http",
+ "redirection": "keep-origin",
+ "source_context_list": [],
+ "source_scheme": "http",
+ "subresource": "fetch",
+ "subresource_policy_deliveries": [],
+ "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and keep-origin redirection from http context."
+ },
+ {
+ "expectation": "stripped-referrer",
+ "origin": "cross-http",
+ "redirection": "no-redirect",
+ "source_context_list": [],
+ "source_scheme": "http",
+ "subresource": "fetch",
+ "subresource_policy_deliveries": [],
+ "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and no-redirect redirection from http context."
+ },
+ {
+ "expectation": "stripped-referrer",
+ "origin": "cross-http",
+ "redirection": "swap-origin",
+ "source_context_list": [],
+ "source_scheme": "http",
+ "subresource": "fetch",
+ "subresource_policy_deliveries": [],
+ "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and swap-origin redirection from http context."
+ },
+ {
+ "expectation": "stripped-referrer",
+ "origin": "cross-https",
+ "redirection": "keep-origin",
+ "source_context_list": [],
+ "source_scheme": "http",
+ "subresource": "fetch",
+ "subresource_policy_deliveries": [],
+ "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and keep-origin redirection from http context."
+ },
+ {
+ "expectation": "stripped-referrer",
+ "origin": "cross-https",
+ "redirection": "no-redirect",
+ "source_context_list": [],
+ "source_scheme": "http",
+ "subresource": "fetch",
+ "subresource_policy_deliveries": [],
+ "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and no-redirect redirection from http context."
+ },
+ {
+ "expectation": "stripped-referrer",
+ "origin": "cross-https",
+ "redirection": "swap-origin",
+ "source_context_list": [],
+ "source_scheme": "http",
+ "subresource": "fetch",
+ "subresource_policy_deliveries": [],
+ "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and swap-origin redirection from http context."
+ },
+ {
+ "expectation": "stripped-referrer",
+ "origin": "same-http",
+ "redirection": "keep-origin",
+ "source_context_list": [],
+ "source_scheme": "http",
+ "subresource": "fetch",
+ "subresource_policy_deliveries": [],
+ "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and keep-origin redirection from http context."
+ },
+ {
+ "expectation": "stripped-referrer",
+ "origin": "same-http",
+ "redirection": "no-redirect",
+ "source_context_list": [],
+ "source_scheme": "http",
+ "subresource": "fetch",
+ "subresource_policy_deliveries": [],
+ "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and no-redirect redirection from http context."
+ },
+ {
+ "expectation": "stripped-referrer",
+ "origin": "same-http",
+ "redirection": "swap-origin",
+ "source_context_list": [],
+ "source_scheme": "http",
+ "subresource": "fetch",
+ "subresource_policy_deliveries": [],
+ "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and swap-origin redirection from http context."
+ },
+ {
+ "expectation": "stripped-referrer",
+ "origin": "same-https",
+ "redirection": "keep-origin",
+ "source_context_list": [],
+ "source_scheme": "http",
+ "subresource": "fetch",
+ "subresource_policy_deliveries": [],
+ "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and keep-origin redirection from http context."
+ },
+ {
+ "expectation": "stripped-referrer",
+ "origin": "same-https",
+ "redirection": "no-redirect",
+ "source_context_list": [],
+ "source_scheme": "http",
+ "subresource": "fetch",
+ "subresource_policy_deliveries": [],
+ "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and no-redirect redirection from http context."
+ },
+ {
+ "expectation": "stripped-referrer",
+ "origin": "same-https",
+ "redirection": "swap-origin",
+ "source_context_list": [],
+ "source_scheme": "http",
+ "subresource": "fetch",
+ "subresource_policy_deliveries": [],
+ "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and swap-origin redirection from http context."
+ }
+ ],
+ new SanityChecker()
+ ).start();
+ </script>
+ <div id="log"></div>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/filter-turbulence-invalid-001.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/filter-turbulence-invalid-001.html
new file mode 100644
index 0000000000..7400c8b379
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/filter-turbulence-invalid-001.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<title>CSS Filter Effects: feTurbulence with negative values from baseFrequency</title>
+<link rel="help" href="https://drafts.fxtf.org/filter-effects/#element-attrdef-feturbulence-basefrequency">
+<link rel="help" href="https://crbug.com/1068863"/>
+<link rel="match" href="reference/filter-turbulence-invalid-001-ref.html">
+<meta name="assert" content="This test checks that negative baseFrequency values are unsupported for feTurbulence.">
+<style>
+.target {
+ display: inline-block;
+ width: 100px;
+ height: 100px;
+ background-color: red;
+}
+</style>
+<div class="target" style="filter: url(#fn1)"></div>
+<div class="target" style="filter: url(#fn2)"></div>
+<div class="target" style="filter: url(#tb1)"></div>
+<div class="target" style="filter: url(#tb2)"></div>
+<svg height="0" color-interpolation-filters="sRGB">
+ <!-- type=fractalNoise -->
+ <filter id="fn1" x="0" y="0" width="1" height="1">
+ <feTurbulence type="fractalNoise" baseFrequency="-1 1"/>
+ <feComponentTransfer>
+ <feFuncR type="discrete" tableValues="1 0 1"/>
+ <feFuncG type="discrete" tableValues="0 0.502 0"/> <!-- map [0..1/3] -> 0; [1/3...2/3] -> 0.502; [2/3..1] -> 0 -->
+ <feFuncB type="discrete" tableValues="0"/>
+ <feFuncA type="discrete" tableValues="0 1 0"/>
+ </feComponentTransfer>
+ </filter>
+
+ <filter id="fn2" x="0" y="0" width="1" height="1">
+ <feTurbulence type="fractalNoise" baseFrequency="1 -1"/>
+ <feComponentTransfer>
+ <feFuncR type="discrete" tableValues="1 0 1"/>
+ <feFuncG type="discrete" tableValues="0 0.502 0"/> <!-- map [0..1/3] -> 0; [1/3...2/3] -> 0.502; [2/3..1] -> 0 -->
+ <feFuncB type="discrete" tableValues="0"/>
+ <feFuncA type="discrete" tableValues="0 1 0"/>
+ </feComponentTransfer>
+ </filter>
+
+ <!-- type=turbulence -->
+ <filter id="tb1" x="0" y="0" width="1" height="1">
+ <feTurbulence type="turbulence" baseFrequency="-1 1"/>
+ <feColorMatrix values="1 0 0 0 0, 0 1 0 0 0.502, 0 0 1 0 0, 0 0 0 1 1"/>
+ </filter>
+
+ <filter id="tb2" x="0" y="0" width="1" height="1">
+ <feTurbulence type="turbulence" baseFrequency="1 -1"/>
+ <feColorMatrix values="1 0 0 0 0, 0 1 0 0 0.502, 0 0 1 0 0, 0 0 0 1 1"/>
+ </filter>
+</svg>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/grid-auto-fill-rows-001.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/grid-auto-fill-rows-001.html
new file mode 100644
index 0000000000..afce3f5fa9
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/grid-auto-fill-rows-001.html
@@ -0,0 +1,184 @@
+<!DOCTYPE html>
+<title>CSS Grid: auto-fill rows</title>
+<link rel="author" title="Sergio Villar" href="mailto: svillar@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#valdef-repeat-auto-fill">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-auto-columns">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-auto-rows">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-template-rows">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-row">
+<link rel="help" href="https://drafts.csswg.org/css-align-3/#propdef-grid-row-gap">
+<link rel="help" href="https://crbug.com/619930">
+<link rel="help" href="https://crbug.com/589460">
+<link rel="help" href="https://crbug.com/648814">
+<meta name="assert" content="Check that auto-fill rows are properly computed in a grid container"/>
+<link href="/css/support/grid.css" rel="stylesheet">
+<style>
+
+.grid {
+ border: 2px solid magenta;
+ height: 200px;
+ width: 25px;
+ align-content: start;
+ grid-auto-rows: 157px;
+ grid-auto-columns: 25px;
+
+ float: left;
+ position: relative;
+ margin-right: 2px;
+}
+
+.gridOnlyAutoRepeat { grid-template-rows: repeat(auto-fill, 30px [autobar]); }
+.gridAutoRepeatAndFixedBefore { grid-template-rows: 10px [foo] 20% [bar] repeat(auto-fill, [autofoo] 35px); }
+.gridAutoRepeatAndFixedAfter { grid-template-rows: repeat(auto-fill, [first] 30px [last]) [foo] minmax(60px, 80px) [bar] minmax(45px, max-content); }
+.gridAutoRepeatAndFixed { grid-template-rows: [start] repeat(2, 50px [a]) [middle] repeat(auto-fill, [autofoo] 15px [autobar]) minmax(5%, 10%) [end]; }
+.gridMultipleNames { grid-template-rows: [start] 20px [foo] 50% repeat(auto-fill, [bar] 20px [start foo]) [foo] 10% [end bar]; }
+.gridMultipleTracks { grid-template-rows: [start] 20px repeat(auto-fill, [a] 2em [b c] 10% [d]) [e] minmax(75px, 1fr) [last]; }
+
+.item { background-color: blue; }
+.item:nth-child(2) { background: green; }
+.item:nth-child(3) { background: orange; }
+
+.gap { grid-row-gap: 20px; }
+
+</style>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/check-layout-th.js"></script>
+
+<body onload="checkLayout('.grid')">
+<div id="log"></div>
+
+<p>This test checks that repeat(auto-fill, ) syntax works as expected.</p>
+
+<div class="grid gridOnlyAutoRepeat">
+ <div class="item" style="grid-row: 1 / span 6" data-offset-y="0" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridOnlyAutoRepeat">
+ <div class="item" style="grid-row: 1 / span 6 autobar" data-offset-y="0" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridOnlyAutoRepeat gap">
+ <div class="item" style="grid-row: 1 / span 5" data-offset-y="0" data-offset-x="0" data-expected-height="357" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridOnlyAutoRepeat gap">
+ <div class="item" style="grid-row: autobar 2 / span 3" data-offset-y="100" data-offset-x="0" data-expected-height="257" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridOnlyAutoRepeat gap" style="height: auto; max-height: 90px;" data-expected-height="94" data-expected-width="29">
+ <div class="item" data-offset-y="0" data-offset-x="0" data-expected-height="30" data-expected-width="25"></div>
+ <div class="item" data-offset-y="50" data-offset-x="0" data-expected-height="30" data-expected-width="25"></div>
+ <div class="item" data-offset-y="100" data-offset-x="0" data-expected-height="157" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridOnlyAutoRepeat gap" style="height: auto; max-height: 90px; min-height: 130px;" data-expected-height="134" data-expected-width="29">
+ <div class="item" data-offset-y="0" data-offset-x="0" data-expected-height="30" data-expected-width="25"></div>
+ <div class="item" data-offset-y="50" data-offset-x="0" data-expected-height="30" data-expected-width="25"></div>
+ <div class="item" data-offset-y="100" data-offset-x="0" data-expected-height="30" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixedBefore">
+ <div class="item" style="grid-row: 1 / span 6" data-offset-y="0" data-offset-x="0" data-expected-height="190" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixedBefore">
+ <div class="item" style="grid-row: foo / autofoo" data-offset-y="10" data-offset-x="0" data-expected-height="40" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixedBefore">
+ <div class="item" style="grid-row: bar / 5 autofoo" data-offset-y="50" data-offset-x="0" data-expected-height="297" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixedBefore gap">
+ <div class="item" style="grid-row: 1 / span 4" data-offset-y="0" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixedBefore gap">
+ <div class="item" style="grid-row: span 3 / 2 autofoo" data-offset-y="0" data-offset-x="0" data-expected-height="125" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixedBefore gap">
+ <div class="item" style="grid-row: notPresent / 3 autofoo" data-offset-y="377" data-offset-x="0" data-expected-height="157" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixedAfter">
+ <div class="item" style="grid-row: 1 / span 4" data-offset-y="0" data-offset-x="0" data-expected-height="185" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixedAfter">
+ <div class="item" style="grid-row: first / last 2" data-offset-y="0" data-offset-x="0" data-expected-height="60" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixedAfter">
+ <div class="item" style="grid-row: last 2 / foo" data-offset-y="60" data-offset-x="0" data-expected-height="80" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixedAfter gap">
+ <div class="item" style="grid-row: 1 / span 3" data-offset-y="0" data-offset-x="0" data-expected-height="195" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixedAfter gap">
+ <div class="item" style="grid-row: 3 / span 1 bar" data-offset-y="130" data-offset-x="0" data-expected-height="222" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixedAfter gap">
+ <div class="item" style="grid-row: first / foo" data-offset-y="0" data-offset-x="0" data-expected-height="30" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixed">
+ <div class="item" style="grid-row: 1 / span 8" data-offset-y="0" data-offset-x="0" data-expected-height="195" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixed">
+ <div class="item" style="grid-row: a / autobar 2" data-offset-y="50" data-offset-x="0" data-expected-height="80" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixed">
+ <div class="item" style="grid-row: autofoo / end" data-offset-y="100" data-offset-x="0" data-expected-height="95" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixed gap">
+ <div class="item" style="grid-row: 1 / span 4" data-offset-y="0" data-offset-x="0" data-expected-height="195" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridAutoRepeatAndFixed gap">
+ <div class="item" style="grid-row: autobar / -1" data-offset-y="175" data-offset-x="0" data-expected-height="20" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridMultipleNames">
+ <div class="item" style="grid-row: 1 / -1" data-offset-y="0" data-offset-x="0" data-expected-height="200" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridMultipleNames">
+ <div class="item" style="grid-row: foo 3 / 4 bar" data-offset-y="160" data-offset-x="0" data-expected-height="40" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridMultipleNames">
+ <div class="item" style="grid-row: -6 / span 2 start" data-offset-y="20" data-offset-x="0" data-expected-height="140" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridMultipleNames gap">
+ <div class="item" style="grid-row: -4 / -2" data-offset-y="40" data-offset-x="0" data-expected-height="140" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridMultipleNames gap">
+ <div class="item" style="grid-row: bar / foo 2" data-offset-y="160" data-offset-x="0" data-expected-height="20" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridMultipleNames gap">
+ <div class="item" style="grid-row: foo / bar 2" data-offset-y="40" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridMultipleTracks">
+ <div class="item" style="grid-row: a / 2 c" data-offset-y="20" data-offset-x="0" data-expected-height="84" data-expected-width="25"></div>
+ <div class="item" style="grid-row: 3 / e; grid-column: 2;" data-offset-y="52" data-offset-x="25" data-expected-height="72" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridMultipleTracks gap">
+ <div class="item" style="grid-row: a / c" data-offset-y="40" data-offset-x="0" data-expected-height="32" data-expected-width="25"></div>
+ <div class="item" style="grid-row: 3 / last; grid-column: 2;" data-offset-y="92" data-offset-x="25" data-expected-height="115" data-expected-width="25"></div>
+</div>
+
+</body>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/image-orientation-from-image-content-images-ref.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/image-orientation-from-image-content-images-ref.html
new file mode 100644
index 0000000000..c0d29909f9
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/image-orientation-from-image-content-images-ref.html
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Images Module Level 3: image-orientation: from-image for content images</title>
+<link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org">
+<link rel="help" href="https://drafts.csswg.org/css-images-3/#propdef-image-orientation">
+<style>
+ div.image {
+ display: inline-block;
+ }
+ div.container {
+ display: inline-block;
+ width: 100px;
+ vertical-align: top;
+ }
+ img {
+ width: 100px;
+ height: 100px;
+ background-repeat: no-repeat;
+ }
+ body {
+ overflow: hidden;
+ }
+</style>
+</head>
+<body >
+ <p>The images should rotate respecting their EXIF orientation because
+ image-orientation: from-image is specified.
+ </p>
+ <div class="container">
+ <div class="image" style="content: url(../support/exif-orientation-1-ul-pre-rotated.jpg)"></div>
+ <br>Normal
+ </div>
+ <div class="container">
+ <div class="image" style="content: url(../support/exif-orientation-2-ur-pre-rotated.jpg)"></div>
+ <br>Flipped horizontally
+ </div>
+ <div class="container">
+ <div class="image" style="content: url(../support/exif-orientation-3-lr-pre-rotated.jpg)"></div>
+ <br>Rotated 180&deg;
+ </div>
+ <div class="container">
+ <div class="image" style="content: url(../support/exif-orientation-4-lol-pre-rotated.jpg)"></div>
+ <br>Flipped vertically
+ </div>
+ <br>
+ <div class="container">
+ <div class="image" style="content: url(../support/exif-orientation-5-lu-pre-rotated.jpg)"></div>
+ <br>Rotated 90&deg; CCW and flipped vertically
+ </div>
+ <div class="container">
+ <div class="image" style="content: url(../support/exif-orientation-6-ru-pre-rotated.jpg)"></div>
+ <br>Rotated 90&deg; CW
+ </div>
+ <div class="container">
+ <div class="image" style="content: url(../support/exif-orientation-7-rl-pre-rotated.jpg)"></div>
+ <br>Rotated 90&deg; CW and flipped vertically
+ </div>
+ <div class="container">
+ <div class="image" style="content: url(../support/exif-orientation-8-llo-pre-rotated.jpg)"></div>
+ <br>Rotated 90&deg; CCW
+ </div>
+ <br>
+ <div class="container">
+ <img style="background-image: url(../support/exif-orientation-5-lu-pre-rotated.jpg)"></img>
+ <br>Rotated 90&deg; CCW and flipped vertically
+ </div>
+ <div class="container">
+ <img style="background-image: url(../support/exif-orientation-6-ru-pre-rotated.jpg)"></img>
+ <br>Rotated 90&deg; CW
+ </div>
+ <div class="container">
+ <img style="background-image: url(../support/exif-orientation-7-rl-pre-rotated.jpg)"></img>
+ <br>Rotated 90&deg; CW and flipped vertically
+ </div>
+ <div class="container">
+ <img style="background-image: url(../support/exif-orientation-8-llo-pre-rotated.jpg)"></img>
+ <br>Rotated 90&deg; CCW
+ </div>
+ <br>
+ <div class="container">
+ <div class="image" style="content: url(../support/exif-orientation-9-u-pre-rotated.jpg)"></div>
+ <br>Undefined (invalid value)
+ </div>
+</body>
+</html>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/masonry-item-placement-006.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/masonry-item-placement-006.html
new file mode 100644
index 0000000000..0082d72df2
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/masonry-item-placement-006.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML>
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html><head>
+ <meta charset="utf-8">
+ <title>CSS Grid Test: Masonry item placement</title>
+ <link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
+ <link rel="help" href="https://drafts.csswg.org/css-grid-2">
+ <link rel="match" href="masonry-item-placement-006-ref.html">
+ <style>
+html,body {
+ color:black; background-color:white; font:15px/1 monospace; padding:0; margin:0;
+}
+
+grid {
+ display: inline-grid;
+ gap: 1px 2px;
+ grid-template-columns: repeat(4,20px);
+ grid-template-rows: masonry;
+ color: #444;
+ border: 1px solid;
+ padding: 2px;
+}
+
+item {
+ background-color: #444;
+ color: #fff;
+}
+.next > grid {
+ masonry-auto-flow: next;
+}
+</style>
+</head>
+<body>
+
+<grid>
+ <item style="padding-top:30px">1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+</grid>
+
+<grid>
+ <item>1</item>
+ <item style="padding-top:30px">2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+</grid>
+
+<grid>
+ <item style="padding-top:30px">1</item>
+ <item style="padding-top:30px">2</item>
+ <item style="padding-top:10px">3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+</grid>
+
+<grid>
+ <item>1</item>
+ <item style="padding-top:30px">2</item>
+ <item style="padding-top:10px">3</item>
+ <item style="grid-column:span 2">4</item>
+ <item>5</item>
+ <item>6</item>
+</grid>
+
+<grid>
+ <item>1</item>
+ <item style="padding-top:30px">2</item>
+ <item style="padding-top:10px">3</item>
+ <item style="grid-column:span 3">4</item>
+ <item>5</item>
+ <item>6</item>
+</grid>
+
+<grid>
+ <item>1</item>
+ <item style="padding-top:30px">2</item>
+ <item style="padding-top:10px">3</item>
+ <item style="grid-column:span 4">4</item>
+ <item>5</item>
+ <item>6</item>
+</grid>
+
+<span class="next">
+<grid>
+ <item style="padding-top:30px">1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+</grid>
+
+<grid>
+ <item>1</item>
+ <item style="padding-top:30px">2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+</grid>
+
+<grid>
+ <item style="padding-top:30px">1</item>
+ <item style="padding-top:30px">2</item>
+ <item style="padding-top:10px">3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+</grid>
+
+<grid>
+ <item>1</item>
+ <item style="padding-top:30px">2</item>
+ <item style="padding-top:10px">3</item>
+ <item style="grid-column:span 2">4</item>
+ <item>5</item>
+ <item>6</item>
+</grid>
+
+<grid>
+ <item>1</item>
+ <item style="padding-top:30px">2</item>
+ <item style="padding-top:10px">3</item>
+ <item style="grid-column:span 3">4</item>
+ <item>5</item>
+ <item>6</item>
+</grid>
+
+<grid>
+ <item>1</item>
+ <item style="padding-top:30px">2</item>
+ <item style="padding-top:10px">3</item>
+ <item style="grid-column:span 4">4</item>
+ <item>5</item>
+ <item>6</item>
+</grid>
+</span>
+
+</body>
+</html>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/moz-css21-table-page-break-inside-avoid-2.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/moz-css21-table-page-break-inside-avoid-2.html
new file mode 100644
index 0000000000..cc6a55933f
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/moz-css21-table-page-break-inside-avoid-2.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en-US" class="reftest-paged">
+<head>
+ <title>CSS Test: CSS 2.1 page-break-inside:avoid</title>
+ <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=685012">
+ <link rel="help" href="http://www.w3.org/TR/CSS21/page.html#propdef-page-break-inside">
+ <link rel="match" href="moz-css21-table-page-break-inside-avoid-2-ref.html">
+ <meta name="flags" content="paged">
+<style type="text/css">
+@page { size:5in 3in; margin:0.5in; }
+p { height: 1in; width: 1in; margin:0; background-color:blue; }
+.test { page-break-inside:avoid; }
+</style>
+</head>
+<body>
+<table border="1">
+<tbody>
+<tr><td><p>1</p></td></tr>
+</tbody>
+</table>
+<div style= "page-break-after: always"></div>
+<table border="1" class="test">
+<tbody></tbody>
+<tbody>
+<tr><td><p>2</p><p>3</p></td></tr>
+</tbody>
+</table>
+</body>
+</html>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/position-sticky-table-th-bottom-ref.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/position-sticky-table-th-bottom-ref.html
new file mode 100644
index 0000000000..2aa5c08a55
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/position-sticky-table-th-bottom-ref.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<title>Reference for position:sticky bottom constraint should behave correctly for &lt;th&gt; elements</title>
+
+<style>
+.group {
+ display: inline-block;
+ position: relative;
+ width: 150px;
+ height: 200px;
+}
+
+.scroller {
+ position: relative;
+ width: 100px;
+ height: 150px;
+ overflow-x: hidden;
+ overflow-y: auto;
+}
+
+.contents {
+ height: 550px;
+}
+
+.indicator {
+ position: absolute;
+ background-color: green;
+ left: 0;
+ height: 50px;
+ width: 50px;
+}
+</style>
+
+<script>
+window.addEventListener('load', function() {
+ document.getElementById('scroller1').scrollTop = 0;
+ document.getElementById('scroller2').scrollTop = 75;
+ document.getElementById('scroller3').scrollTop = 200;
+});
+</script>
+
+<div class="group">
+ <div id="scroller1" class="scroller">
+ <div class="indicator" style="top: 100px;"></div>
+ <div class="contents"></div>
+ </div>
+</div>
+
+<div class="group">
+ <div id="scroller2" class="scroller">
+ <div class="indicator" style="top: 150px;"></div>
+ <div class="contents"></div>
+ </div>
+</div>
+
+<div class="group">
+ <div id="scroller3" class="scroller">
+ <div class="indicator" style="top: 250px;"></div>
+ <div class="contents"></div>
+ </div>
+</div>
+
+<div>You should see three green boxes above. No red should be visible.</div>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/pre-float-001.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/pre-float-001.html
new file mode 100644
index 0000000000..8dd08d8099
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/pre-float-001.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<title>CSS test preserved spaces and floats interaction</title>
+<link rel="author" title="Koji Ishii" href="kojii@chromium.org">
+<link rel="match" href="reference/pre-float-001-ref.html">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<style>
+html {
+ font-family: Ahem;
+ font-size: 20px;
+ line-height: 1;
+}
+.container {
+ white-space: pre;
+ width: 10ch;
+ margin-bottom: 1em;
+}
+.float {
+ float: left;
+ width: 3ch;
+ height: 2em;
+ background: orange;
+}
+</style>
+<body>
+ <div class="float"></div>
+ <div class="container">123456 <br>123456</div>
+ <div class="float"></div>
+ <div class="container">1234567 <br>1234567</div>
+ <div class="float"></div>
+ <div class="container">1234567 <br>1234567</div>
+ <div class="float"></div>
+ <div class="container">1234567 <br>1234567</div>
+ <div class="float"></div>
+ <div class="container">12345678 <br>12345678</div>
+</body>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/resize-004.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/resize-004.html
new file mode 100644
index 0000000000..3a1f561749
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/resize-004.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Basic User Interface Test: resize initial value - none</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<link rel="author" title="Shiyou Tan" href="mailto:shiyoux.tan@intel.com">
+<link rel="help" title="8.1. 'resize' property" href="http://www.w3.org/TR/css3-ui/#resize">
+<meta name="flags" content="interact">
+<meta name="assert" content="Test checks that the resize property initial value is none">
+<style>
+ #test {
+ border: 2px solid blue;
+ height: 100px;
+ overflow: auto;
+ width: 100px;
+ }
+</style>
+<body>
+ <p>Test passes if <strong>neither</strong> the height <strong>nor</strong> the width of the blue border square can be adjusted(for instance by dragging the bottom-right corner).</p>
+ <div id="test"></div>
+</body>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/test-plan.src.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/test-plan.src.html
new file mode 100644
index 0000000000..c29f268837
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/test-plan.src.html
@@ -0,0 +1,1616 @@
+
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Compositing and Blending Test Plan</title>
+ <meta charset='utf-8'>
+ <script src='http://www.w3.org/Tools/respec/respec-w3c-common'
+ async class='remove'></script>
+ <script class='remove'>
+ var respecConfig = {
+ specStatus: "unofficial",
+ shortName: "compositing-1-test-plan",
+ editors: [
+ {
+ name: "Mirela Budaes",
+ company: "Adobe Systems, Inc.",
+ companyURL: "http://www.adobe.com/"
+ },
+ {
+ name: "Horia Olaru",
+ company: "Adobe Systems, Inc.",
+ companyURL: "http://www.adobe.com/"
+ },
+ {
+ name: "Mihai Tica",
+ company: "Adobe Systems, Inc.",
+ companyURL: "http://www.adobe.com/"
+ },
+
+ ]
+ };
+ </script>
+ <style>
+ table
+ {
+ border-collapse:collapse;
+ }
+ table, td, th
+ {
+ border:1px solid black;
+ padding: 13px;
+ }
+ table
+ {
+ width: 100%;
+ }
+ img
+ {
+ width: 400px;
+ }
+ </style>
+ </head>
+ <body>
+ <section id='abstract'>
+ <p>
+ This document is intended to be used as a guideline for the testing
+ activities related to the Compositing and Blending spec [[!compositing-1]]. Its main
+ goal is to provide an overview of the general testing areas and an informative
+ description of possible test cases.
+ </p>
+ <p>
+ This document is not meant to replace the spec in determining the
+ normative and non-normative assertions to be tested, but rather
+ complement it.
+ </p>
+ </section>
+ <section>
+ <h2>Goals</h2>
+ <section>
+ <h3>Providing guidance on testing</h3>
+ <p>
+ In order to increase the quality of the test contributions, this
+ document offers a set of test cases description for conducting testing (see
+ <a href="#test-cases-description" class="sectionRef"></a>).
+ </p>
+ </section>
+ <section>
+ <h3>Creating automation-friendly tests</h3>
+ <p>
+ In terms of actual tests produced for the CSS Compositing and Blending, the main goal
+ is to ensure that most tests are automatable (i.e. they're either
+ reftests or use <code>testharness.js</code>). Even where manual tests
+ are absolutely necessary they should be written so that they can be
+ easily automated &ndash; as there are on-going efforts to make
+ WebDriver [[webdriver]] automated tests a first class citizen in W3C
+ testing. This means that even if a manual test requires user
+ interaction, the validation or PASS/FAIL conditions should still be
+ clear enough as to allow automatic validation if said interaction is
+ later automated.
+ </p>
+ </section>
+ </section>
+ <section>
+ <h2>Approach</h2>
+ <p>
+ Since CSS blending has only three new CSS properties,
+ the approach is to deep dive into every aspect of the spec as much as possible.
+
+ Tests will be created for the testing areas listed in <a href="#testig-areas" class="sectionRef"></a>
+ and having as guidance the test cases description from <a href="#test-cases-description" class="sectionRef"></a>.
+ </p>
+ </section>
+ <section>
+ <h2>Testing areas</h2>
+ <section>
+ <h3>Explicit testing areas</h3>
+ <p>
+ These testing areas cover things explicitly defined in the normative sections of the Blending and Compositing spec. Please note that while detailed, this list is not necessarily
+ exhaustive and some normative behaviors may not be contained in it.
+ When in doubt, consult the Blending and Compositing spec or ask a question on the
+ <a href="http://lists.w3.org/Archives/Public/www-style/">mailing
+ list</a>.
+ </p>
+ <p>Below is the list of explicit testing areas:</p>
+ <ol>
+ <li>Proper parsing of the CSS properties and rendering according to the spec
+ <ul><code>mix-blend-mode</code></ul>
+ <ul><code>isolation</code></ul>
+ <ul><code>background-blend-mode</code></ul>
+ </li>
+ <li>SVG blending</li>
+ <li>Canvas 2D blending</li>
+ </ol>
+ </section>
+ <section>
+ <h3>Implicit testing areas</h3>
+ <p>
+ These are testing areas either normatively defined in other specs
+ that explicitly refer to the Blending and Compositing spec (e.g. [[!css3-transforms]])
+ or simply not explicitly defined, but implied by various aspects of
+ the spec (e.g. processing model, CSS 2.1 compliance, etc.).
+ Please note that while detailed, this list is not necessarily
+ exhaustive and some normative behaviors may not be contained in it.
+ When in doubt, consult the Blending and Compositing spec or ask a question on the
+ <a href="http://lists.w3.org/Archives/Public/www-style/">mailing
+ list</a>.
+ </p>
+ <p>Below is the list of implicit testing areas:</p>
+ <ol>
+ <li>Blending different types of elements
+ <ul>
+ <li><code>&lt;video&gt;</code></li>
+ <li><code>&lt;canvas&gt;</code></li>
+ <li><code>&lt;table&gt;</code></li>
+ </ul>
+ </li>
+ <li>Blending elements with specific style rules applied
+ <ul>
+ <li><code>transforms</code></li>
+ <li><code>transitions</code> </li>
+ <li><code>animations</code> </li>
+ </ul>
+ </li>
+ </ol>
+ </section>
+ </section>
+ <section>
+ <h2>Test cases description</h2>
+ <section>
+ <h3>Test cases for <code>mix-blend-mode</code></h3>
+ <p>
+ The following diagram describes a list of notations to be used later on in the document as well as the general document structure the test cases will follow. The test cases should not be limited to this structure. This should be a wireframe and people are encouraged to come up with complex test cases as well.
+ </p>
+ <p>
+ <img id="test_outline" src="test_template.png" alt="Mix-blend-mode sample elements">
+ </p>
+ <p>The intended structure of the document is the following:</p>
+ <pre>
+&lt;body&gt;
+ &lt;div id="[P]"&gt;
+ &lt;div id="[IN-S]"&gt;&lt;/div&gt;
+ &lt;div id="[IN-P]"&gt;
+ &lt;div id="[B]"&gt;
+ &lt;div id="[CB]"&gt;&lt;/div&gt;
+ &lt;/div&gt;
+ &lt;/div&gt;
+ &lt;/div&gt;
+&lt;/body&gt;
+ </pre>
+ <p> Unless otherwise stated, test cases assume the following properties for the elements: <br>
+ <ul>
+ <li> default value for the <code>background-color</code> of the <code>body</code></li>
+ <li> <code>background-color</code> set to a fully opaque color for all the other elements </li>
+ </ul>
+ </p>
+ <p>The CSS associated to the elements used in the tests shouldn't use properties that creates a stacking context, except the ones specified in the test case descriptions.</p>
+ <p>Every test case has a description of the elements used. The notation from the image is used in the test case description too (e.g. for parent element the notation is [P]). Each test case uses only a subset of the elements while the other elements should just be removed.
+ </p></p>
+ <section>
+ <h4>An element with <code>mix-blend-mode</code> other than normal creates a stacking context</h4>
+ <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode" >spec</a>: <q>Applying a blendmode other than ‘normal’ to the element must establish a new stacking context [CSS21].</q></p>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Simple <code>&lt;div&gt;</td>
+ <td>1 element required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal
+ </td>
+ <td>The element [B] creates a stacking context</td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4>An element with <code>mix-blend-mode</code> blends with the content within the current stacking context</h4>
+ <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#csscompositingrules_CSS">spec</a>: <q>An element that has blending applied, must blend with all the underlying content of the stacking context [CSS21] that that element belongs to.</q> </p>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Blending simple elements </td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal
+ </td>
+ <td>The color of the parent element [P] mixes with the color of the child element [B].</td>
+ </tr>
+ <tr>
+ <td>Blending <code>&lt;video&gt;</code></td>
+ <td>2 elements required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br>
+ [B] - <code>&lt;video&gt;</code> element with <code>mix-blend-mode</code> other than normal <br>
+ [IN-S] - sibling(of the element [B]) visually overlaping the <code>&lt;video&gt;</code> element <br>
+ [IN-S] has some text inside
+ </td>
+ <td>The content of the <code>video</code> element [B] mixes with the colors of the sibling element and the text from [IN-S].</td>
+ </tr>
+ <tr>
+ <td>Blending with a sibling</td>
+ <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal <br>
+ [IN-S] - sibling of the element [B] <br>
+ The [IN-S] element visually overlaps the [B] element
+ </td>
+ <td>The colors of the parent element [P] and the sibling element [IN-S] mixes with the color of the blended element [B].</td>
+ </tr>
+ <tr>
+ <td>Blending with two levels of ascendants</td>
+ <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="child of the element [P]">[IN-P]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal <br>
+ [IN-P] - Intermediate child element between the parent [P] and the child [B]
+ </td>
+ <td>The colors of the parent element [P] and the child element [IN-P] mixes with the color of the blended element [B].</td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4>An element with <code>mix-blend-mode</code> doesn't blend with anything outside the current stacking context</h4>
+ <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#csscompositingrules_CSS">spec</a>: <q> An element that has blending applied, must blend with all the underlying content of the stacking context [CSS21] that that element belongs to.</q></p>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Blending child overflows the parent</td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal <br>
+ The blending element [B] has content that lies outside the parent element. <br>
+ Set the <code>background-color</code> of the <code>body</code> to a value other than default</td>
+ <td>The color of the parent element mixes with the color of the child element. <br>
+ The area of the child element outside of the parent element doesn't mix with the color of the <code>body</code></td>
+ </tr>
+ <tr>
+ <td>Parent with transparent pixels</td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ The element has some text inside and default value for <code>background-color</code> <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal <br>
+ The <code>background-color</code> of the <code>body</code> has a value other than default</td>
+ <td>The color of the text from the parent element [P] mixes with the color of the child element [B]. <br>
+ No blending between the color of the <code>body</code> and the color of the blending element [B].
+ </td>
+ </tr>
+ <tr>
+ <td>Parent with <code>border-radius</code></td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [P] has <code>border-radius</code> specified (e.g.50%). <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal <br>
+ [B] has content that lies outside the parent element, over a rounded corner. <br>
+ The <code>background-color</code> of the <code>body</code> has a value other than default. </td>
+ <td>The color of the parent element mixes with the color of the child element. <br>
+ The area of the child element which draws over the rounded corner doesn't mix with the color of the <code>body</code></td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4>An element with <code>mix-blend-mode</code> other than normal must cause a group to be isolated</h4>
+ <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#isolation" >spec</a>: <q>operations that cause the creation of stacking context [CSS21] must cause a group to be isolated.</q> </p>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Child of the blended element has opacity</td>
+ <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal <br>
+ [CB] - child of the element [B] with <code>opacity</code> less than one. </td>
+ <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br>
+ No blending between [B] and [CB]</td>
+ </tr>
+ <tr>
+ <td>Overflowed child of the blended element</td>
+ <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal <br>
+ [CB] - child of the element [B] with content that lies outside the parent element [B].
+ </td>
+ <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br>
+ No blending between [B] and [CB]. There is only one color for the entire element [CB] </td>
+ </tr>
+ <tr>
+ <td>Blended element with transparent pixels</td>
+ <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal and transparent <code>background-color</code> <br>
+ [CB] - child of the element [B]
+ </td>
+ <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br>
+ No blending between [B] and [CB]. </td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4>An element with <code>mix-blend-mode</code> must work properly with css transforms</h4>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Parent with 3D transform</td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with <code>3D transform</code> <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal
+ <td>The color of the parent element [P] mixes with the color of the child element [B] <br>
+ The element (and the content) of the element [P] is properly transformed
+ </td>
+ </tr>
+ <tr>
+ <td>Blended element with 3D transform</td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal and <code>3D transform</code> <br>
+ [CB] - child of the element [B] </td>
+ <td> The color of the parent element [P] mixes with the color of the child element [B] <br>
+ The element (and the content) of the element [P] is properly transformed </td>
+ </tr>
+ <tr>
+ <td>Both parent and blended element with 3D transform</td>
+ <td> 2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with <code>3D transform</code> <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal and <code>3D transform</code>
+ </td>
+ <td>The color of the parent element [P] mixes with the color of the child element [B] <br>
+ The elements (and the content) of the elements [P] and [B] are properly transformed</td>
+ </tr>
+ <tr>
+ <td>Blended element with transform and preserve-3d</td>
+ <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal and transform with <code>transform-style:preserve-3d</code> <br>
+ [CB] - child of the element [B]. It has 3D transform property</td>
+ <td> The child element [CB] will NOT preserve its 3D position. <br>
+ <code>mix-blend-mode</code> override the behavior of <code>transform-style:preserve-3d</code>:
+ creates a flattened representation of the descendant elements <br>
+ The color of the group created by the child elements([B] and [CB]) will blend with the color of the parent element [P] </td>
+ </tr>
+ <tr>
+ <td>Blended element with transform and perspective</td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal and transform with <code>perspective</code> set to positive length </td>
+ <td>The colors of the parent and the child are mixed ([P] and [B]) <br>
+ The element (and the content) of the element [B] is properly transformed
+ </td>
+ </tr>
+ <tr>
+ <td>Sibling with 3D transform between the parent and the blended element</td>
+ <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal <br>
+ [IN-S] - Sibling(of the element [B]) with <code>3D transform</code> between the parent [P] and the child [B]
+ </td>
+ <td>The colors of the parent element [P] and the transformed sibling element [IN-S] mixes with the color of the blended element [B].<br>
+ The element (and the content) of the element [IN-S] is properly transformed
+ </td>
+ </tr>
+ <tr>
+ <td>Parent with 3D transform and transition</td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with <code>3D transform</code> and transition <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal
+ <td>The color of the parent element [P] mixes with the color of the child element [B] <br>
+ The element (and the content) of the element [P] is properly transformed
+ </td>
+ </tr>
+ <tr>
+ <td>Sibling with 3D transform(and transition) between the parent and the blended element</td>
+ <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal <br>
+ [IN-S] - sibling(of the element [B]) with <code>3D transform</code> and transition between the parent [P] and the child [B]
+ </td>
+ <td>The colors of the parent element [P] and the transformed sibling element [IN-S] mixes with the color of the blended element [B].<br>
+ The element (and the content) of the element [IN-S] is properly transformed
+ </td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4>An element with <code>mix-blend-mode</code> must work properly with elements with <code>overflow</code> property</h4>
+ <table>
+ <tr>
+ <td>Parent element with <code>overflow:scroll</code> </td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [P] has <code>overflow:scroll</code> <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal tat overflows the parents [P] dimensions so that it creates scrolling for the parent
+ <td>The color of the parent element [P] mixes with the color of the child element [B]. <br>
+ The scrolling mechanism is not affected.
+ </td>
+ </tr>
+ <tr>
+ <td>Blended element with <code>overflow:scroll</code></td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal, <code>overflow:scroll</code> and a child element that creates overflow for [B]</td>
+ <td>The color of the parent element [P] mixes with the color of the child element [B] <br>
+ The scrolling mechanism is not affected.
+ </td>
+ </tr>
+ <tr>
+ <td>Parent element with <code>overflow:scroll</code> and blended with <code>position:fixed</code> </td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [P] has <code>overflow:scroll</code> <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal, <code>position:fixed</code> and should overflow the parents [P] dimensions so that it creates scrolling for the parent</td>
+ <td>The color of the parent element [P] mixes with the color of the child element [B] <br>
+ The blending happens when scrolling the content of the parent element [P] too. <br>
+ The scrolling mechanism is not affected.
+ </td>
+ </tr>
+ <tr>
+ <td>Parent with <code>overflow:hidden</code> and <code>border-radius</code></td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [P] has <code>overflow:hidden</code> and <code>border-radius</code> specified (e.g.50%) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal with content that lies outside the parent element, over a rounded corner <br>
+ Set the <code>background-color</code> of the <code>body</code> to a value other than default.</td>
+ <td>The color of the parent element mixes with the color of the child element. <br>
+ The area of the child element which draws over the rounded corner is properly cut </td>
+ </tr>
+ <tr>
+ <td>Blended element with <code>overflow:hidden</code> and <code>border-radius</code></td>
+ <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal, <code>overflow:hidden</code> and <code>border-radius</code> specified (e.g.50%). <br>
+ [CB] - child of the element [B], with content that lies outside the parent element, over a rounded corner. <br> </td>
+ <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br>
+ No blending between [B] and [CB]. <br>
+ [CB] is properly clipped so no overflow is visible.</td>
+ </tr>
+ <tr>
+ <td>Intermediate child with <code>overflow:hidden</code> and <code>border-radius</code> between the parent and the blended element</td>
+ <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="child of the element [P]">[IN-P]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal that overflows the parents [IN-P] dimensions
+ [IN-P] - child(of the element [P]) with <code>overflow:hidden</code> and <code>border-radius</code> specified (e.g.50%)
+ </td>
+ <td>The colors of the parent element [P] and the child element [IN-P] mixes with the color of the blended element [B]. <br>
+ [B] is is properly clipped so no overflow is visible
+ </td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4>Other test cases</h4>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Blended element with <code>border-image</code> </td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal and <code>border-image</code> specified as a png file
+ </td>
+ <td>The color of the parent element [P] mixes with the color of the child element. <br>
+ The color of the <code>border-image</code> mixes with the color of the parent element [P].
+ </td>
+ </tr>
+ <tr>
+ <td>Blending with <code>&lt;canvas&gt;</code> </td>
+ <td>2 elements required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br>
+ [B] - <code>&lt;canvas&gt;</code> element with <code>mix-blend-mode</code> other than normal <br>
+ [IN-S] - Sibling of the <code>&lt;canvas&gt;</code> element with some text <br>
+ The [IN-S] element overlaps the <code>&lt;canvas&gt;</code> element
+ </td>
+ <td>The content of the <code>&lt;canvas&gt;</code> element mixes with the color of the sibling element and the text [IN-S].</td>
+ </tr>
+ <tr>
+ <td>Blended <code>&lt;canvas&gt;</code></td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - Child <code>&lt;canvas&gt;</code> element with <code>mix-blend-mode</code> other than normal
+ </td>
+ <td>The color of the <code>&lt;canvas&gt;</code> element [B] mixes with the color of the parent element [P] .</td>
+ </tr>
+ <tr>
+ <td>Blended <code>&lt;video&gt;</code></td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - <code>&lt;video&gt;</code> element with <code>mix-blend-mode</code> other than normal
+ </td>
+ <td>The color of the <code>&lt;video&gt;</code> element mixes with the color of the parent element [P] .</td>
+ </tr>
+ <tr>
+ <td>Blending with <code>&lt;iframe&gt;</code> </td>
+ <td>2 elements required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br>
+ [B] - <code>&lt;iframe&gt;</code> element with <code>mix-blend-mode</code> other than normal <br>
+ [IN-S] - sibling(of the element [B]) with some text <br>
+ The [IN-S] element visually overlaps the <code>&lt;iframe&gt;</code> element
+ </td>
+ <td>The color of the <code>&lt;iframe&gt;</code> element mixes with the color of the sibling element and the text [IN-S].</td>
+ </tr>
+ <tr>
+ <td>Blended <code>&lt;iframe&gt;</code></td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - <code>&lt;iframe&gt;</code> element with <code>mix-blend-mode</code> other than normal
+ </td>
+ <td>The color of the <code>&lt;iframe&gt;</code> element [B] mixes with the color of the parent element [P]. </td>
+ </tr>
+ <tr>
+ <td>Blended element with <code>mask</code> property</td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal and <code>mask</code> property specified to an SVG image (e.g. circle)</td>
+ <td>The colors of the parent and the masked child are mixed ([P] and [B])</td>
+ </tr>
+ <tr>
+ <td>Blended element with <code>clip-path</code> property </td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal and <code>clip-path</code> property specified to a basic shape (e.g. ellipse)</td>
+ <td>The colors of the parent and the clipped child are mixed ([P] and [B])</td>
+ </tr>
+ <tr>
+ <td>Blended element with <code>filter</code> property</td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal and <code>filter</code> property value other than none </td>
+ <td>The filter is applied and the result is mixed with the parent element</td>
+ </tr>
+ <tr>
+ <td>Blended element with <code>transition</code></td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal and <code>transition-property</code> for <code>opacity</code> </td>
+ <td>The transition is applied and the result is mixed with the parent element</td>
+ </tr>
+ <tr>
+ <td>Blended element with <code>animation</code></td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - element with <code>mix-blend-mode</code> other than normal and <code>animation</code> specified</td>
+ <td>The animation is applied to the child element and the result is mixed with the parent element</td>
+ </tr>
+ <tr>
+ <td>Image element</td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - <code>&lt;img&gt;</code> element (.jpeg or .gif image) with <code>mix-blend-mode</code> other than normal</td>
+ <td>The color of the <code>&lt;img&gt;</code> is mixed with the color of the <code>&lt;div&gt;</code>.</td>
+ </tr>
+ <tr>
+ <td>SVG element</td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - SVG element with <code>mix-blend-mode</code> other than normal</td>
+ <td>The color of the SVG is mixed with the color of the <code>&lt;div&gt;</code>.</td>
+ </tr>
+ <tr>
+ <td>Paragraph element</td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - paragraph element with <code>mix-blend-mode</code> other than normal</td>
+ <td>The color of the text from the paragraph element is mixed with the color of the <code>&lt;div&gt;</code></td>
+ </tr>
+ <tr>
+ <td>Paragraph element and background-image</td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ and <code>background-image</code> <br>
+ [B] - Child <code>p</code> element with some text and <code>mix-blend-mode</code> other than normal</td>
+ <td>The color of the text from the <code>p</code> element is mixed with the background image of the <code>&lt;div&gt;</code>.</td>
+ </tr>
+ <tr>
+ <td>Set blending from JavaScript</td>
+ <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [B] - Child <code>&lt;div&gt;</code> element with no <code>mix-blend-mode</code> specified<br>
+ From JavaScript, set the <code>mix-blend-mode</code> property for the child <code>&lt;div&gt;</code> to a value other than normal</td>
+ <td>The colors of the <code>&lt;div&gt;</code> elements are mixed.</td>
+ </tr>
+ </table>
+ </section>
+ </section>
+ <section>
+ <h3>Test cases for SVG elements with <code>mix-blend-mode</code></h4>
+ <section>
+ <h4><code>mix-blend-mode</code> with simple SVG graphical elements</h4>
+ <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode" >spec</a> : <q><code>mix-blend-mode</code> applies to svg, g, use, image, path, rect, circle, ellipse, line, polyline, polygon, text, tspan, and marker.</q></p>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Circle with SVG background</td>
+ <td>Set a background color for the SVG.<br>
+ Create 16 <code>circle</code> elements and fill them with a solid color.
+ <br>Apply each <code>mix-blend-mode</code> on them.</td>
+ <td>The color of the <code>circle</code> is mixed with the color of the background.</td>
+ </tr>
+ <tr>
+ <td>Ellipse with SVG background</td>
+ <td>Set a background color for the SVG.<br>
+ Create an <code>ellipse</code> element and fill it with a solid color.
+ <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td>
+ <td>The color of the <code>ellipse</code> is mixed with the color of the background.</td>
+ </tr>
+ <tr>
+ <td>Image with SVG background</td>
+ <td>Set a background color for the SVG.
+ <br>Create an <code>image</code> element and apply a <code>mix-blend-mode</code> other than <code>normal</code>.</td>
+ <td>The <code>image</code> is mixed with the color of the background.</td>
+ </tr>
+ <tr>
+ <td>Line with SVG background</td>
+ <td>Set a background color for the SVG.
+ <br>Create a <code>line</code> element and fill it with a solid color.
+ <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td>
+ <td>The color of the <code>line</code> is mixed with the color of the background.</td>
+ </tr>
+ <tr>
+ <td>Path with SVG background</td>
+ <td>Set a background color for the SVG.
+ <br>Create a <code>path</code> element and fill it with a solid color.
+ <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td>
+ <td>The color of the <code>path</code> is mixed with the color of the background.</td>
+ </tr>
+ <tr>
+ <td>Polygon with SVG background</td>
+ <td>Set a background color for the SVG.
+ <br>Create a <code>polygon</code> element and fill it with a solid color.
+ <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td>
+ <td>The color of the <code>polygon</code> is mixed with the color of the background.</td>
+ </tr>
+ <tr>
+ <td>Polyline with SVG background</td>
+ <td>Set a background color for the SVG.
+ <br>Create a <code>polyline</code> element and fill it with a solid color.
+ <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td>
+ <td>The color of the <code>polyline</code> is mixed with the color of the background.</td>
+ </tr>
+ <tr>
+ <td>Rect with SVG background</td>
+ <td>Set a background color for the SVG.
+ <br>Create a <code>rect</code> element and fill it with a solid color.
+ <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td>
+ <td>The color of the <code>rect</code> is mixed with the color of the background.</td>
+ </tr>
+ <tr>
+ <td>Text with SVG background</td>
+ <td>Set a background color for the SVG.
+ <br>Create a <code>text</code> element and apply a <code>mix-blend-mode</code> other than <code>normal</code>.</td>
+ <td>The text is mixed with the color of the background.</td>
+ </tr>
+ <tr>
+ <td>Text having tspan with SVG background</td>
+ <td>Set a background color for the SVG.
+ <br>Create a <code>text</code> element and a <code>tspan</code> inside it.
+ <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>tspan</code>.</td>
+ <td>The text is mixed with the color of the background.</td>
+ </tr>
+ <tr>
+ <td>Gradient with SVG background</td>
+ <td>Set a background color for the SVG.
+ <br>Create a <code>rect</code> element and fill it with a <code>gradient</code>.
+ <br>Apply a <code>mix-blend-mode</code> on it other than normal.</td>
+ <td>The gradient is mixed with the color of the background.</td>
+ </tr>
+ <tr>
+ <td>Pattern with SVG background</td>
+ <td>Set a background color for the SVG.
+ <br>Create a <code>rect</code> element and fill it with a <code>pattern</code>.
+ <br>Apply a <code>mix-blend-mode</code> on it other than normal.</td>
+ <td>The pattern is mixed with the color of the background.</td>
+ </tr>
+ <tr>
+ <td>Set blending on an element from JavaScript</td>
+ <td>Set a background color for the SVG.
+ <br>Create a <code>rect</code> element and fill it with a solid color.
+ <br>Apply a <code>mix-blend-mode</code> (other than <code>normal</code>) on it from JavaScript.</td>
+ <td>The color of the <code>rect</code> is mixed with the color of the background.</td>
+ </tr>
+ <tr>
+ <td>Marker with SVG background</td>
+ <td>Set a background color for the SVG.
+ <br>Create a <code>line</code> element containing a marker.
+ <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the marker.</td>
+ <td>The marker color is mixed with the color of the background.</td>
+ </tr>
+ <tr>
+ <td>Metadata with SVG background</td>
+ <td>Set a background color for the SVG.
+ <br>Create a <code>metadata</code> element containing an embedded pdf.
+ <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the marker.</td>
+ <td>The metadata content is not mixed with the color of the background.</td>
+ </tr>
+ <tr>
+ <td>ForeignObject with SVG background</td>
+ <td>Set a background color for the SVG.
+ <br>Create a <code>foreignObject</code> element containing a simple xhtml file.
+ <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the marker.</td>
+ <td>The foreignObject content is not mixed with the color of the background.</td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4><code>mix-blend-mode</code> with SVG groups</h4>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Group of overlapping elements with SVG background</td>
+ <td>Set a background color for the SVG.
+ <br>Create a <code>group</code> element containing two overlapping <code>rect</code> elements, each filled with a different solid color.
+ <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the group.</td>
+ <td>The <code>group</code> is mixed as a whole with the color of the background.</td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4><code>mix-blend-mode</code> with isolated groups</h4>
+ <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode" >spec</a>:
+ <br><q>By default, every element must create a non-isolated group.<br>
+ However, certain operations in SVG will create isolated groups.<br>
+ If one of the following features is used, the group must become isolated:
+ <ul>
+ <li>opacity</li>
+ <li>filters</li>
+ <li>3D transforms (2D transforms must NOT cause isolation)</li>
+ <li>blending</li>
+ <li>masking</li>
+ </ul>
+ </q>
+ </p>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Blending two elements in an isolated group</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>group</code> element containing two overlapping <code>rect</code> elements, each filled with a different solid color.<br>
+ Apply <code>opacity</code> less than 1 on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the second rect.</td>
+ <td>Only the intersection of the <code>rect</code> elements should mix.</td>
+ </tr>
+ <tr>
+ <td>Blending in a group with opacity</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br>
+ Apply <code>opacity</code> less than 1 on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td>
+ <td>The <code>rect</code> will not mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blending in a group with filter</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br>
+ Apply a <code>filter</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td>
+ <td>The <code>rect</code> will not mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blending in a group with 2D transform</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br>
+ Apply a <code>transform</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td>
+ <td>The <code>rect</code> will mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blending in a group with 3D transform</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br>
+ Apply a 3d transform on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td>
+ <td>The <code>rect</code> will not mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blending in a group with a mask</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br>
+ Apply a <code>mask</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td>
+ <td>The <code>rect</code> will not mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blending in a group with mix-blend-mode</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br>
+ Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td>
+ <td>The <code>rect</code> will not mix with the content behind it.</td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4>Other test cases for SVG</h4>
+ <table>
+ <tr>
+ <td>Blend with element having opacity</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>rect</code> element filled with a different solid color.<br>
+ Apply <code>opacity</code> less than 1 and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td>
+ <td>The <code>rect</code> will mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blend with element having stroke</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>rect</code> element filled with a different solid color.<br>
+ Apply a <code>stroke</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td>
+ <td>The <code>rect</code> will mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blend with element having stroke-opacity</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>rect</code> element filled with a different solid color.<br>
+ Apply a <code>stroke</code>, <code>stroke-opacity</code> less than 1 and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td>
+ <td>The <code>rect</code> will mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blend with element having stroke-dasharray</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>rect</code> element filled with a different solid color.<br>
+ Apply a <code>stroke-dasharray</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td>
+ <td>The <code>rect</code> will mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blend with element having transform</td>
+ <td>Set a background color for the SVG.<br>
+ Create an <code>image</code> element. Apply a <code>transform</code> (any combination of <code>translate</code>, <code>rotate</code>, <code>scale</code>, <code>skew</code>) and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td>
+ <td>The <code>image</code> will mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blend with SVG having viewbox and preserveAspectRatio set</td>
+ <td>Set a background color for the SVG, as well as <code>viewbox</code> and <code>preserveAspectRatio</code>.<br>
+ Create a <code>rect</code> element filled with a different solid color and apply a <code>mix-blend-mode</code> other than <code>normal</code> on it.</td>
+ <td>The <code>rect</code> will mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blend with an element having color-profile set</td>
+ <td>Set a background color for the SVG.<br>
+ Create an <code>image</code> element. Apply a <code>color-profile</code> (<code>sRGB</code>, for example) and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td>
+ <td>The <code>image</code> will mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blend with an element having overflow</td>
+ <td>Set a background color for the SVG.<br>
+ Create an <code>image</code> larger than the SVG.<br>
+ Apply <code>overflow</code> (<code>visible</code>, <code>hidden</code>, <code>scroll</code>) and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td>
+ <td>The <code>image</code> will mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blend with an element having clip-path</td>
+ <td>Set a background color for the SVG.<br>
+ Create an <code>image</code> element. Apply a <code>clip-path</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td>
+ <td>The <code>image</code> will mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blend with an element having a mask</td>
+ <td>Set a background color for the SVG.<br>
+ Create an <code>image</code> element.<br>
+ Apply a <code>mask</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td>
+ <td>The <code>image</code> will mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blend with an element having a filter</td>
+ <td>Set a background color for the SVG.<br>
+ Create an <code>image</code> element.<br>
+ Apply a <code>filter</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td>
+ <td>The <code>image</code> will mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blend with an animated element</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>rect</code> element filled with a different solid color.<br>
+ Apply an <code>animateTransform</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td>
+ <td>The <code>rect</code> will mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Set blending from an SVG script element</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>rect</code> element and fill it with a solid color.<br>
+ Apply a <code>mix-blend-mode</code> (other than <code>normal</code>) on it from an svg <code>script</code> element.</td>
+ <td>The <code>rect</code> will mix with the content behind it.</td>
+ </tr>
+ </table>
+ </section>
+ </section>
+ <section>
+ <h3>Test cases for <code>background-blend-mode</code></h3>
+ <section>
+ <h4>Blending between the background layers and the background color for an element with <code>background-blend-mode</code> </h4>
+ <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>Each background layer must blend with the element's background layer that are below it and the element's background color.</q></p>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Images with different formats</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ Tests should be created for <code>&lt;image&gt;</code> with different formats such as PNG, JPEG or SVG
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code></td>
+ </tr>
+ <tr>
+ <td>Gradient and background color</td>
+ <td>
+ Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;gradient&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code></td>
+ </tr>
+ <tr>
+ <td>Image and gradient</td>
+ <td>
+ Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code> on top of a <code>&lt;gradient&gt;</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>&lt;image&gt;</code> is mixed with the content of the <code>&lt;gradient&gt;</code>
+ </td>
+ </tr>
+ <tr>
+ <td>Gradient and image</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to a <code>&lt;gradient&gt;</code> on top of an <code>&lt;image&gt;</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>&lt;image&gt;</code> is mixed with the content of the <code>&lt;gradient&gt;</code></td>
+ </tr>
+ <tr>
+ <td>Two gradients</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to a <code>&lt;gradient&gt;</code> on top of another <code>&lt;gradient&gt;</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul></td>
+ <td>The content of the two gradients is mixed</td>
+ </tr>
+ <tr>
+ <td>Two images</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code> on top of another <code>&lt;image&gt;</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul></td>
+ <td>The content of the two images is mixed</td>
+ </tr>
+ <tr>
+ <td>Image and background color with transparency</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code> with transparency(e.g. PNG images)</li>
+ <li><code>background-color</code> set to a transparent color</li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code></td>
+ </tr>
+ <tr>
+ <td>Cross-fade image and gradient</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to a <q>cross-fade()</q> image on top of a <code>&lt;gradient&gt;</code> </li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the cross-faded image is mixed with the content of the <code>&lt;gradient&gt;</code></td>
+ </tr>
+ <tr>
+ <td>SVG image and background color</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to a data URI for an SVG image </li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the image is mixed with the color of the background</td>
+ </tr>
+ <tr>
+ <td>Animated gif image and background color</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an animated gif image</li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the image is mixed with the color of the background</td>
+ </tr>
+ <tr>
+ <td>Set <code>background-blend-mode</code> from JavaScript</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to a <code>gradient</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li>no <code>background-blend-mode</code> explicitly specified</li>
+ From JavaScript, set the <code>background-blend-mode</code> property to a value other than normal.
+ </ul>
+ </td>
+ <td>The content of the gradient is mixed with the color of the background</td>
+ </tr>
+ <tr>
+ <td><code>background-blend-mode</code> on element with 3D transform</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ <li><code>transform</code> set to a 3D function like rotateX, rotateY or translateZ</li>
+ </ul>
+ </td>
+ <td>The content of the image is mixed with the color of the background</td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4>Background layers do not blend with content outside the background (or behind the element)</h4>
+ <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>Background layer must not blend with the content that is behind the element instead they must act as if they are rendered into an isolated group.</q>
+ </p>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>One background layer</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The <code>background-image</code> is not mixed with anything outside the element</td>
+ </tr>
+ <tr>
+ <td>Two elements</td>
+ <td>2 elements required: a parent element with a child. <br>
+ Each one with the following properties:
+ <ul>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ <td>No blending between the background colors of the two elements</td>
+ </tr>
+ <tr>
+ <td>Parent and child with <code>background-blend-mode</code></td>
+ <td>2 elements required: a parent element with a child <br>
+ Parent properties: <br>
+ <ul>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ Child properties: <br>
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ <td>The content of the image from the child element does not mixes with the background color from the parent element</td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4> <code>background-blend-mode</code> list values apply to the corresponding background layer</h4>
+ <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>The ‘background-blend-mode’ list must be applied in the same order as ‘background-image’[CSS3BG]. This means that the first element in the list will apply to the layer that is on top.</q>
+ </p>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Different blend modes applied between layers</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image-list&gt;</code> containing three images: (e.g. I1, I2 and I3 ) </li>
+ <li><code>background-blend-mode</code> set to different <code>blendmode</code> for every image: (e.g. multiply, difference, screen) </li>
+ </ul></td>
+ <td>The content of the three images is correctly mixed <br>
+ (multiply for I1, difference for I2 and screen for I3)
+ </td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4><code>background-blend-mode</code> list values are repeated if the list is shorter than the background layer list</h4>
+ <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>If a property doesn't have enough comma-separated values to match the number of layers, the UA must calculate its used value by repeating the list of values until there are enough.</q>
+ </p>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Blend mode list repeat</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image-list&gt;</code> containing three images</li>
+ <li><code>background-blend-mode</code> set to two different <code>blendmode</code> values</li>
+ </ul></td>
+ <td>The unspecified blend modes should be obtained by repeating the blend mode list from the beginning</td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4>The default <code>background-blend-mode</code> value for the <code>background</code> shorthand is 'normal' </h4>
+ <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>If the ‘background’ [CSS3BG] shorthand is used, the ‘background-blend-mode’ property for that element must be reset to its initial value.</q>
+ </p>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Default blend mode for 'background' shorthand</td>
+ <td>Element with
+ <ul>
+ <li><code>background</code> property set to an image and a color</li>
+ <li>No value explicitly set for <code>background-blend-mode</code> </li>
+ </ul></td>
+ <td> The computed value of <code>background-blend-mode</code> is 'normal'
+ </td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4><code>background-blend-mode</code> for an element with <code>background-position</code></h4>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td><code>background-position</code> percentage</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-position</code> specified in percentage, such as 50% 50%</li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br>
+ The <code>background-image</code> is correctly positioned
+ </td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4><code>background-blend-mode</code> for an element with <code>background-size</code></h4>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Background size defined in pixels</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-size</code> specified in pixels</li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br>
+ The <code>background-image</code> has the correct size
+ </td>
+ </tr>
+ <tr>
+ <td>Background size defined in percentage (second phase)</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-size</code> specified in percentage</li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br>
+ The <code>background-image</code> has the correct size
+ </td>
+ </tr>
+ <tr>
+ <td>Background size cover</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-size</code> set to <code>cover</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br>
+ The <code>background-image</code> has the correct size
+ </td>
+ </tr>
+ <tr>
+ <td>Background size contain</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-size</code> set to <code>contain</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br>
+ The <code>background-image</code> has the correct size
+ </td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4><code>background-blend-mode</code> for an element with <code>background-repeat</code></h4>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td><code>background-repeat</code> set to no-repeat</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-repeat</code> set to <code>no-repeat</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br>
+ The <code>background-image</code> is not repeated
+ </td>
+ </tr>
+ <tr>
+ <td><code>background-repeat</code> set to space</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-repeat</code> set to <code>space</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br>
+ </td>
+ </tr>
+ <tr>
+ <td><code>background-repeat</code> set to round</td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-repeat</code> set to <code>round</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br>
+ </td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4><code>background-blend-mode</code> for an element with <code>background-clip</code></h4>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td><code>background-clip</code> set to <code>padding-box</code></td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-clip</code> set to <code>padding-box</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br>
+ No background is drawn below the border (background extends to the outside edge of the padding)
+ </td>
+ </tr>
+ <tr>
+ <td><code>background-clip</code> set to <code>content-box</code></td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-clip</code> set to <code>content-box</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br>
+ The background is painted within (clipped to) the content box
+ </td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4><code>background-blend-mode</code> for an element with <code>background-origin</code></h4>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td><code>background-origin</code> set to <code>border-box</code></td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-origin</code> set to <code>border-box</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br>
+ The background extends to the outside edge of the border (but underneath the border in z-ordering)
+ </td>
+ </tr>
+ <tr>
+ <td><code>background-origin</code> set to <code>content-box</code></td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-origin</code> set to <code>content-box</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br>
+ The background is painted within (clipped to) the content box
+ </td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4><code>background-blend-mode</code> for an element with <code>background-attachement</code></h4>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td><code>background-attachment</code> set to <code>fixed</code></td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to an <code>&lt;image&gt;</code></li>
+ <li><code>background-color</code> set to a fully opaque color</li>
+ <li><code>background-attachment</code> set to <code>fixed</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br>
+ The background image will not scroll with its containing element, instead remaining stationary within the viewport
+ </td>
+ </tr>
+ <tr>
+ <td>2 background images with <code>background-attachment</code> set to <code>fixed, scroll</code></td>
+ <td>Element with
+ <ul>
+ <li><code>background-image</code> set to 2 <code>&lt;image&gt;</code>(s)</li>
+ <li><code>background-attachment</code> set to <code>fixed, scroll</code></li>
+ <li><code>background-blend-mode</code> other than normal</li>
+ </ul>
+ </td>
+ <td>The background images will be mixed when they overlap while scrolling
+ </td>
+ </tr>
+ </table>
+ </section>
+ </section>
+ <section>
+ <h3>Test cases for <code>isolation</code></h3>
+ <section>
+ <h4>An element with <code>isolation:isolate</code> creates a stacking context</h4>
+ <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#csscompositingrules_CSS">spec</a>: <q>For CSS, setting ‘isolation’ to ‘isolate’ will turn the element into a stacking context [CSS21].</q></p>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Isolation isolate</td>
+ <td>Have an element with <code>isolation</code> set to <code>isolate</code></td>
+ <td>The element creates a stacking context.</td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4>An element with <code>isolation:isolate</code> creates an isolated group for blended children</h4>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Isolation of blended child which overflows</td>
+ <td>3 elements required:
+ <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>,
+ <a href="#test_outline" title="child of the element [P]">[IN-P]</a> and
+ <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br>
+ [IN-P] - Intermediate child element between the parent [P] and the child [B]<br>
+ This element has <code>isolation:isolate</code> set.<br>
+ [B] - element with <code>mix-blend-mode</code> other than <code>normal</code> <br>
+ The blending element [B] has content that lies outside the parent element. <br>
+ </td>
+ <td>
+ The color of the child element [B] mixes with the color of the intermediate element [IN-P], where they overlap.<br>
+ The area of the child element outside of the intermediate parent element does not mix with the color of the parent element [P], or of the <code>body</code>.
+ </td>
+ </tr>
+ <tr>
+ <td>Isolation on intermediate element with transparent pixels</td>
+ <td>3 elements required:
+ <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>,
+ <a href="#test_outline" title="child of the element [P]">[IN-P]</a> and
+ <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>); the element <code>background-color</code> is other than <code>transparent</code><br>
+ [IN-P] - Intermediate child element between the parent [P] and the child [B]<br>
+ The intermediate element has text content, default value for <code>background-color</code> and <code>isolation:isolate</code> set<br>
+ [B] - element with <code>mix-blend-mode</code> other than <code>normal</d <br>
+ <td>
+ The color of the child element [B] mixes with the color of the intermediate element [IN-P], where they overlap.<br>
+ There is no blending between the color of the parent element [P] and the color of the blended element [B].
+ </td>
+ </tr>
+ <tr>
+ <td>Isolate inside a stacking context created by a 3d transform</td>
+ <td>
+ 3 elements required:
+ <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>,
+ <a href="#test_outline" title="child of the element [P]">[IN-P]</a> and
+ <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a <code>3D transform</code> applied<br>
+ [IN-P] - Intermediate child element between the parent [P] and the child [B]<br>
+ The intermediate element has <code>isolation:isolate</code> set<br>
+ [B] - element with <code>mix-blend-mode</code> other than <code>normal</code><br>
+ </td>
+ <td>
+ The color of the child element [B] mixes with the color of the intermediate element [IN-P], where they overlap.<br>
+ There is no blending between the color of the parent element [P] and the color of the blended element [B].
+ </td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4>An element with <code>isolation:auto</code> set does not change the elements existing stacking context behavior</h4>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Isolation auto</td>
+ <td>Have an element with <code>isolation</code> explicitly set to <code>auto</code>, and no other style that would create a stacking context</td>
+ <td>The element does not create a stacking context - the computed value of its <code>z-index</code> is value <code>auto</code></td>
+ </tr>
+ <tr>
+ <td>Stacking context not affected by isolation</td>
+ <td>2 elements required:
+ <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and
+ <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br>
+ [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>); This element has <code>isolation</code> explicitly set to <code>auto</code> <br>
+ [B] - element with <code>mix-blend-mode</code> other than <code>normal</code> <br>
+ The blending element [B] has content that lies outside the parent element. <br>
+ Set the <code>background-color</code> of the <code>body</code> to a value other than default
+ </td>
+ <td>The color of the parent element mixes with the color of the child element. <br>
+ The area of the child element outside of the parent element doesn't mix with the color of the <code>body</code>.<br>
+ In other words, setting the <code>isolation</code> to <code>auto</code> does not affect the creation of a stacking context by other properties.
+ </td>
+ </tr>
+ </table>
+ </section>
+ </section>
+ <section>
+ <h4>Test cases for <code>isolation</code> in SVG</h4>
+ <section>
+ <h4>In SVG, an element with <code>isolation:isolate</code> creates an isolated group for blended children</h4>
+ <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#isolation">spec</a>: <q>In SVG, this defines whether an element is isolated or not.</q></p>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Blending in an isolated group</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br>
+ Apply <code>isolation:isolate</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td>
+ <td>The <code>rect</code> will not mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blending two elements in an isolated group</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>group</code> element containing two overlapping <code>rect</code> elements, each filled with a different solid color.<br>
+ Apply <code>isolation:isolate</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the second rect.</td>
+ <td>Only the intersection of the <code>rect</code> elements should mix.</td>
+ </tr>
+ <tr>
+ <td>Blending in an isolated group with 2D transform</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br>
+ Apply <code>isolation:isolate</code> and 2D transform on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td>
+ <td>The <code>rect</code> will not mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Set isolation on an element from JavaScript</td>
+ <td>Set a background color for the SVG.
+ <br>Create a <code>rect</code> element and fill it with a solid color and a <code>mix-blend-mode</code> other than <code>normal</code>.
+ <br>Apply <code>isolation:isolate</code> on it from JavaScript.</td>
+ <td>The <code>rect</code> will not mix with the content behind it.</td>
+ </tr>
+ </table>
+ </section>
+ <section>
+ <h4>In SVG, an element with <code>isolation:auto</code> set does not change the rendering behaviour</h4>
+ <table>
+ <tr>
+ <th>Test name</th>
+ <th>Elements and styles</th>
+ <th>Expected result</th>
+ </tr>
+ <tr>
+ <td>Blending a group with <code>isolation:auto</code></td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br>
+ Apply <code>isolation:auto</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td>
+ <td>The element will mix with the content behind it.</td>
+ </tr>
+ <tr>
+ <td>Blending in a group with opacity</td>
+ <td>Set a background color for the SVG.<br>
+ Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br>
+ Apply <code>opacity</code> less than 1 and <code>isolation:auto</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td>
+ <td>The <code>rect</code> will not mix with the content behind it.</td>
+ </tr>
+ </table>
+ </section>
+ </section>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/toBlob.png.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/toBlob.png.html
new file mode 100644
index 0000000000..1533bfdb6c
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/toBlob.png.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<title>Canvas test: toBlob.png</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<canvas id="c"></canvas>
+<script>
+async_test(function() {
+ on_event(window, "load", this.step_func(function() {
+ var canvas = document.getElementById('c');
+ var ctx = canvas.getContext('2d');
+ canvas.toBlob(this.step_func_done(function(data) {
+ assert_equals(data.type, "image/png");
+ }), 'image/png');
+ }));
+}, "toBlob with image/png returns a PNG Blob");
+</script>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/will-change-abspos-cb-001.html b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/will-change-abspos-cb-001.html
new file mode 100644
index 0000000000..d59e443310
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/benchmarks/data/wpt/weighted/will-change-abspos-cb-001.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Test: will-change: position turns an element in an abspos containing block.</title>
+<link rel="author" title="Emilio Cobos Ãlvarez" href="mailto:emilio@crisal.io">
+<link rel="author" title="Boris Zbarsky" href="mailto:bzbarsky@mit.edu">
+<link rel="author" title="Mozilla" href="https://mozilla.org">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1498873">
+<link rel="help" href="https://drafts.csswg.org/css-will-change/#will-change">
+<link rel="match" href="will-change-abspos-cb-001-ref.html">
+<style>
+ .container {
+ border: 1px solid green;
+ width: 100px;
+ height: 100px;
+ margin-top: 100px;
+ display: flex;
+ will-change: position;
+ }
+ .abspos {
+ position: absolute;
+ top: 0;
+ left: 0;
+ background: orange;
+ height: 20px;
+ width: 20px;
+ }
+</style>
+<div class="container">
+ <div class="abspos"></div>
+</div>
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/debug-info.py b/testing/web-platform/tests/tools/third_party/html5lib/debug-info.py
new file mode 100644
index 0000000000..b47b8ebfa2
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/debug-info.py
@@ -0,0 +1,37 @@
+from __future__ import print_function, unicode_literals
+
+import platform
+import sys
+
+
+info = {
+ "impl": platform.python_implementation(),
+ "version": platform.python_version(),
+ "revision": platform.python_revision(),
+ "maxunicode": sys.maxunicode,
+ "maxsize": sys.maxsize
+}
+
+search_modules = ["chardet", "genshi", "html5lib", "lxml", "six"]
+found_modules = []
+
+for m in search_modules:
+ try:
+ __import__(m)
+ except ImportError:
+ pass
+ else:
+ found_modules.append(m)
+
+info["modules"] = ", ".join(found_modules)
+
+
+print("""html5lib debug info:
+
+Python %(version)s (revision: %(revision)s)
+Implementation: %(impl)s
+
+sys.maxunicode: %(maxunicode)X
+sys.maxsize: %(maxsize)X
+
+Installed modules: %(modules)s""" % info)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/doc/Makefile b/testing/web-platform/tests/tools/third_party/html5lib/doc/Makefile
new file mode 100644
index 0000000000..e0e58667e7
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/doc/Makefile
@@ -0,0 +1,177 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = _build
+
+# User-friendly check for sphinx-build
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
+endif
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+ @echo "Please use \`make <target>' where <target> is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " singlehtml to make a single large HTML file"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " devhelp to make HTML files and a Devhelp project"
+ @echo " epub to make an epub"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " latexpdf to make LaTeX files and run them through pdflatex"
+ @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+ @echo " text to make text files"
+ @echo " man to make manual pages"
+ @echo " texinfo to make Texinfo files"
+ @echo " info to make Texinfo files and run them through makeinfo"
+ @echo " gettext to make PO message catalogs"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " xml to make Docutils-native XML files"
+ @echo " pseudoxml to make pseudoxml-XML files for display purposes"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+ rm -rf $(BUILDDIR)/*
+
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+ @echo
+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/html5lib.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/html5lib.qhc"
+
+devhelp:
+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+ @echo
+ @echo "Build finished."
+ @echo "To view the help file:"
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/html5lib"
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/html5lib"
+ @echo "# devhelp"
+
+epub:
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+ @echo
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make' in that directory to run these through (pdf)latex" \
+ "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through pdflatex..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+latexpdfja:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through platex and dvipdfmx..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+ @echo
+ @echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+ @echo
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo
+ @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+ @echo "Run \`make' in that directory to run these through makeinfo" \
+ "(use \`make info' here to do that automatically)."
+
+info:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo "Running Texinfo files through makeinfo..."
+ make -C $(BUILDDIR)/texinfo info
+ @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+ $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+ @echo
+ @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
+
+xml:
+ $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+ @echo
+ @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+pseudoxml:
+ $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+ @echo
+ @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/doc/changes.rst b/testing/web-platform/tests/tools/third_party/html5lib/doc/changes.rst
new file mode 100644
index 0000000000..ded3b705d0
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/doc/changes.rst
@@ -0,0 +1,3 @@
+.. :changelog:
+
+.. include:: ../CHANGES.rst
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/doc/conf.py b/testing/web-platform/tests/tools/third_party/html5lib/doc/conf.py
new file mode 100644
index 0000000000..22ebab4faa
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/doc/conf.py
@@ -0,0 +1,123 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# html5lib documentation build configuration file, created by
+# sphinx-quickstart on Wed May 8 00:04:49 2013.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys
+import os
+
+# -- General configuration -----------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.viewcode']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = 'html5lib'
+copyright = '2006 - 2013, James Graham, Sam Sneddon, and contributors'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '1.0'
+# The full version, including alpha/beta/rc tags.
+sys.path.append(os.path.abspath('..'))
+from html5lib import __version__ # noqa
+release = __version__
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build', 'theme']
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+html_theme = 'default'
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'html5libdoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+ ('index', 'html5lib.tex', 'html5lib Documentation',
+ 'James Graham, Sam Sneddon, and contributors', 'manual'),
+]
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ ('index', 'html5lib', 'html5lib Documentation',
+ ['James Graham, Sam Sneddon, and contributors'], 1)
+]
+
+# -- Options for Texinfo output ------------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ ('index', 'html5lib', 'html5lib Documentation',
+ 'James Graham, Sam Sneddon, and contributors', 'html5lib', 'One line description of project.',
+ 'Miscellaneous'),
+]
+
+
+class CExtMock(object):
+ """Required for autodoc on readthedocs.org where you cannot build C extensions."""
+ def __init__(self, *args, **kwargs):
+ pass
+
+ def __call__(self, *args, **kwargs):
+ return CExtMock()
+
+ @classmethod
+ def __getattr__(cls, name):
+ if name in ('__file__', '__path__'):
+ return '/dev/null'
+ else:
+ return CExtMock()
+
+
+try:
+ import lxml # noqa
+except ImportError:
+ sys.modules['lxml'] = CExtMock()
+ sys.modules['lxml.etree'] = CExtMock()
+ print("warning: lxml modules mocked.")
+
+try:
+ import genshi # noqa
+except ImportError:
+ sys.modules['genshi'] = CExtMock()
+ sys.modules['genshi.core'] = CExtMock()
+ print("warning: genshi modules mocked.")
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.filters.rst b/testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.filters.rst
new file mode 100644
index 0000000000..d70e4552f0
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.filters.rst
@@ -0,0 +1,58 @@
+filters Package
+===============
+
+:mod:`base` Module
+-------------------
+
+.. automodule:: html5lib.filters.base
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`alphabeticalattributes` Module
+------------------------------------
+
+.. automodule:: html5lib.filters.alphabeticalattributes
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`inject_meta_charset` Module
+---------------------------------
+
+.. automodule:: html5lib.filters.inject_meta_charset
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`lint` Module
+------------------
+
+.. automodule:: html5lib.filters.lint
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`optionaltags` Module
+--------------------------
+
+.. automodule:: html5lib.filters.optionaltags
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`sanitizer` Module
+-----------------------
+
+.. automodule:: html5lib.filters.sanitizer
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`whitespace` Module
+------------------------
+
+.. automodule:: html5lib.filters.whitespace
+ :members:
+ :show-inheritance:
+ :special-members: __init__
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.rst b/testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.rst
new file mode 100644
index 0000000000..d7c75c5842
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.rst
@@ -0,0 +1,38 @@
+html5lib Package
+================
+
+.. automodule:: html5lib
+ :members: __version__
+
+:mod:`constants` Module
+-----------------------
+
+.. automodule:: html5lib.constants
+ :members:
+ :show-inheritance:
+
+:mod:`html5parser` Module
+-------------------------
+
+.. automodule:: html5lib.html5parser
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`serializer` Module
+------------------------
+
+.. automodule:: html5lib.serializer
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+Subpackages
+-----------
+
+.. toctree::
+
+ html5lib.filters
+ html5lib.treebuilders
+ html5lib.treewalkers
+ html5lib.treeadapters
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.treeadapters.rst b/testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.treeadapters.rst
new file mode 100644
index 0000000000..1d3a9fba2f
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.treeadapters.rst
@@ -0,0 +1,20 @@
+treeadapters Package
+====================
+
+:mod:`~html5lib.treeadapters` Package
+-------------------------------------
+
+.. automodule:: html5lib.treeadapters
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+.. automodule:: html5lib.treeadapters.genshi
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+.. automodule:: html5lib.treeadapters.sax
+ :members:
+ :show-inheritance:
+ :special-members: __init__
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.treebuilders.rst b/testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.treebuilders.rst
new file mode 100644
index 0000000000..1a051e50bd
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.treebuilders.rst
@@ -0,0 +1,42 @@
+treebuilders Package
+====================
+
+:mod:`treebuilders` Package
+---------------------------
+
+.. automodule:: html5lib.treebuilders
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`base` Module
+-------------------
+
+.. automodule:: html5lib.treebuilders.base
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`dom` Module
+-----------------
+
+.. automodule:: html5lib.treebuilders.dom
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`etree` Module
+-------------------
+
+.. automodule:: html5lib.treebuilders.etree
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`etree_lxml` Module
+------------------------
+
+.. automodule:: html5lib.treebuilders.etree_lxml
+ :members:
+ :show-inheritance:
+ :special-members: __init__
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.treewalkers.rst b/testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.treewalkers.rst
new file mode 100644
index 0000000000..4afef47609
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/doc/html5lib.treewalkers.rst
@@ -0,0 +1,50 @@
+treewalkers Package
+===================
+
+:mod:`treewalkers` Package
+--------------------------
+
+.. automodule:: html5lib.treewalkers
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`base` Module
+------------------
+
+.. automodule:: html5lib.treewalkers.base
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`dom` Module
+-----------------
+
+.. automodule:: html5lib.treewalkers.dom
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`etree` Module
+-------------------
+
+.. automodule:: html5lib.treewalkers.etree
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`etree_lxml` Module
+------------------------
+
+.. automodule:: html5lib.treewalkers.etree_lxml
+ :members:
+ :show-inheritance:
+ :special-members: __init__
+
+:mod:`genshi` Module
+--------------------
+
+.. automodule:: html5lib.treewalkers.genshi
+ :members:
+ :show-inheritance:
+ :special-members: __init__
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/doc/index.rst b/testing/web-platform/tests/tools/third_party/html5lib/doc/index.rst
new file mode 100644
index 0000000000..27104b1469
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/doc/index.rst
@@ -0,0 +1,22 @@
+Overview
+========
+
+.. include:: ../README.rst
+ :start-line: 6
+
+.. toctree::
+ :maxdepth: 2
+
+ movingparts
+ modules
+ changes
+ License <license>
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/doc/license.rst b/testing/web-platform/tests/tools/third_party/html5lib/doc/license.rst
new file mode 100644
index 0000000000..7e6291f3b9
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/doc/license.rst
@@ -0,0 +1,4 @@
+License
+=======
+
+.. include:: ../LICENSE
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/doc/make.bat b/testing/web-platform/tests/tools/third_party/html5lib/doc/make.bat
new file mode 100644
index 0000000000..e88c769ce3
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/doc/make.bat
@@ -0,0 +1,242 @@
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+set I18NSPHINXOPTS=%SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+ set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+ set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+ :help
+ echo.Please use `make ^<target^>` where ^<target^> is one of
+ echo. html to make standalone HTML files
+ echo. dirhtml to make HTML files named index.html in directories
+ echo. singlehtml to make a single large HTML file
+ echo. pickle to make pickle files
+ echo. json to make JSON files
+ echo. htmlhelp to make HTML files and a HTML help project
+ echo. qthelp to make HTML files and a qthelp project
+ echo. devhelp to make HTML files and a Devhelp project
+ echo. epub to make an epub
+ echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+ echo. text to make text files
+ echo. man to make manual pages
+ echo. texinfo to make Texinfo files
+ echo. gettext to make PO message catalogs
+ echo. changes to make an overview over all changed/added/deprecated items
+ echo. xml to make Docutils-native XML files
+ echo. pseudoxml to make pseudoxml-XML files for display purposes
+ echo. linkcheck to check all external links for integrity
+ echo. doctest to run all doctests embedded in the documentation if enabled
+ goto end
+)
+
+if "%1" == "clean" (
+ for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+ del /q /s %BUILDDIR%\*
+ goto end
+)
+
+
+%SPHINXBUILD% 2> nul
+if errorlevel 9009 (
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.http://sphinx-doc.org/
+ exit /b 1
+)
+
+if "%1" == "html" (
+ %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+ goto end
+)
+
+if "%1" == "dirhtml" (
+ %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+ goto end
+)
+
+if "%1" == "singlehtml" (
+ %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+ goto end
+)
+
+if "%1" == "pickle" (
+ %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the pickle files.
+ goto end
+)
+
+if "%1" == "json" (
+ %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the JSON files.
+ goto end
+)
+
+if "%1" == "htmlhelp" (
+ %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+ goto end
+)
+
+if "%1" == "qthelp" (
+ %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+ echo.^> qcollectiongenerator %BUILDDIR%\qthelp\html5lib.qhcp
+ echo.To view the help file:
+ echo.^> assistant -collectionFile %BUILDDIR%\qthelp\html5lib.ghc
+ goto end
+)
+
+if "%1" == "devhelp" (
+ %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished.
+ goto end
+)
+
+if "%1" == "epub" (
+ %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The epub file is in %BUILDDIR%/epub.
+ goto end
+)
+
+if "%1" == "latex" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "latexpdf" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ cd %BUILDDIR%/latex
+ make all-pdf
+ cd %BUILDDIR%/..
+ echo.
+ echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "latexpdfja" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ cd %BUILDDIR%/latex
+ make all-pdf-ja
+ cd %BUILDDIR%/..
+ echo.
+ echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "text" (
+ %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The text files are in %BUILDDIR%/text.
+ goto end
+)
+
+if "%1" == "man" (
+ %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The manual pages are in %BUILDDIR%/man.
+ goto end
+)
+
+if "%1" == "texinfo" (
+ %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
+ goto end
+)
+
+if "%1" == "gettext" (
+ %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
+ goto end
+)
+
+if "%1" == "changes" (
+ %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.The overview file is in %BUILDDIR%/changes.
+ goto end
+)
+
+if "%1" == "linkcheck" (
+ %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+ goto end
+)
+
+if "%1" == "doctest" (
+ %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+ goto end
+)
+
+if "%1" == "xml" (
+ %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The XML files are in %BUILDDIR%/xml.
+ goto end
+)
+
+if "%1" == "pseudoxml" (
+ %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
+ goto end
+)
+
+:end
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/doc/modules.rst b/testing/web-platform/tests/tools/third_party/html5lib/doc/modules.rst
new file mode 100644
index 0000000000..59fbcc86bc
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/doc/modules.rst
@@ -0,0 +1,7 @@
+html5lib
+========
+
+.. toctree::
+ :maxdepth: 4
+
+ html5lib
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/doc/movingparts.rst b/testing/web-platform/tests/tools/third_party/html5lib/doc/movingparts.rst
new file mode 100644
index 0000000000..6ba367a27a
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/doc/movingparts.rst
@@ -0,0 +1,165 @@
+The moving parts
+================
+
+html5lib consists of a number of components, which are responsible for
+handling its features.
+
+Parsing uses a *tree builder* to generate a *tree*, the in-memory representation of the document.
+Several tree representations are supported, as are translations to other formats via *tree adapters*.
+The tree may be translated to a token stream with a *tree walker*, from which :class:`~html5lib.serializer.HTMLSerializer` produces a stream of bytes.
+The token stream may also be transformed by use of *filters* to accomplish tasks like sanitization.
+
+Tree builders
+-------------
+
+The parser reads HTML by tokenizing the content and building a tree that
+the user can later access. html5lib can build three types of trees:
+
+* ``etree`` - this is the default; builds a tree based on :mod:`xml.etree`,
+ which can be found in the standard library. Whenever possible, the
+ accelerated ``ElementTree`` implementation (i.e.
+ ``xml.etree.cElementTree`` on Python 2.x) is used.
+
+* ``dom`` - builds a tree based on :mod:`xml.dom.minidom`.
+
+* ``lxml`` - uses the :mod:`lxml.etree` implementation of the ``ElementTree``
+ API. The performance gains are relatively small compared to using the
+ accelerated ``ElementTree`` module.
+
+You can specify the builder by name when using the shorthand API:
+
+.. code-block:: python
+
+ import html5lib
+ with open("mydocument.html", "rb") as f:
+ lxml_etree_document = html5lib.parse(f, treebuilder="lxml")
+
+To get a builder class by name, use the :func:`~html5lib.treebuilders.getTreeBuilder` function.
+
+When instantiating a :class:`~html5lib.html5parser.HTMLParser` object, you must pass a tree builder class via the ``tree`` keyword attribute:
+
+.. code-block:: python
+
+ import html5lib
+ TreeBuilder = html5lib.getTreeBuilder("dom")
+ parser = html5lib.HTMLParser(tree=TreeBuilder)
+ minidom_document = parser.parse("<p>Hello World!")
+
+The implementation of builders can be found in `html5lib/treebuilders/
+<https://github.com/html5lib/html5lib-python/tree/master/html5lib/treebuilders>`_.
+
+
+Tree walkers
+------------
+
+In addition to manipulating a tree directly, you can use a tree walker to generate a streaming view of it.
+html5lib provides walkers for ``etree``, ``dom``, and ``lxml`` trees, as well as ``genshi`` `markup streams <https://genshi.edgewall.org/wiki/Documentation/streams.html>`_.
+
+The implementation of walkers can be found in `html5lib/treewalkers/
+<https://github.com/html5lib/html5lib-python/tree/master/html5lib/treewalkers>`_.
+
+html5lib provides :class:`~html5lib.serializer.HTMLSerializer` for generating a stream of bytes from a token stream, and several filters which manipulate the stream.
+
+HTMLSerializer
+~~~~~~~~~~~~~~
+
+The serializer lets you write HTML back as a stream of bytes.
+
+.. code-block:: pycon
+
+ >>> import html5lib
+ >>> element = html5lib.parse('<p xml:lang="pl">Witam wszystkich')
+ >>> walker = html5lib.getTreeWalker("etree")
+ >>> stream = walker(element)
+ >>> s = html5lib.serializer.HTMLSerializer()
+ >>> output = s.serialize(stream)
+ >>> for item in output:
+ ... print("%r" % item)
+ '<p'
+ ' '
+ 'xml:lang'
+ '='
+ 'pl'
+ '>'
+ 'Witam wszystkich'
+
+You can customize the serializer behaviour in a variety of ways. Consult
+the :class:`~html5lib.serializer.HTMLSerializer` documentation.
+
+
+Filters
+~~~~~~~
+
+html5lib provides several filters:
+
+* :class:`alphabeticalattributes.Filter
+ <html5lib.filters.alphabeticalattributes.Filter>` sorts attributes on
+ tags to be in alphabetical order
+
+* :class:`inject_meta_charset.Filter
+ <html5lib.filters.inject_meta_charset.Filter>` sets a user-specified
+ encoding in the correct ``<meta>`` tag in the ``<head>`` section of
+ the document
+
+* :class:`lint.Filter <html5lib.filters.lint.Filter>` raises
+ :exc:`AssertionError` exceptions on invalid tag and attribute names, invalid
+ PCDATA, etc.
+
+* :class:`optionaltags.Filter <html5lib.filters.optionaltags.Filter>`
+ removes tags from the token stream which are not necessary to produce valid
+ HTML
+
+* :class:`sanitizer.Filter <html5lib.filters.sanitizer.Filter>` removes
+ unsafe markup and CSS. Elements that are known to be safe are passed
+ through and the rest is converted to visible text. The default
+ configuration of the sanitizer follows the `WHATWG Sanitization Rules
+ <http://wiki.whatwg.org/wiki/Sanitization_rules>`_.
+
+* :class:`whitespace.Filter <html5lib.filters.whitespace.Filter>`
+ collapses all whitespace characters to single spaces unless they're in
+ ``<pre/>`` or ``<textarea/>`` tags.
+
+To use a filter, simply wrap it around a token stream:
+
+.. code-block:: python
+
+ >>> import html5lib
+ >>> from html5lib.filters import sanitizer
+ >>> dom = html5lib.parse("<p><script>alert('Boo!')", treebuilder="dom")
+ >>> walker = html5lib.getTreeWalker("dom")
+ >>> stream = walker(dom)
+ >>> clean_stream = sanitizer.Filter(stream)
+
+
+Tree adapters
+-------------
+
+Tree adapters can be used to translate between tree formats.
+Two adapters are provided by html5lib:
+
+* :func:`html5lib.treeadapters.genshi.to_genshi()` generates a `Genshi markup stream <https://genshi.edgewall.org/wiki/Documentation/streams.html>`_.
+* :func:`html5lib.treeadapters.sax.to_sax()` calls a SAX handler based on the tree.
+
+Encoding discovery
+------------------
+
+Parsed trees are always Unicode. However a large variety of input
+encodings are supported. The encoding of the document is determined in
+the following way:
+
+* The encoding may be explicitly specified by passing the name of the
+ encoding as the encoding parameter to the
+ :meth:`~html5lib.html5parser.HTMLParser.parse` method on
+ :class:`~html5lib.html5parser.HTMLParser` objects.
+
+* If no encoding is specified, the parser will attempt to detect the
+ encoding from a ``<meta>`` element in the first 512 bytes of the
+ document (this is only a partial implementation of the current HTML
+ specification).
+
+* If no encoding can be found and the :mod:`chardet` library is available, an
+ attempt will be made to sniff the encoding from the byte pattern.
+
+* If all else fails, the default encoding will be used. This is usually
+ `Windows-1252 <http://en.wikipedia.org/wiki/Windows-1252>`_, which is
+ a common fallback used by Web browsers.
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/flake8-run.sh b/testing/web-platform/tests/tools/third_party/html5lib/flake8-run.sh
new file mode 100755
index 0000000000..d926494699
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/flake8-run.sh
@@ -0,0 +1,9 @@
+#!/bin/bash -e
+
+if [[ ! -x $(which flake8) ]]; then
+ echo "fatal: flake8 not found on $PATH. Exiting."
+ exit 1
+fi
+
+flake8 `dirname $0`
+exit $?
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/__init__.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/__init__.py
new file mode 100644
index 0000000000..7b854f9900
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/__init__.py
@@ -0,0 +1,35 @@
+"""
+HTML parsing library based on the `WHATWG HTML specification
+<https://whatwg.org/html>`_. The parser is designed to be compatible with
+existing HTML found in the wild and implements well-defined error recovery that
+is largely compatible with modern desktop web browsers.
+
+Example usage::
+
+ import html5lib
+ with open("my_document.html", "rb") as f:
+ tree = html5lib.parse(f)
+
+For convenience, this module re-exports the following names:
+
+* :func:`~.html5parser.parse`
+* :func:`~.html5parser.parseFragment`
+* :class:`~.html5parser.HTMLParser`
+* :func:`~.treebuilders.getTreeBuilder`
+* :func:`~.treewalkers.getTreeWalker`
+* :func:`~.serializer.serialize`
+"""
+
+from __future__ import absolute_import, division, unicode_literals
+
+from .html5parser import HTMLParser, parse, parseFragment
+from .treebuilders import getTreeBuilder
+from .treewalkers import getTreeWalker
+from .serializer import serialize
+
+__all__ = ["HTMLParser", "parse", "parseFragment", "getTreeBuilder",
+ "getTreeWalker", "serialize"]
+
+# this has to be at the top level, see how setup.py parses this
+#: Distribution version number.
+__version__ = "1.2-dev"
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_ihatexml.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_ihatexml.py
new file mode 100644
index 0000000000..3ff803c195
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_ihatexml.py
@@ -0,0 +1,289 @@
+from __future__ import absolute_import, division, unicode_literals
+
+import re
+import warnings
+
+from .constants import DataLossWarning
+
+baseChar = """
+[#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] | [#x00D8-#x00F6] |
+[#x00F8-#x00FF] | [#x0100-#x0131] | [#x0134-#x013E] | [#x0141-#x0148] |
+[#x014A-#x017E] | [#x0180-#x01C3] | [#x01CD-#x01F0] | [#x01F4-#x01F5] |
+[#x01FA-#x0217] | [#x0250-#x02A8] | [#x02BB-#x02C1] | #x0386 |
+[#x0388-#x038A] | #x038C | [#x038E-#x03A1] | [#x03A3-#x03CE] |
+[#x03D0-#x03D6] | #x03DA | #x03DC | #x03DE | #x03E0 | [#x03E2-#x03F3] |
+[#x0401-#x040C] | [#x040E-#x044F] | [#x0451-#x045C] | [#x045E-#x0481] |
+[#x0490-#x04C4] | [#x04C7-#x04C8] | [#x04CB-#x04CC] | [#x04D0-#x04EB] |
+[#x04EE-#x04F5] | [#x04F8-#x04F9] | [#x0531-#x0556] | #x0559 |
+[#x0561-#x0586] | [#x05D0-#x05EA] | [#x05F0-#x05F2] | [#x0621-#x063A] |
+[#x0641-#x064A] | [#x0671-#x06B7] | [#x06BA-#x06BE] | [#x06C0-#x06CE] |
+[#x06D0-#x06D3] | #x06D5 | [#x06E5-#x06E6] | [#x0905-#x0939] | #x093D |
+[#x0958-#x0961] | [#x0985-#x098C] | [#x098F-#x0990] | [#x0993-#x09A8] |
+[#x09AA-#x09B0] | #x09B2 | [#x09B6-#x09B9] | [#x09DC-#x09DD] |
+[#x09DF-#x09E1] | [#x09F0-#x09F1] | [#x0A05-#x0A0A] | [#x0A0F-#x0A10] |
+[#x0A13-#x0A28] | [#x0A2A-#x0A30] | [#x0A32-#x0A33] | [#x0A35-#x0A36] |
+[#x0A38-#x0A39] | [#x0A59-#x0A5C] | #x0A5E | [#x0A72-#x0A74] |
+[#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | [#x0A93-#x0AA8] |
+[#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | #x0ABD | #x0AE0 |
+[#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28] | [#x0B2A-#x0B30] |
+[#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D | [#x0B5C-#x0B5D] |
+[#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90] | [#x0B92-#x0B95] |
+[#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F] | [#x0BA3-#x0BA4] |
+[#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9] | [#x0C05-#x0C0C] |
+[#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33] | [#x0C35-#x0C39] |
+[#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90] | [#x0C92-#x0CA8] |
+[#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE | [#x0CE0-#x0CE1] |
+[#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28] | [#x0D2A-#x0D39] |
+[#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30 | [#x0E32-#x0E33] |
+[#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84 | [#x0E87-#x0E88] | #x0E8A |
+#x0E8D | [#x0E94-#x0E97] | [#x0E99-#x0E9F] | [#x0EA1-#x0EA3] | #x0EA5 |
+#x0EA7 | [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] | #x0EB0 | [#x0EB2-#x0EB3] |
+#x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] | [#x0F49-#x0F69] |
+[#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 | [#x1102-#x1103] |
+[#x1105-#x1107] | #x1109 | [#x110B-#x110C] | [#x110E-#x1112] | #x113C |
+#x113E | #x1140 | #x114C | #x114E | #x1150 | [#x1154-#x1155] | #x1159 |
+[#x115F-#x1161] | #x1163 | #x1165 | #x1167 | #x1169 | [#x116D-#x116E] |
+[#x1172-#x1173] | #x1175 | #x119E | #x11A8 | #x11AB | [#x11AE-#x11AF] |
+[#x11B7-#x11B8] | #x11BA | [#x11BC-#x11C2] | #x11EB | #x11F0 | #x11F9 |
+[#x1E00-#x1E9B] | [#x1EA0-#x1EF9] | [#x1F00-#x1F15] | [#x1F18-#x1F1D] |
+[#x1F20-#x1F45] | [#x1F48-#x1F4D] | [#x1F50-#x1F57] | #x1F59 | #x1F5B |
+#x1F5D | [#x1F5F-#x1F7D] | [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE |
+[#x1FC2-#x1FC4] | [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] |
+[#x1FE0-#x1FEC] | [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 |
+[#x212A-#x212B] | #x212E | [#x2180-#x2182] | [#x3041-#x3094] |
+[#x30A1-#x30FA] | [#x3105-#x312C] | [#xAC00-#xD7A3]"""
+
+ideographic = """[#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]"""
+
+combiningCharacter = """
+[#x0300-#x0345] | [#x0360-#x0361] | [#x0483-#x0486] | [#x0591-#x05A1] |
+[#x05A3-#x05B9] | [#x05BB-#x05BD] | #x05BF | [#x05C1-#x05C2] | #x05C4 |
+[#x064B-#x0652] | #x0670 | [#x06D6-#x06DC] | [#x06DD-#x06DF] |
+[#x06E0-#x06E4] | [#x06E7-#x06E8] | [#x06EA-#x06ED] | [#x0901-#x0903] |
+#x093C | [#x093E-#x094C] | #x094D | [#x0951-#x0954] | [#x0962-#x0963] |
+[#x0981-#x0983] | #x09BC | #x09BE | #x09BF | [#x09C0-#x09C4] |
+[#x09C7-#x09C8] | [#x09CB-#x09CD] | #x09D7 | [#x09E2-#x09E3] | #x0A02 |
+#x0A3C | #x0A3E | #x0A3F | [#x0A40-#x0A42] | [#x0A47-#x0A48] |
+[#x0A4B-#x0A4D] | [#x0A70-#x0A71] | [#x0A81-#x0A83] | #x0ABC |
+[#x0ABE-#x0AC5] | [#x0AC7-#x0AC9] | [#x0ACB-#x0ACD] | [#x0B01-#x0B03] |
+#x0B3C | [#x0B3E-#x0B43] | [#x0B47-#x0B48] | [#x0B4B-#x0B4D] |
+[#x0B56-#x0B57] | [#x0B82-#x0B83] | [#x0BBE-#x0BC2] | [#x0BC6-#x0BC8] |
+[#x0BCA-#x0BCD] | #x0BD7 | [#x0C01-#x0C03] | [#x0C3E-#x0C44] |
+[#x0C46-#x0C48] | [#x0C4A-#x0C4D] | [#x0C55-#x0C56] | [#x0C82-#x0C83] |
+[#x0CBE-#x0CC4] | [#x0CC6-#x0CC8] | [#x0CCA-#x0CCD] | [#x0CD5-#x0CD6] |
+[#x0D02-#x0D03] | [#x0D3E-#x0D43] | [#x0D46-#x0D48] | [#x0D4A-#x0D4D] |
+#x0D57 | #x0E31 | [#x0E34-#x0E3A] | [#x0E47-#x0E4E] | #x0EB1 |
+[#x0EB4-#x0EB9] | [#x0EBB-#x0EBC] | [#x0EC8-#x0ECD] | [#x0F18-#x0F19] |
+#x0F35 | #x0F37 | #x0F39 | #x0F3E | #x0F3F | [#x0F71-#x0F84] |
+[#x0F86-#x0F8B] | [#x0F90-#x0F95] | #x0F97 | [#x0F99-#x0FAD] |
+[#x0FB1-#x0FB7] | #x0FB9 | [#x20D0-#x20DC] | #x20E1 | [#x302A-#x302F] |
+#x3099 | #x309A"""
+
+digit = """
+[#x0030-#x0039] | [#x0660-#x0669] | [#x06F0-#x06F9] | [#x0966-#x096F] |
+[#x09E6-#x09EF] | [#x0A66-#x0A6F] | [#x0AE6-#x0AEF] | [#x0B66-#x0B6F] |
+[#x0BE7-#x0BEF] | [#x0C66-#x0C6F] | [#x0CE6-#x0CEF] | [#x0D66-#x0D6F] |
+[#x0E50-#x0E59] | [#x0ED0-#x0ED9] | [#x0F20-#x0F29]"""
+
+extender = """
+#x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | #x0E46 | #x0EC6 | #x3005 |
+#[#x3031-#x3035] | [#x309D-#x309E] | [#x30FC-#x30FE]"""
+
+letter = " | ".join([baseChar, ideographic])
+
+# Without the
+name = " | ".join([letter, digit, ".", "-", "_", combiningCharacter,
+ extender])
+nameFirst = " | ".join([letter, "_"])
+
+reChar = re.compile(r"#x([\d|A-F]{4,4})")
+reCharRange = re.compile(r"\[#x([\d|A-F]{4,4})-#x([\d|A-F]{4,4})\]")
+
+
+def charStringToList(chars):
+ charRanges = [item.strip() for item in chars.split(" | ")]
+ rv = []
+ for item in charRanges:
+ foundMatch = False
+ for regexp in (reChar, reCharRange):
+ match = regexp.match(item)
+ if match is not None:
+ rv.append([hexToInt(item) for item in match.groups()])
+ if len(rv[-1]) == 1:
+ rv[-1] = rv[-1] * 2
+ foundMatch = True
+ break
+ if not foundMatch:
+ assert len(item) == 1
+
+ rv.append([ord(item)] * 2)
+ rv = normaliseCharList(rv)
+ return rv
+
+
+def normaliseCharList(charList):
+ charList = sorted(charList)
+ for item in charList:
+ assert item[1] >= item[0]
+ rv = []
+ i = 0
+ while i < len(charList):
+ j = 1
+ rv.append(charList[i])
+ while i + j < len(charList) and charList[i + j][0] <= rv[-1][1] + 1:
+ rv[-1][1] = charList[i + j][1]
+ j += 1
+ i += j
+ return rv
+
+
+# We don't really support characters above the BMP :(
+max_unicode = int("FFFF", 16)
+
+
+def missingRanges(charList):
+ rv = []
+ if charList[0] != 0:
+ rv.append([0, charList[0][0] - 1])
+ for i, item in enumerate(charList[:-1]):
+ rv.append([item[1] + 1, charList[i + 1][0] - 1])
+ if charList[-1][1] != max_unicode:
+ rv.append([charList[-1][1] + 1, max_unicode])
+ return rv
+
+
+def listToRegexpStr(charList):
+ rv = []
+ for item in charList:
+ if item[0] == item[1]:
+ rv.append(escapeRegexp(chr(item[0])))
+ else:
+ rv.append(escapeRegexp(chr(item[0])) + "-" +
+ escapeRegexp(chr(item[1])))
+ return "[%s]" % "".join(rv)
+
+
+def hexToInt(hex_str):
+ return int(hex_str, 16)
+
+
+def escapeRegexp(string):
+ specialCharacters = (".", "^", "$", "*", "+", "?", "{", "}",
+ "[", "]", "|", "(", ")", "-")
+ for char in specialCharacters:
+ string = string.replace(char, "\\" + char)
+
+ return string
+
+# output from the above
+nonXmlNameBMPRegexp = re.compile('[\x00-,/:-@\\[-\\^`\\{-\xb6\xb8-\xbf\xd7\xf7\u0132-\u0133\u013f-\u0140\u0149\u017f\u01c4-\u01cc\u01f1-\u01f3\u01f6-\u01f9\u0218-\u024f\u02a9-\u02ba\u02c2-\u02cf\u02d2-\u02ff\u0346-\u035f\u0362-\u0385\u038b\u038d\u03a2\u03cf\u03d7-\u03d9\u03db\u03dd\u03df\u03e1\u03f4-\u0400\u040d\u0450\u045d\u0482\u0487-\u048f\u04c5-\u04c6\u04c9-\u04ca\u04cd-\u04cf\u04ec-\u04ed\u04f6-\u04f7\u04fa-\u0530\u0557-\u0558\u055a-\u0560\u0587-\u0590\u05a2\u05ba\u05be\u05c0\u05c3\u05c5-\u05cf\u05eb-\u05ef\u05f3-\u0620\u063b-\u063f\u0653-\u065f\u066a-\u066f\u06b8-\u06b9\u06bf\u06cf\u06d4\u06e9\u06ee-\u06ef\u06fa-\u0900\u0904\u093a-\u093b\u094e-\u0950\u0955-\u0957\u0964-\u0965\u0970-\u0980\u0984\u098d-\u098e\u0991-\u0992\u09a9\u09b1\u09b3-\u09b5\u09ba-\u09bb\u09bd\u09c5-\u09c6\u09c9-\u09ca\u09ce-\u09d6\u09d8-\u09db\u09de\u09e4-\u09e5\u09f2-\u0a01\u0a03-\u0a04\u0a0b-\u0a0e\u0a11-\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a-\u0a3b\u0a3d\u0a43-\u0a46\u0a49-\u0a4a\u0a4e-\u0a58\u0a5d\u0a5f-\u0a65\u0a75-\u0a80\u0a84\u0a8c\u0a8e\u0a92\u0aa9\u0ab1\u0ab4\u0aba-\u0abb\u0ac6\u0aca\u0ace-\u0adf\u0ae1-\u0ae5\u0af0-\u0b00\u0b04\u0b0d-\u0b0e\u0b11-\u0b12\u0b29\u0b31\u0b34-\u0b35\u0b3a-\u0b3b\u0b44-\u0b46\u0b49-\u0b4a\u0b4e-\u0b55\u0b58-\u0b5b\u0b5e\u0b62-\u0b65\u0b70-\u0b81\u0b84\u0b8b-\u0b8d\u0b91\u0b96-\u0b98\u0b9b\u0b9d\u0ba0-\u0ba2\u0ba5-\u0ba7\u0bab-\u0bad\u0bb6\u0bba-\u0bbd\u0bc3-\u0bc5\u0bc9\u0bce-\u0bd6\u0bd8-\u0be6\u0bf0-\u0c00\u0c04\u0c0d\u0c11\u0c29\u0c34\u0c3a-\u0c3d\u0c45\u0c49\u0c4e-\u0c54\u0c57-\u0c5f\u0c62-\u0c65\u0c70-\u0c81\u0c84\u0c8d\u0c91\u0ca9\u0cb4\u0cba-\u0cbd\u0cc5\u0cc9\u0cce-\u0cd4\u0cd7-\u0cdd\u0cdf\u0ce2-\u0ce5\u0cf0-\u0d01\u0d04\u0d0d\u0d11\u0d29\u0d3a-\u0d3d\u0d44-\u0d45\u0d49\u0d4e-\u0d56\u0d58-\u0d5f\u0d62-\u0d65\u0d70-\u0e00\u0e2f\u0e3b-\u0e3f\u0e4f\u0e5a-\u0e80\u0e83\u0e85-\u0e86\u0e89\u0e8b-\u0e8c\u0e8e-\u0e93\u0e98\u0ea0\u0ea4\u0ea6\u0ea8-\u0ea9\u0eac\u0eaf\u0eba\u0ebe-\u0ebf\u0ec5\u0ec7\u0ece-\u0ecf\u0eda-\u0f17\u0f1a-\u0f1f\u0f2a-\u0f34\u0f36\u0f38\u0f3a-\u0f3d\u0f48\u0f6a-\u0f70\u0f85\u0f8c-\u0f8f\u0f96\u0f98\u0fae-\u0fb0\u0fb8\u0fba-\u109f\u10c6-\u10cf\u10f7-\u10ff\u1101\u1104\u1108\u110a\u110d\u1113-\u113b\u113d\u113f\u1141-\u114b\u114d\u114f\u1151-\u1153\u1156-\u1158\u115a-\u115e\u1162\u1164\u1166\u1168\u116a-\u116c\u116f-\u1171\u1174\u1176-\u119d\u119f-\u11a7\u11a9-\u11aa\u11ac-\u11ad\u11b0-\u11b6\u11b9\u11bb\u11c3-\u11ea\u11ec-\u11ef\u11f1-\u11f8\u11fa-\u1dff\u1e9c-\u1e9f\u1efa-\u1eff\u1f16-\u1f17\u1f1e-\u1f1f\u1f46-\u1f47\u1f4e-\u1f4f\u1f58\u1f5a\u1f5c\u1f5e\u1f7e-\u1f7f\u1fb5\u1fbd\u1fbf-\u1fc1\u1fc5\u1fcd-\u1fcf\u1fd4-\u1fd5\u1fdc-\u1fdf\u1fed-\u1ff1\u1ff5\u1ffd-\u20cf\u20dd-\u20e0\u20e2-\u2125\u2127-\u2129\u212c-\u212d\u212f-\u217f\u2183-\u3004\u3006\u3008-\u3020\u3030\u3036-\u3040\u3095-\u3098\u309b-\u309c\u309f-\u30a0\u30fb\u30ff-\u3104\u312d-\u4dff\u9fa6-\uabff\ud7a4-\uffff]') # noqa
+
+nonXmlNameFirstBMPRegexp = re.compile('[\x00-@\\[-\\^`\\{-\xbf\xd7\xf7\u0132-\u0133\u013f-\u0140\u0149\u017f\u01c4-\u01cc\u01f1-\u01f3\u01f6-\u01f9\u0218-\u024f\u02a9-\u02ba\u02c2-\u0385\u0387\u038b\u038d\u03a2\u03cf\u03d7-\u03d9\u03db\u03dd\u03df\u03e1\u03f4-\u0400\u040d\u0450\u045d\u0482-\u048f\u04c5-\u04c6\u04c9-\u04ca\u04cd-\u04cf\u04ec-\u04ed\u04f6-\u04f7\u04fa-\u0530\u0557-\u0558\u055a-\u0560\u0587-\u05cf\u05eb-\u05ef\u05f3-\u0620\u063b-\u0640\u064b-\u0670\u06b8-\u06b9\u06bf\u06cf\u06d4\u06d6-\u06e4\u06e7-\u0904\u093a-\u093c\u093e-\u0957\u0962-\u0984\u098d-\u098e\u0991-\u0992\u09a9\u09b1\u09b3-\u09b5\u09ba-\u09db\u09de\u09e2-\u09ef\u09f2-\u0a04\u0a0b-\u0a0e\u0a11-\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a-\u0a58\u0a5d\u0a5f-\u0a71\u0a75-\u0a84\u0a8c\u0a8e\u0a92\u0aa9\u0ab1\u0ab4\u0aba-\u0abc\u0abe-\u0adf\u0ae1-\u0b04\u0b0d-\u0b0e\u0b11-\u0b12\u0b29\u0b31\u0b34-\u0b35\u0b3a-\u0b3c\u0b3e-\u0b5b\u0b5e\u0b62-\u0b84\u0b8b-\u0b8d\u0b91\u0b96-\u0b98\u0b9b\u0b9d\u0ba0-\u0ba2\u0ba5-\u0ba7\u0bab-\u0bad\u0bb6\u0bba-\u0c04\u0c0d\u0c11\u0c29\u0c34\u0c3a-\u0c5f\u0c62-\u0c84\u0c8d\u0c91\u0ca9\u0cb4\u0cba-\u0cdd\u0cdf\u0ce2-\u0d04\u0d0d\u0d11\u0d29\u0d3a-\u0d5f\u0d62-\u0e00\u0e2f\u0e31\u0e34-\u0e3f\u0e46-\u0e80\u0e83\u0e85-\u0e86\u0e89\u0e8b-\u0e8c\u0e8e-\u0e93\u0e98\u0ea0\u0ea4\u0ea6\u0ea8-\u0ea9\u0eac\u0eaf\u0eb1\u0eb4-\u0ebc\u0ebe-\u0ebf\u0ec5-\u0f3f\u0f48\u0f6a-\u109f\u10c6-\u10cf\u10f7-\u10ff\u1101\u1104\u1108\u110a\u110d\u1113-\u113b\u113d\u113f\u1141-\u114b\u114d\u114f\u1151-\u1153\u1156-\u1158\u115a-\u115e\u1162\u1164\u1166\u1168\u116a-\u116c\u116f-\u1171\u1174\u1176-\u119d\u119f-\u11a7\u11a9-\u11aa\u11ac-\u11ad\u11b0-\u11b6\u11b9\u11bb\u11c3-\u11ea\u11ec-\u11ef\u11f1-\u11f8\u11fa-\u1dff\u1e9c-\u1e9f\u1efa-\u1eff\u1f16-\u1f17\u1f1e-\u1f1f\u1f46-\u1f47\u1f4e-\u1f4f\u1f58\u1f5a\u1f5c\u1f5e\u1f7e-\u1f7f\u1fb5\u1fbd\u1fbf-\u1fc1\u1fc5\u1fcd-\u1fcf\u1fd4-\u1fd5\u1fdc-\u1fdf\u1fed-\u1ff1\u1ff5\u1ffd-\u2125\u2127-\u2129\u212c-\u212d\u212f-\u217f\u2183-\u3006\u3008-\u3020\u302a-\u3040\u3095-\u30a0\u30fb-\u3104\u312d-\u4dff\u9fa6-\uabff\ud7a4-\uffff]') # noqa
+
+# Simpler things
+nonPubidCharRegexp = re.compile("[^\x20\x0D\x0Aa-zA-Z0-9\\-'()+,./:=?;!*#@$_%]")
+
+
+class InfosetFilter(object):
+ replacementRegexp = re.compile(r"U[\dA-F]{5,5}")
+
+ def __init__(self,
+ dropXmlnsLocalName=False,
+ dropXmlnsAttrNs=False,
+ preventDoubleDashComments=False,
+ preventDashAtCommentEnd=False,
+ replaceFormFeedCharacters=True,
+ preventSingleQuotePubid=False):
+
+ self.dropXmlnsLocalName = dropXmlnsLocalName
+ self.dropXmlnsAttrNs = dropXmlnsAttrNs
+
+ self.preventDoubleDashComments = preventDoubleDashComments
+ self.preventDashAtCommentEnd = preventDashAtCommentEnd
+
+ self.replaceFormFeedCharacters = replaceFormFeedCharacters
+
+ self.preventSingleQuotePubid = preventSingleQuotePubid
+
+ self.replaceCache = {}
+
+ def coerceAttribute(self, name, namespace=None):
+ if self.dropXmlnsLocalName and name.startswith("xmlns:"):
+ warnings.warn("Attributes cannot begin with xmlns", DataLossWarning)
+ return None
+ elif (self.dropXmlnsAttrNs and
+ namespace == "http://www.w3.org/2000/xmlns/"):
+ warnings.warn("Attributes cannot be in the xml namespace", DataLossWarning)
+ return None
+ else:
+ return self.toXmlName(name)
+
+ def coerceElement(self, name):
+ return self.toXmlName(name)
+
+ def coerceComment(self, data):
+ if self.preventDoubleDashComments:
+ while "--" in data:
+ warnings.warn("Comments cannot contain adjacent dashes", DataLossWarning)
+ data = data.replace("--", "- -")
+ if data.endswith("-"):
+ warnings.warn("Comments cannot end in a dash", DataLossWarning)
+ data += " "
+ return data
+
+ def coerceCharacters(self, data):
+ if self.replaceFormFeedCharacters:
+ for _ in range(data.count("\x0C")):
+ warnings.warn("Text cannot contain U+000C", DataLossWarning)
+ data = data.replace("\x0C", " ")
+ # Other non-xml characters
+ return data
+
+ def coercePubid(self, data):
+ dataOutput = data
+ for char in nonPubidCharRegexp.findall(data):
+ warnings.warn("Coercing non-XML pubid", DataLossWarning)
+ replacement = self.getReplacementCharacter(char)
+ dataOutput = dataOutput.replace(char, replacement)
+ if self.preventSingleQuotePubid and dataOutput.find("'") >= 0:
+ warnings.warn("Pubid cannot contain single quote", DataLossWarning)
+ dataOutput = dataOutput.replace("'", self.getReplacementCharacter("'"))
+ return dataOutput
+
+ def toXmlName(self, name):
+ nameFirst = name[0]
+ nameRest = name[1:]
+ m = nonXmlNameFirstBMPRegexp.match(nameFirst)
+ if m:
+ warnings.warn("Coercing non-XML name: %s" % name, DataLossWarning)
+ nameFirstOutput = self.getReplacementCharacter(nameFirst)
+ else:
+ nameFirstOutput = nameFirst
+
+ nameRestOutput = nameRest
+ replaceChars = set(nonXmlNameBMPRegexp.findall(nameRest))
+ for char in replaceChars:
+ warnings.warn("Coercing non-XML name: %s" % name, DataLossWarning)
+ replacement = self.getReplacementCharacter(char)
+ nameRestOutput = nameRestOutput.replace(char, replacement)
+ return nameFirstOutput + nameRestOutput
+
+ def getReplacementCharacter(self, char):
+ if char in self.replaceCache:
+ replacement = self.replaceCache[char]
+ else:
+ replacement = self.escapeChar(char)
+ return replacement
+
+ def fromXmlName(self, name):
+ for item in set(self.replacementRegexp.findall(name)):
+ name = name.replace(item, self.unescapeChar(item))
+ return name
+
+ def escapeChar(self, char):
+ replacement = "U%05X" % ord(char)
+ self.replaceCache[char] = replacement
+ return replacement
+
+ def unescapeChar(self, charcode):
+ return chr(int(charcode[1:], 16))
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_inputstream.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_inputstream.py
new file mode 100644
index 0000000000..0207dd211b
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_inputstream.py
@@ -0,0 +1,918 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from six import text_type
+from six.moves import http_client, urllib
+
+import codecs
+import re
+from io import BytesIO, StringIO
+
+import webencodings
+
+from .constants import EOF, spaceCharacters, asciiLetters, asciiUppercase
+from .constants import _ReparseException
+from . import _utils
+
+# Non-unicode versions of constants for use in the pre-parser
+spaceCharactersBytes = frozenset([item.encode("ascii") for item in spaceCharacters])
+asciiLettersBytes = frozenset([item.encode("ascii") for item in asciiLetters])
+asciiUppercaseBytes = frozenset([item.encode("ascii") for item in asciiUppercase])
+spacesAngleBrackets = spaceCharactersBytes | frozenset([b">", b"<"])
+
+
+invalid_unicode_no_surrogate = "[\u0001-\u0008\u000B\u000E-\u001F\u007F-\u009F\uFDD0-\uFDEF\uFFFE\uFFFF\U0001FFFE\U0001FFFF\U0002FFFE\U0002FFFF\U0003FFFE\U0003FFFF\U0004FFFE\U0004FFFF\U0005FFFE\U0005FFFF\U0006FFFE\U0006FFFF\U0007FFFE\U0007FFFF\U0008FFFE\U0008FFFF\U0009FFFE\U0009FFFF\U000AFFFE\U000AFFFF\U000BFFFE\U000BFFFF\U000CFFFE\U000CFFFF\U000DFFFE\U000DFFFF\U000EFFFE\U000EFFFF\U000FFFFE\U000FFFFF\U0010FFFE\U0010FFFF]" # noqa
+
+if _utils.supports_lone_surrogates:
+ # Use one extra step of indirection and create surrogates with
+ # eval. Not using this indirection would introduce an illegal
+ # unicode literal on platforms not supporting such lone
+ # surrogates.
+ assert invalid_unicode_no_surrogate[-1] == "]" and invalid_unicode_no_surrogate.count("]") == 1
+ invalid_unicode_re = re.compile(invalid_unicode_no_surrogate[:-1] +
+ eval('"\\uD800-\\uDFFF"') + # pylint:disable=eval-used
+ "]")
+else:
+ invalid_unicode_re = re.compile(invalid_unicode_no_surrogate)
+
+non_bmp_invalid_codepoints = {0x1FFFE, 0x1FFFF, 0x2FFFE, 0x2FFFF, 0x3FFFE,
+ 0x3FFFF, 0x4FFFE, 0x4FFFF, 0x5FFFE, 0x5FFFF,
+ 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE,
+ 0x8FFFF, 0x9FFFE, 0x9FFFF, 0xAFFFE, 0xAFFFF,
+ 0xBFFFE, 0xBFFFF, 0xCFFFE, 0xCFFFF, 0xDFFFE,
+ 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE, 0xFFFFF,
+ 0x10FFFE, 0x10FFFF}
+
+ascii_punctuation_re = re.compile("[\u0009-\u000D\u0020-\u002F\u003A-\u0040\u005C\u005B-\u0060\u007B-\u007E]")
+
+# Cache for charsUntil()
+charsUntilRegEx = {}
+
+
+class BufferedStream(object):
+ """Buffering for streams that do not have buffering of their own
+
+ The buffer is implemented as a list of chunks on the assumption that
+ joining many strings will be slow since it is O(n**2)
+ """
+
+ def __init__(self, stream):
+ self.stream = stream
+ self.buffer = []
+ self.position = [-1, 0] # chunk number, offset
+
+ def tell(self):
+ pos = 0
+ for chunk in self.buffer[:self.position[0]]:
+ pos += len(chunk)
+ pos += self.position[1]
+ return pos
+
+ def seek(self, pos):
+ assert pos <= self._bufferedBytes()
+ offset = pos
+ i = 0
+ while len(self.buffer[i]) < offset:
+ offset -= len(self.buffer[i])
+ i += 1
+ self.position = [i, offset]
+
+ def read(self, bytes):
+ if not self.buffer:
+ return self._readStream(bytes)
+ elif (self.position[0] == len(self.buffer) and
+ self.position[1] == len(self.buffer[-1])):
+ return self._readStream(bytes)
+ else:
+ return self._readFromBuffer(bytes)
+
+ def _bufferedBytes(self):
+ return sum([len(item) for item in self.buffer])
+
+ def _readStream(self, bytes):
+ data = self.stream.read(bytes)
+ self.buffer.append(data)
+ self.position[0] += 1
+ self.position[1] = len(data)
+ return data
+
+ def _readFromBuffer(self, bytes):
+ remainingBytes = bytes
+ rv = []
+ bufferIndex = self.position[0]
+ bufferOffset = self.position[1]
+ while bufferIndex < len(self.buffer) and remainingBytes != 0:
+ assert remainingBytes > 0
+ bufferedData = self.buffer[bufferIndex]
+
+ if remainingBytes <= len(bufferedData) - bufferOffset:
+ bytesToRead = remainingBytes
+ self.position = [bufferIndex, bufferOffset + bytesToRead]
+ else:
+ bytesToRead = len(bufferedData) - bufferOffset
+ self.position = [bufferIndex, len(bufferedData)]
+ bufferIndex += 1
+ rv.append(bufferedData[bufferOffset:bufferOffset + bytesToRead])
+ remainingBytes -= bytesToRead
+
+ bufferOffset = 0
+
+ if remainingBytes:
+ rv.append(self._readStream(remainingBytes))
+
+ return b"".join(rv)
+
+
+def HTMLInputStream(source, **kwargs):
+ # Work around Python bug #20007: read(0) closes the connection.
+ # http://bugs.python.org/issue20007
+ if (isinstance(source, http_client.HTTPResponse) or
+ # Also check for addinfourl wrapping HTTPResponse
+ (isinstance(source, urllib.response.addbase) and
+ isinstance(source.fp, http_client.HTTPResponse))):
+ isUnicode = False
+ elif hasattr(source, "read"):
+ isUnicode = isinstance(source.read(0), text_type)
+ else:
+ isUnicode = isinstance(source, text_type)
+
+ if isUnicode:
+ encodings = [x for x in kwargs if x.endswith("_encoding")]
+ if encodings:
+ raise TypeError("Cannot set an encoding with a unicode input, set %r" % encodings)
+
+ return HTMLUnicodeInputStream(source, **kwargs)
+ else:
+ return HTMLBinaryInputStream(source, **kwargs)
+
+
+class HTMLUnicodeInputStream(object):
+ """Provides a unicode stream of characters to the HTMLTokenizer.
+
+ This class takes care of character encoding and removing or replacing
+ incorrect byte-sequences and also provides column and line tracking.
+
+ """
+
+ _defaultChunkSize = 10240
+
+ def __init__(self, source):
+ """Initialises the HTMLInputStream.
+
+ HTMLInputStream(source, [encoding]) -> Normalized stream from source
+ for use by html5lib.
+
+ source can be either a file-object, local filename or a string.
+
+ The optional encoding parameter must be a string that indicates
+ the encoding. If specified, that encoding will be used,
+ regardless of any BOM or later declaration (such as in a meta
+ element)
+
+ """
+
+ if not _utils.supports_lone_surrogates:
+ # Such platforms will have already checked for such
+ # surrogate errors, so no need to do this checking.
+ self.reportCharacterErrors = None
+ elif len("\U0010FFFF") == 1:
+ self.reportCharacterErrors = self.characterErrorsUCS4
+ else:
+ self.reportCharacterErrors = self.characterErrorsUCS2
+
+ # List of where new lines occur
+ self.newLines = [0]
+
+ self.charEncoding = (lookupEncoding("utf-8"), "certain")
+ self.dataStream = self.openStream(source)
+
+ self.reset()
+
+ def reset(self):
+ self.chunk = ""
+ self.chunkSize = 0
+ self.chunkOffset = 0
+ self.errors = []
+
+ # number of (complete) lines in previous chunks
+ self.prevNumLines = 0
+ # number of columns in the last line of the previous chunk
+ self.prevNumCols = 0
+
+ # Deal with CR LF and surrogates split over chunk boundaries
+ self._bufferedCharacter = None
+
+ def openStream(self, source):
+ """Produces a file object from source.
+
+ source can be either a file object, local filename or a string.
+
+ """
+ # Already a file object
+ if hasattr(source, 'read'):
+ stream = source
+ else:
+ stream = StringIO(source)
+
+ return stream
+
+ def _position(self, offset):
+ chunk = self.chunk
+ nLines = chunk.count('\n', 0, offset)
+ positionLine = self.prevNumLines + nLines
+ lastLinePos = chunk.rfind('\n', 0, offset)
+ if lastLinePos == -1:
+ positionColumn = self.prevNumCols + offset
+ else:
+ positionColumn = offset - (lastLinePos + 1)
+ return (positionLine, positionColumn)
+
+ def position(self):
+ """Returns (line, col) of the current position in the stream."""
+ line, col = self._position(self.chunkOffset)
+ return (line + 1, col)
+
+ def char(self):
+ """ Read one character from the stream or queue if available. Return
+ EOF when EOF is reached.
+ """
+ # Read a new chunk from the input stream if necessary
+ if self.chunkOffset >= self.chunkSize:
+ if not self.readChunk():
+ return EOF
+
+ chunkOffset = self.chunkOffset
+ char = self.chunk[chunkOffset]
+ self.chunkOffset = chunkOffset + 1
+
+ return char
+
+ def readChunk(self, chunkSize=None):
+ if chunkSize is None:
+ chunkSize = self._defaultChunkSize
+
+ self.prevNumLines, self.prevNumCols = self._position(self.chunkSize)
+
+ self.chunk = ""
+ self.chunkSize = 0
+ self.chunkOffset = 0
+
+ data = self.dataStream.read(chunkSize)
+
+ # Deal with CR LF and surrogates broken across chunks
+ if self._bufferedCharacter:
+ data = self._bufferedCharacter + data
+ self._bufferedCharacter = None
+ elif not data:
+ # We have no more data, bye-bye stream
+ return False
+
+ if len(data) > 1:
+ lastv = ord(data[-1])
+ if lastv == 0x0D or 0xD800 <= lastv <= 0xDBFF:
+ self._bufferedCharacter = data[-1]
+ data = data[:-1]
+
+ if self.reportCharacterErrors:
+ self.reportCharacterErrors(data)
+
+ # Replace invalid characters
+ data = data.replace("\r\n", "\n")
+ data = data.replace("\r", "\n")
+
+ self.chunk = data
+ self.chunkSize = len(data)
+
+ return True
+
+ def characterErrorsUCS4(self, data):
+ for _ in range(len(invalid_unicode_re.findall(data))):
+ self.errors.append("invalid-codepoint")
+
+ def characterErrorsUCS2(self, data):
+ # Someone picked the wrong compile option
+ # You lose
+ skip = False
+ for match in invalid_unicode_re.finditer(data):
+ if skip:
+ continue
+ codepoint = ord(match.group())
+ pos = match.start()
+ # Pretty sure there should be endianness issues here
+ if _utils.isSurrogatePair(data[pos:pos + 2]):
+ # We have a surrogate pair!
+ char_val = _utils.surrogatePairToCodepoint(data[pos:pos + 2])
+ if char_val in non_bmp_invalid_codepoints:
+ self.errors.append("invalid-codepoint")
+ skip = True
+ elif (codepoint >= 0xD800 and codepoint <= 0xDFFF and
+ pos == len(data) - 1):
+ self.errors.append("invalid-codepoint")
+ else:
+ skip = False
+ self.errors.append("invalid-codepoint")
+
+ def charsUntil(self, characters, opposite=False):
+ """ Returns a string of characters from the stream up to but not
+ including any character in 'characters' or EOF. 'characters' must be
+ a container that supports the 'in' method and iteration over its
+ characters.
+ """
+
+ # Use a cache of regexps to find the required characters
+ try:
+ chars = charsUntilRegEx[(characters, opposite)]
+ except KeyError:
+ if __debug__:
+ for c in characters:
+ assert(ord(c) < 128)
+ regex = "".join(["\\x%02x" % ord(c) for c in characters])
+ if not opposite:
+ regex = "^%s" % regex
+ chars = charsUntilRegEx[(characters, opposite)] = re.compile("[%s]+" % regex)
+
+ rv = []
+
+ while True:
+ # Find the longest matching prefix
+ m = chars.match(self.chunk, self.chunkOffset)
+ if m is None:
+ # If nothing matched, and it wasn't because we ran out of chunk,
+ # then stop
+ if self.chunkOffset != self.chunkSize:
+ break
+ else:
+ end = m.end()
+ # If not the whole chunk matched, return everything
+ # up to the part that didn't match
+ if end != self.chunkSize:
+ rv.append(self.chunk[self.chunkOffset:end])
+ self.chunkOffset = end
+ break
+ # If the whole remainder of the chunk matched,
+ # use it all and read the next chunk
+ rv.append(self.chunk[self.chunkOffset:])
+ if not self.readChunk():
+ # Reached EOF
+ break
+
+ r = "".join(rv)
+ return r
+
+ def unget(self, char):
+ # Only one character is allowed to be ungotten at once - it must
+ # be consumed again before any further call to unget
+ if char is not EOF:
+ if self.chunkOffset == 0:
+ # unget is called quite rarely, so it's a good idea to do
+ # more work here if it saves a bit of work in the frequently
+ # called char and charsUntil.
+ # So, just prepend the ungotten character onto the current
+ # chunk:
+ self.chunk = char + self.chunk
+ self.chunkSize += 1
+ else:
+ self.chunkOffset -= 1
+ assert self.chunk[self.chunkOffset] == char
+
+
+class HTMLBinaryInputStream(HTMLUnicodeInputStream):
+ """Provides a unicode stream of characters to the HTMLTokenizer.
+
+ This class takes care of character encoding and removing or replacing
+ incorrect byte-sequences and also provides column and line tracking.
+
+ """
+
+ def __init__(self, source, override_encoding=None, transport_encoding=None,
+ same_origin_parent_encoding=None, likely_encoding=None,
+ default_encoding="windows-1252", useChardet=True):
+ """Initialises the HTMLInputStream.
+
+ HTMLInputStream(source, [encoding]) -> Normalized stream from source
+ for use by html5lib.
+
+ source can be either a file-object, local filename or a string.
+
+ The optional encoding parameter must be a string that indicates
+ the encoding. If specified, that encoding will be used,
+ regardless of any BOM or later declaration (such as in a meta
+ element)
+
+ """
+ # Raw Stream - for unicode objects this will encode to utf-8 and set
+ # self.charEncoding as appropriate
+ self.rawStream = self.openStream(source)
+
+ HTMLUnicodeInputStream.__init__(self, self.rawStream)
+
+ # Encoding Information
+ # Number of bytes to use when looking for a meta element with
+ # encoding information
+ self.numBytesMeta = 1024
+ # Number of bytes to use when using detecting encoding using chardet
+ self.numBytesChardet = 100
+ # Things from args
+ self.override_encoding = override_encoding
+ self.transport_encoding = transport_encoding
+ self.same_origin_parent_encoding = same_origin_parent_encoding
+ self.likely_encoding = likely_encoding
+ self.default_encoding = default_encoding
+
+ # Determine encoding
+ self.charEncoding = self.determineEncoding(useChardet)
+ assert self.charEncoding[0] is not None
+
+ # Call superclass
+ self.reset()
+
+ def reset(self):
+ self.dataStream = self.charEncoding[0].codec_info.streamreader(self.rawStream, 'replace')
+ HTMLUnicodeInputStream.reset(self)
+
+ def openStream(self, source):
+ """Produces a file object from source.
+
+ source can be either a file object, local filename or a string.
+
+ """
+ # Already a file object
+ if hasattr(source, 'read'):
+ stream = source
+ else:
+ stream = BytesIO(source)
+
+ try:
+ stream.seek(stream.tell())
+ except Exception:
+ stream = BufferedStream(stream)
+
+ return stream
+
+ def determineEncoding(self, chardet=True):
+ # BOMs take precedence over everything
+ # This will also read past the BOM if present
+ charEncoding = self.detectBOM(), "certain"
+ if charEncoding[0] is not None:
+ return charEncoding
+
+ # If we've been overridden, we've been overridden
+ charEncoding = lookupEncoding(self.override_encoding), "certain"
+ if charEncoding[0] is not None:
+ return charEncoding
+
+ # Now check the transport layer
+ charEncoding = lookupEncoding(self.transport_encoding), "certain"
+ if charEncoding[0] is not None:
+ return charEncoding
+
+ # Look for meta elements with encoding information
+ charEncoding = self.detectEncodingMeta(), "tentative"
+ if charEncoding[0] is not None:
+ return charEncoding
+
+ # Parent document encoding
+ charEncoding = lookupEncoding(self.same_origin_parent_encoding), "tentative"
+ if charEncoding[0] is not None and not charEncoding[0].name.startswith("utf-16"):
+ return charEncoding
+
+ # "likely" encoding
+ charEncoding = lookupEncoding(self.likely_encoding), "tentative"
+ if charEncoding[0] is not None:
+ return charEncoding
+
+ # Guess with chardet, if available
+ if chardet:
+ try:
+ from chardet.universaldetector import UniversalDetector
+ except ImportError:
+ pass
+ else:
+ buffers = []
+ detector = UniversalDetector()
+ while not detector.done:
+ buffer = self.rawStream.read(self.numBytesChardet)
+ assert isinstance(buffer, bytes)
+ if not buffer:
+ break
+ buffers.append(buffer)
+ detector.feed(buffer)
+ detector.close()
+ encoding = lookupEncoding(detector.result['encoding'])
+ self.rawStream.seek(0)
+ if encoding is not None:
+ return encoding, "tentative"
+
+ # Try the default encoding
+ charEncoding = lookupEncoding(self.default_encoding), "tentative"
+ if charEncoding[0] is not None:
+ return charEncoding
+
+ # Fallback to html5lib's default if even that hasn't worked
+ return lookupEncoding("windows-1252"), "tentative"
+
+ def changeEncoding(self, newEncoding):
+ assert self.charEncoding[1] != "certain"
+ newEncoding = lookupEncoding(newEncoding)
+ if newEncoding is None:
+ return
+ if newEncoding.name in ("utf-16be", "utf-16le"):
+ newEncoding = lookupEncoding("utf-8")
+ assert newEncoding is not None
+ elif newEncoding == self.charEncoding[0]:
+ self.charEncoding = (self.charEncoding[0], "certain")
+ else:
+ self.rawStream.seek(0)
+ self.charEncoding = (newEncoding, "certain")
+ self.reset()
+ raise _ReparseException("Encoding changed from %s to %s" % (self.charEncoding[0], newEncoding))
+
+ def detectBOM(self):
+ """Attempts to detect at BOM at the start of the stream. If
+ an encoding can be determined from the BOM return the name of the
+ encoding otherwise return None"""
+ bomDict = {
+ codecs.BOM_UTF8: 'utf-8',
+ codecs.BOM_UTF16_LE: 'utf-16le', codecs.BOM_UTF16_BE: 'utf-16be',
+ codecs.BOM_UTF32_LE: 'utf-32le', codecs.BOM_UTF32_BE: 'utf-32be'
+ }
+
+ # Go to beginning of file and read in 4 bytes
+ string = self.rawStream.read(4)
+ assert isinstance(string, bytes)
+
+ # Try detecting the BOM using bytes from the string
+ encoding = bomDict.get(string[:3]) # UTF-8
+ seek = 3
+ if not encoding:
+ # Need to detect UTF-32 before UTF-16
+ encoding = bomDict.get(string) # UTF-32
+ seek = 4
+ if not encoding:
+ encoding = bomDict.get(string[:2]) # UTF-16
+ seek = 2
+
+ # Set the read position past the BOM if one was found, otherwise
+ # set it to the start of the stream
+ if encoding:
+ self.rawStream.seek(seek)
+ return lookupEncoding(encoding)
+ else:
+ self.rawStream.seek(0)
+ return None
+
+ def detectEncodingMeta(self):
+ """Report the encoding declared by the meta element
+ """
+ buffer = self.rawStream.read(self.numBytesMeta)
+ assert isinstance(buffer, bytes)
+ parser = EncodingParser(buffer)
+ self.rawStream.seek(0)
+ encoding = parser.getEncoding()
+
+ if encoding is not None and encoding.name in ("utf-16be", "utf-16le"):
+ encoding = lookupEncoding("utf-8")
+
+ return encoding
+
+
+class EncodingBytes(bytes):
+ """String-like object with an associated position and various extra methods
+ If the position is ever greater than the string length then an exception is
+ raised"""
+ def __new__(self, value):
+ assert isinstance(value, bytes)
+ return bytes.__new__(self, value.lower())
+
+ def __init__(self, value):
+ # pylint:disable=unused-argument
+ self._position = -1
+
+ def __iter__(self):
+ return self
+
+ def __next__(self):
+ p = self._position = self._position + 1
+ if p >= len(self):
+ raise StopIteration
+ elif p < 0:
+ raise TypeError
+ return self[p:p + 1]
+
+ def next(self):
+ # Py2 compat
+ return self.__next__()
+
+ def previous(self):
+ p = self._position
+ if p >= len(self):
+ raise StopIteration
+ elif p < 0:
+ raise TypeError
+ self._position = p = p - 1
+ return self[p:p + 1]
+
+ def setPosition(self, position):
+ if self._position >= len(self):
+ raise StopIteration
+ self._position = position
+
+ def getPosition(self):
+ if self._position >= len(self):
+ raise StopIteration
+ if self._position >= 0:
+ return self._position
+ else:
+ return None
+
+ position = property(getPosition, setPosition)
+
+ def getCurrentByte(self):
+ return self[self.position:self.position + 1]
+
+ currentByte = property(getCurrentByte)
+
+ def skip(self, chars=spaceCharactersBytes):
+ """Skip past a list of characters"""
+ p = self.position # use property for the error-checking
+ while p < len(self):
+ c = self[p:p + 1]
+ if c not in chars:
+ self._position = p
+ return c
+ p += 1
+ self._position = p
+ return None
+
+ def skipUntil(self, chars):
+ p = self.position
+ while p < len(self):
+ c = self[p:p + 1]
+ if c in chars:
+ self._position = p
+ return c
+ p += 1
+ self._position = p
+ return None
+
+ def matchBytes(self, bytes):
+ """Look for a sequence of bytes at the start of a string. If the bytes
+ are found return True and advance the position to the byte after the
+ match. Otherwise return False and leave the position alone"""
+ rv = self.startswith(bytes, self.position)
+ if rv:
+ self.position += len(bytes)
+ return rv
+
+ def jumpTo(self, bytes):
+ """Look for the next sequence of bytes matching a given sequence. If
+ a match is found advance the position to the last byte of the match"""
+ try:
+ self._position = self.index(bytes, self.position) + len(bytes) - 1
+ except ValueError:
+ raise StopIteration
+ return True
+
+
+class EncodingParser(object):
+ """Mini parser for detecting character encoding from meta elements"""
+
+ def __init__(self, data):
+ """string - the data to work on for encoding detection"""
+ self.data = EncodingBytes(data)
+ self.encoding = None
+
+ def getEncoding(self):
+ if b"<meta" not in self.data:
+ return None
+
+ methodDispatch = (
+ (b"<!--", self.handleComment),
+ (b"<meta", self.handleMeta),
+ (b"</", self.handlePossibleEndTag),
+ (b"<!", self.handleOther),
+ (b"<?", self.handleOther),
+ (b"<", self.handlePossibleStartTag))
+ for _ in self.data:
+ keepParsing = True
+ try:
+ self.data.jumpTo(b"<")
+ except StopIteration:
+ break
+ for key, method in methodDispatch:
+ if self.data.matchBytes(key):
+ try:
+ keepParsing = method()
+ break
+ except StopIteration:
+ keepParsing = False
+ break
+ if not keepParsing:
+ break
+
+ return self.encoding
+
+ def handleComment(self):
+ """Skip over comments"""
+ return self.data.jumpTo(b"-->")
+
+ def handleMeta(self):
+ if self.data.currentByte not in spaceCharactersBytes:
+ # if we have <meta not followed by a space so just keep going
+ return True
+ # We have a valid meta element we want to search for attributes
+ hasPragma = False
+ pendingEncoding = None
+ while True:
+ # Try to find the next attribute after the current position
+ attr = self.getAttribute()
+ if attr is None:
+ return True
+ else:
+ if attr[0] == b"http-equiv":
+ hasPragma = attr[1] == b"content-type"
+ if hasPragma and pendingEncoding is not None:
+ self.encoding = pendingEncoding
+ return False
+ elif attr[0] == b"charset":
+ tentativeEncoding = attr[1]
+ codec = lookupEncoding(tentativeEncoding)
+ if codec is not None:
+ self.encoding = codec
+ return False
+ elif attr[0] == b"content":
+ contentParser = ContentAttrParser(EncodingBytes(attr[1]))
+ tentativeEncoding = contentParser.parse()
+ if tentativeEncoding is not None:
+ codec = lookupEncoding(tentativeEncoding)
+ if codec is not None:
+ if hasPragma:
+ self.encoding = codec
+ return False
+ else:
+ pendingEncoding = codec
+
+ def handlePossibleStartTag(self):
+ return self.handlePossibleTag(False)
+
+ def handlePossibleEndTag(self):
+ next(self.data)
+ return self.handlePossibleTag(True)
+
+ def handlePossibleTag(self, endTag):
+ data = self.data
+ if data.currentByte not in asciiLettersBytes:
+ # If the next byte is not an ascii letter either ignore this
+ # fragment (possible start tag case) or treat it according to
+ # handleOther
+ if endTag:
+ data.previous()
+ self.handleOther()
+ return True
+
+ c = data.skipUntil(spacesAngleBrackets)
+ if c == b"<":
+ # return to the first step in the overall "two step" algorithm
+ # reprocessing the < byte
+ data.previous()
+ else:
+ # Read all attributes
+ attr = self.getAttribute()
+ while attr is not None:
+ attr = self.getAttribute()
+ return True
+
+ def handleOther(self):
+ return self.data.jumpTo(b">")
+
+ def getAttribute(self):
+ """Return a name,value pair for the next attribute in the stream,
+ if one is found, or None"""
+ data = self.data
+ # Step 1 (skip chars)
+ c = data.skip(spaceCharactersBytes | frozenset([b"/"]))
+ assert c is None or len(c) == 1
+ # Step 2
+ if c in (b">", None):
+ return None
+ # Step 3
+ attrName = []
+ attrValue = []
+ # Step 4 attribute name
+ while True:
+ if c == b"=" and attrName:
+ break
+ elif c in spaceCharactersBytes:
+ # Step 6!
+ c = data.skip()
+ break
+ elif c in (b"/", b">"):
+ return b"".join(attrName), b""
+ elif c in asciiUppercaseBytes:
+ attrName.append(c.lower())
+ elif c is None:
+ return None
+ else:
+ attrName.append(c)
+ # Step 5
+ c = next(data)
+ # Step 7
+ if c != b"=":
+ data.previous()
+ return b"".join(attrName), b""
+ # Step 8
+ next(data)
+ # Step 9
+ c = data.skip()
+ # Step 10
+ if c in (b"'", b'"'):
+ # 10.1
+ quoteChar = c
+ while True:
+ # 10.2
+ c = next(data)
+ # 10.3
+ if c == quoteChar:
+ next(data)
+ return b"".join(attrName), b"".join(attrValue)
+ # 10.4
+ elif c in asciiUppercaseBytes:
+ attrValue.append(c.lower())
+ # 10.5
+ else:
+ attrValue.append(c)
+ elif c == b">":
+ return b"".join(attrName), b""
+ elif c in asciiUppercaseBytes:
+ attrValue.append(c.lower())
+ elif c is None:
+ return None
+ else:
+ attrValue.append(c)
+ # Step 11
+ while True:
+ c = next(data)
+ if c in spacesAngleBrackets:
+ return b"".join(attrName), b"".join(attrValue)
+ elif c in asciiUppercaseBytes:
+ attrValue.append(c.lower())
+ elif c is None:
+ return None
+ else:
+ attrValue.append(c)
+
+
+class ContentAttrParser(object):
+ def __init__(self, data):
+ assert isinstance(data, bytes)
+ self.data = data
+
+ def parse(self):
+ try:
+ # Check if the attr name is charset
+ # otherwise return
+ self.data.jumpTo(b"charset")
+ self.data.position += 1
+ self.data.skip()
+ if not self.data.currentByte == b"=":
+ # If there is no = sign keep looking for attrs
+ return None
+ self.data.position += 1
+ self.data.skip()
+ # Look for an encoding between matching quote marks
+ if self.data.currentByte in (b'"', b"'"):
+ quoteMark = self.data.currentByte
+ self.data.position += 1
+ oldPosition = self.data.position
+ if self.data.jumpTo(quoteMark):
+ return self.data[oldPosition:self.data.position]
+ else:
+ return None
+ else:
+ # Unquoted value
+ oldPosition = self.data.position
+ try:
+ self.data.skipUntil(spaceCharactersBytes)
+ return self.data[oldPosition:self.data.position]
+ except StopIteration:
+ # Return the whole remaining value
+ return self.data[oldPosition:]
+ except StopIteration:
+ return None
+
+
+def lookupEncoding(encoding):
+ """Return the python codec name corresponding to an encoding or None if the
+ string doesn't correspond to a valid encoding."""
+ if isinstance(encoding, bytes):
+ try:
+ encoding = encoding.decode("ascii")
+ except UnicodeDecodeError:
+ return None
+
+ if encoding is not None:
+ try:
+ return webencodings.lookup(encoding)
+ except AttributeError:
+ return None
+ else:
+ return None
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_tokenizer.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_tokenizer.py
new file mode 100644
index 0000000000..4748a19795
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_tokenizer.py
@@ -0,0 +1,1735 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from six import unichr as chr
+
+from collections import deque, OrderedDict
+from sys import version_info
+
+from .constants import spaceCharacters
+from .constants import entities
+from .constants import asciiLetters, asciiUpper2Lower
+from .constants import digits, hexDigits, EOF
+from .constants import tokenTypes, tagTokenTypes
+from .constants import replacementCharacters
+
+from ._inputstream import HTMLInputStream
+
+from ._trie import Trie
+
+entitiesTrie = Trie(entities)
+
+if version_info >= (3, 7):
+ attributeMap = dict
+else:
+ attributeMap = OrderedDict
+
+
+class HTMLTokenizer(object):
+ """ This class takes care of tokenizing HTML.
+
+ * self.currentToken
+ Holds the token that is currently being processed.
+
+ * self.state
+ Holds a reference to the method to be invoked... XXX
+
+ * self.stream
+ Points to HTMLInputStream object.
+ """
+
+ def __init__(self, stream, parser=None, **kwargs):
+
+ self.stream = HTMLInputStream(stream, **kwargs)
+ self.parser = parser
+
+ # Setup the initial tokenizer state
+ self.escapeFlag = False
+ self.lastFourChars = []
+ self.state = self.dataState
+ self.escape = False
+
+ # The current token being created
+ self.currentToken = None
+ super(HTMLTokenizer, self).__init__()
+
+ def __iter__(self):
+ """ This is where the magic happens.
+
+ We do our usually processing through the states and when we have a token
+ to return we yield the token which pauses processing until the next token
+ is requested.
+ """
+ self.tokenQueue = deque([])
+ # Start processing. When EOF is reached self.state will return False
+ # instead of True and the loop will terminate.
+ while self.state():
+ while self.stream.errors:
+ yield {"type": tokenTypes["ParseError"], "data": self.stream.errors.pop(0)}
+ while self.tokenQueue:
+ yield self.tokenQueue.popleft()
+
+ def consumeNumberEntity(self, isHex):
+ """This function returns either U+FFFD or the character based on the
+ decimal or hexadecimal representation. It also discards ";" if present.
+ If not present self.tokenQueue.append({"type": tokenTypes["ParseError"]}) is invoked.
+ """
+
+ allowed = digits
+ radix = 10
+ if isHex:
+ allowed = hexDigits
+ radix = 16
+
+ charStack = []
+
+ # Consume all the characters that are in range while making sure we
+ # don't hit an EOF.
+ c = self.stream.char()
+ while c in allowed and c is not EOF:
+ charStack.append(c)
+ c = self.stream.char()
+
+ # Convert the set of characters consumed to an int.
+ charAsInt = int("".join(charStack), radix)
+
+ # Certain characters get replaced with others
+ if charAsInt in replacementCharacters:
+ char = replacementCharacters[charAsInt]
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "illegal-codepoint-for-numeric-entity",
+ "datavars": {"charAsInt": charAsInt}})
+ elif ((0xD800 <= charAsInt <= 0xDFFF) or
+ (charAsInt > 0x10FFFF)):
+ char = "\uFFFD"
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "illegal-codepoint-for-numeric-entity",
+ "datavars": {"charAsInt": charAsInt}})
+ else:
+ # Should speed up this check somehow (e.g. move the set to a constant)
+ if ((0x0001 <= charAsInt <= 0x0008) or
+ (0x000E <= charAsInt <= 0x001F) or
+ (0x007F <= charAsInt <= 0x009F) or
+ (0xFDD0 <= charAsInt <= 0xFDEF) or
+ charAsInt in frozenset([0x000B, 0xFFFE, 0xFFFF, 0x1FFFE,
+ 0x1FFFF, 0x2FFFE, 0x2FFFF, 0x3FFFE,
+ 0x3FFFF, 0x4FFFE, 0x4FFFF, 0x5FFFE,
+ 0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE,
+ 0x7FFFF, 0x8FFFE, 0x8FFFF, 0x9FFFE,
+ 0x9FFFF, 0xAFFFE, 0xAFFFF, 0xBFFFE,
+ 0xBFFFF, 0xCFFFE, 0xCFFFF, 0xDFFFE,
+ 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE,
+ 0xFFFFF, 0x10FFFE, 0x10FFFF])):
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data":
+ "illegal-codepoint-for-numeric-entity",
+ "datavars": {"charAsInt": charAsInt}})
+ try:
+ # Try/except needed as UCS-2 Python builds' unichar only works
+ # within the BMP.
+ char = chr(charAsInt)
+ except ValueError:
+ v = charAsInt - 0x10000
+ char = chr(0xD800 | (v >> 10)) + chr(0xDC00 | (v & 0x3FF))
+
+ # Discard the ; if present. Otherwise, put it back on the queue and
+ # invoke parseError on parser.
+ if c != ";":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "numeric-entity-without-semicolon"})
+ self.stream.unget(c)
+
+ return char
+
+ def consumeEntity(self, allowedChar=None, fromAttribute=False):
+ # Initialise to the default output for when no entity is matched
+ output = "&"
+
+ charStack = [self.stream.char()]
+ if (charStack[0] in spaceCharacters or charStack[0] in (EOF, "<", "&") or
+ (allowedChar is not None and allowedChar == charStack[0])):
+ self.stream.unget(charStack[0])
+
+ elif charStack[0] == "#":
+ # Read the next character to see if it's hex or decimal
+ hex = False
+ charStack.append(self.stream.char())
+ if charStack[-1] in ("x", "X"):
+ hex = True
+ charStack.append(self.stream.char())
+
+ # charStack[-1] should be the first digit
+ if (hex and charStack[-1] in hexDigits) \
+ or (not hex and charStack[-1] in digits):
+ # At least one digit found, so consume the whole number
+ self.stream.unget(charStack[-1])
+ output = self.consumeNumberEntity(hex)
+ else:
+ # No digits found
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "expected-numeric-entity"})
+ self.stream.unget(charStack.pop())
+ output = "&" + "".join(charStack)
+
+ else:
+ # At this point in the process might have named entity. Entities
+ # are stored in the global variable "entities".
+ #
+ # Consume characters and compare to these to a substring of the
+ # entity names in the list until the substring no longer matches.
+ while (charStack[-1] is not EOF):
+ if not entitiesTrie.has_keys_with_prefix("".join(charStack)):
+ break
+ charStack.append(self.stream.char())
+
+ # At this point we have a string that starts with some characters
+ # that may match an entity
+ # Try to find the longest entity the string will match to take care
+ # of &noti for instance.
+ try:
+ entityName = entitiesTrie.longest_prefix("".join(charStack[:-1]))
+ entityLength = len(entityName)
+ except KeyError:
+ entityName = None
+
+ if entityName is not None:
+ if entityName[-1] != ";":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "named-entity-without-semicolon"})
+ if (entityName[-1] != ";" and fromAttribute and
+ (charStack[entityLength] in asciiLetters or
+ charStack[entityLength] in digits or
+ charStack[entityLength] == "=")):
+ self.stream.unget(charStack.pop())
+ output = "&" + "".join(charStack)
+ else:
+ output = entities[entityName]
+ self.stream.unget(charStack.pop())
+ output += "".join(charStack[entityLength:])
+ else:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-named-entity"})
+ self.stream.unget(charStack.pop())
+ output = "&" + "".join(charStack)
+
+ if fromAttribute:
+ self.currentToken["data"][-1][1] += output
+ else:
+ if output in spaceCharacters:
+ tokenType = "SpaceCharacters"
+ else:
+ tokenType = "Characters"
+ self.tokenQueue.append({"type": tokenTypes[tokenType], "data": output})
+
+ def processEntityInAttribute(self, allowedChar):
+ """This method replaces the need for "entityInAttributeValueState".
+ """
+ self.consumeEntity(allowedChar=allowedChar, fromAttribute=True)
+
+ def emitCurrentToken(self):
+ """This method is a generic handler for emitting the tags. It also sets
+ the state to "data" because that's what's needed after a token has been
+ emitted.
+ """
+ token = self.currentToken
+ # Add token to the queue to be yielded
+ if (token["type"] in tagTokenTypes):
+ token["name"] = token["name"].translate(asciiUpper2Lower)
+ if token["type"] == tokenTypes["StartTag"]:
+ raw = token["data"]
+ data = attributeMap(raw)
+ if len(raw) > len(data):
+ # we had some duplicated attribute, fix so first wins
+ data.update(raw[::-1])
+ token["data"] = data
+
+ if token["type"] == tokenTypes["EndTag"]:
+ if token["data"]:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "attributes-in-end-tag"})
+ if token["selfClosing"]:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "self-closing-flag-on-end-tag"})
+ self.tokenQueue.append(token)
+ self.state = self.dataState
+
+ # Below are the various tokenizer states worked out.
+ def dataState(self):
+ data = self.stream.char()
+ if data == "&":
+ self.state = self.entityDataState
+ elif data == "<":
+ self.state = self.tagOpenState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": "\u0000"})
+ elif data is EOF:
+ # Tokenization ends.
+ return False
+ elif data in spaceCharacters:
+ # Directly after emitting a token you switch back to the "data
+ # state". At that point spaceCharacters are important so they are
+ # emitted separately.
+ self.tokenQueue.append({"type": tokenTypes["SpaceCharacters"], "data":
+ data + self.stream.charsUntil(spaceCharacters, True)})
+ # No need to update lastFourChars here, since the first space will
+ # have already been appended to lastFourChars and will have broken
+ # any <!-- or --> sequences
+ else:
+ chars = self.stream.charsUntil(("&", "<", "\u0000"))
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data":
+ data + chars})
+ return True
+
+ def entityDataState(self):
+ self.consumeEntity()
+ self.state = self.dataState
+ return True
+
+ def rcdataState(self):
+ data = self.stream.char()
+ if data == "&":
+ self.state = self.characterReferenceInRcdata
+ elif data == "<":
+ self.state = self.rcdataLessThanSignState
+ elif data == EOF:
+ # Tokenization ends.
+ return False
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": "\uFFFD"})
+ elif data in spaceCharacters:
+ # Directly after emitting a token you switch back to the "data
+ # state". At that point spaceCharacters are important so they are
+ # emitted separately.
+ self.tokenQueue.append({"type": tokenTypes["SpaceCharacters"], "data":
+ data + self.stream.charsUntil(spaceCharacters, True)})
+ # No need to update lastFourChars here, since the first space will
+ # have already been appended to lastFourChars and will have broken
+ # any <!-- or --> sequences
+ else:
+ chars = self.stream.charsUntil(("&", "<", "\u0000"))
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data":
+ data + chars})
+ return True
+
+ def characterReferenceInRcdata(self):
+ self.consumeEntity()
+ self.state = self.rcdataState
+ return True
+
+ def rawtextState(self):
+ data = self.stream.char()
+ if data == "<":
+ self.state = self.rawtextLessThanSignState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": "\uFFFD"})
+ elif data == EOF:
+ # Tokenization ends.
+ return False
+ else:
+ chars = self.stream.charsUntil(("<", "\u0000"))
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data":
+ data + chars})
+ return True
+
+ def scriptDataState(self):
+ data = self.stream.char()
+ if data == "<":
+ self.state = self.scriptDataLessThanSignState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": "\uFFFD"})
+ elif data == EOF:
+ # Tokenization ends.
+ return False
+ else:
+ chars = self.stream.charsUntil(("<", "\u0000"))
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data":
+ data + chars})
+ return True
+
+ def plaintextState(self):
+ data = self.stream.char()
+ if data == EOF:
+ # Tokenization ends.
+ return False
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": "\uFFFD"})
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data":
+ data + self.stream.charsUntil("\u0000")})
+ return True
+
+ def tagOpenState(self):
+ data = self.stream.char()
+ if data == "!":
+ self.state = self.markupDeclarationOpenState
+ elif data == "/":
+ self.state = self.closeTagOpenState
+ elif data in asciiLetters:
+ self.currentToken = {"type": tokenTypes["StartTag"],
+ "name": data, "data": [],
+ "selfClosing": False,
+ "selfClosingAcknowledged": False}
+ self.state = self.tagNameState
+ elif data == ">":
+ # XXX In theory it could be something besides a tag name. But
+ # do we really care?
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-tag-name-but-got-right-bracket"})
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<>"})
+ self.state = self.dataState
+ elif data == "?":
+ # XXX In theory it could be something besides a tag name. But
+ # do we really care?
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-tag-name-but-got-question-mark"})
+ self.stream.unget(data)
+ self.state = self.bogusCommentState
+ else:
+ # XXX
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-tag-name"})
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"})
+ self.stream.unget(data)
+ self.state = self.dataState
+ return True
+
+ def closeTagOpenState(self):
+ data = self.stream.char()
+ if data in asciiLetters:
+ self.currentToken = {"type": tokenTypes["EndTag"], "name": data,
+ "data": [], "selfClosing": False}
+ self.state = self.tagNameState
+ elif data == ">":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-closing-tag-but-got-right-bracket"})
+ self.state = self.dataState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-closing-tag-but-got-eof"})
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "</"})
+ self.state = self.dataState
+ else:
+ # XXX data can be _'_...
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-closing-tag-but-got-char",
+ "datavars": {"data": data}})
+ self.stream.unget(data)
+ self.state = self.bogusCommentState
+ return True
+
+ def tagNameState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ self.state = self.beforeAttributeNameState
+ elif data == ">":
+ self.emitCurrentToken()
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-tag-name"})
+ self.state = self.dataState
+ elif data == "/":
+ self.state = self.selfClosingStartTagState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["name"] += "\uFFFD"
+ else:
+ self.currentToken["name"] += data
+ # (Don't use charsUntil here, because tag names are
+ # very short and it's faster to not do anything fancy)
+ return True
+
+ def rcdataLessThanSignState(self):
+ data = self.stream.char()
+ if data == "/":
+ self.temporaryBuffer = ""
+ self.state = self.rcdataEndTagOpenState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"})
+ self.stream.unget(data)
+ self.state = self.rcdataState
+ return True
+
+ def rcdataEndTagOpenState(self):
+ data = self.stream.char()
+ if data in asciiLetters:
+ self.temporaryBuffer += data
+ self.state = self.rcdataEndTagNameState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "</"})
+ self.stream.unget(data)
+ self.state = self.rcdataState
+ return True
+
+ def rcdataEndTagNameState(self):
+ appropriate = self.currentToken and self.currentToken["name"].lower() == self.temporaryBuffer.lower()
+ data = self.stream.char()
+ if data in spaceCharacters and appropriate:
+ self.currentToken = {"type": tokenTypes["EndTag"],
+ "name": self.temporaryBuffer,
+ "data": [], "selfClosing": False}
+ self.state = self.beforeAttributeNameState
+ elif data == "/" and appropriate:
+ self.currentToken = {"type": tokenTypes["EndTag"],
+ "name": self.temporaryBuffer,
+ "data": [], "selfClosing": False}
+ self.state = self.selfClosingStartTagState
+ elif data == ">" and appropriate:
+ self.currentToken = {"type": tokenTypes["EndTag"],
+ "name": self.temporaryBuffer,
+ "data": [], "selfClosing": False}
+ self.emitCurrentToken()
+ self.state = self.dataState
+ elif data in asciiLetters:
+ self.temporaryBuffer += data
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": "</" + self.temporaryBuffer})
+ self.stream.unget(data)
+ self.state = self.rcdataState
+ return True
+
+ def rawtextLessThanSignState(self):
+ data = self.stream.char()
+ if data == "/":
+ self.temporaryBuffer = ""
+ self.state = self.rawtextEndTagOpenState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"})
+ self.stream.unget(data)
+ self.state = self.rawtextState
+ return True
+
+ def rawtextEndTagOpenState(self):
+ data = self.stream.char()
+ if data in asciiLetters:
+ self.temporaryBuffer += data
+ self.state = self.rawtextEndTagNameState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "</"})
+ self.stream.unget(data)
+ self.state = self.rawtextState
+ return True
+
+ def rawtextEndTagNameState(self):
+ appropriate = self.currentToken and self.currentToken["name"].lower() == self.temporaryBuffer.lower()
+ data = self.stream.char()
+ if data in spaceCharacters and appropriate:
+ self.currentToken = {"type": tokenTypes["EndTag"],
+ "name": self.temporaryBuffer,
+ "data": [], "selfClosing": False}
+ self.state = self.beforeAttributeNameState
+ elif data == "/" and appropriate:
+ self.currentToken = {"type": tokenTypes["EndTag"],
+ "name": self.temporaryBuffer,
+ "data": [], "selfClosing": False}
+ self.state = self.selfClosingStartTagState
+ elif data == ">" and appropriate:
+ self.currentToken = {"type": tokenTypes["EndTag"],
+ "name": self.temporaryBuffer,
+ "data": [], "selfClosing": False}
+ self.emitCurrentToken()
+ self.state = self.dataState
+ elif data in asciiLetters:
+ self.temporaryBuffer += data
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": "</" + self.temporaryBuffer})
+ self.stream.unget(data)
+ self.state = self.rawtextState
+ return True
+
+ def scriptDataLessThanSignState(self):
+ data = self.stream.char()
+ if data == "/":
+ self.temporaryBuffer = ""
+ self.state = self.scriptDataEndTagOpenState
+ elif data == "!":
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<!"})
+ self.state = self.scriptDataEscapeStartState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"})
+ self.stream.unget(data)
+ self.state = self.scriptDataState
+ return True
+
+ def scriptDataEndTagOpenState(self):
+ data = self.stream.char()
+ if data in asciiLetters:
+ self.temporaryBuffer += data
+ self.state = self.scriptDataEndTagNameState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "</"})
+ self.stream.unget(data)
+ self.state = self.scriptDataState
+ return True
+
+ def scriptDataEndTagNameState(self):
+ appropriate = self.currentToken and self.currentToken["name"].lower() == self.temporaryBuffer.lower()
+ data = self.stream.char()
+ if data in spaceCharacters and appropriate:
+ self.currentToken = {"type": tokenTypes["EndTag"],
+ "name": self.temporaryBuffer,
+ "data": [], "selfClosing": False}
+ self.state = self.beforeAttributeNameState
+ elif data == "/" and appropriate:
+ self.currentToken = {"type": tokenTypes["EndTag"],
+ "name": self.temporaryBuffer,
+ "data": [], "selfClosing": False}
+ self.state = self.selfClosingStartTagState
+ elif data == ">" and appropriate:
+ self.currentToken = {"type": tokenTypes["EndTag"],
+ "name": self.temporaryBuffer,
+ "data": [], "selfClosing": False}
+ self.emitCurrentToken()
+ self.state = self.dataState
+ elif data in asciiLetters:
+ self.temporaryBuffer += data
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": "</" + self.temporaryBuffer})
+ self.stream.unget(data)
+ self.state = self.scriptDataState
+ return True
+
+ def scriptDataEscapeStartState(self):
+ data = self.stream.char()
+ if data == "-":
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "-"})
+ self.state = self.scriptDataEscapeStartDashState
+ else:
+ self.stream.unget(data)
+ self.state = self.scriptDataState
+ return True
+
+ def scriptDataEscapeStartDashState(self):
+ data = self.stream.char()
+ if data == "-":
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "-"})
+ self.state = self.scriptDataEscapedDashDashState
+ else:
+ self.stream.unget(data)
+ self.state = self.scriptDataState
+ return True
+
+ def scriptDataEscapedState(self):
+ data = self.stream.char()
+ if data == "-":
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "-"})
+ self.state = self.scriptDataEscapedDashState
+ elif data == "<":
+ self.state = self.scriptDataEscapedLessThanSignState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": "\uFFFD"})
+ elif data == EOF:
+ self.state = self.dataState
+ else:
+ chars = self.stream.charsUntil(("<", "-", "\u0000"))
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data":
+ data + chars})
+ return True
+
+ def scriptDataEscapedDashState(self):
+ data = self.stream.char()
+ if data == "-":
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "-"})
+ self.state = self.scriptDataEscapedDashDashState
+ elif data == "<":
+ self.state = self.scriptDataEscapedLessThanSignState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": "\uFFFD"})
+ self.state = self.scriptDataEscapedState
+ elif data == EOF:
+ self.state = self.dataState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data})
+ self.state = self.scriptDataEscapedState
+ return True
+
+ def scriptDataEscapedDashDashState(self):
+ data = self.stream.char()
+ if data == "-":
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "-"})
+ elif data == "<":
+ self.state = self.scriptDataEscapedLessThanSignState
+ elif data == ">":
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": ">"})
+ self.state = self.scriptDataState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": "\uFFFD"})
+ self.state = self.scriptDataEscapedState
+ elif data == EOF:
+ self.state = self.dataState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data})
+ self.state = self.scriptDataEscapedState
+ return True
+
+ def scriptDataEscapedLessThanSignState(self):
+ data = self.stream.char()
+ if data == "/":
+ self.temporaryBuffer = ""
+ self.state = self.scriptDataEscapedEndTagOpenState
+ elif data in asciiLetters:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<" + data})
+ self.temporaryBuffer = data
+ self.state = self.scriptDataDoubleEscapeStartState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"})
+ self.stream.unget(data)
+ self.state = self.scriptDataEscapedState
+ return True
+
+ def scriptDataEscapedEndTagOpenState(self):
+ data = self.stream.char()
+ if data in asciiLetters:
+ self.temporaryBuffer = data
+ self.state = self.scriptDataEscapedEndTagNameState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "</"})
+ self.stream.unget(data)
+ self.state = self.scriptDataEscapedState
+ return True
+
+ def scriptDataEscapedEndTagNameState(self):
+ appropriate = self.currentToken and self.currentToken["name"].lower() == self.temporaryBuffer.lower()
+ data = self.stream.char()
+ if data in spaceCharacters and appropriate:
+ self.currentToken = {"type": tokenTypes["EndTag"],
+ "name": self.temporaryBuffer,
+ "data": [], "selfClosing": False}
+ self.state = self.beforeAttributeNameState
+ elif data == "/" and appropriate:
+ self.currentToken = {"type": tokenTypes["EndTag"],
+ "name": self.temporaryBuffer,
+ "data": [], "selfClosing": False}
+ self.state = self.selfClosingStartTagState
+ elif data == ">" and appropriate:
+ self.currentToken = {"type": tokenTypes["EndTag"],
+ "name": self.temporaryBuffer,
+ "data": [], "selfClosing": False}
+ self.emitCurrentToken()
+ self.state = self.dataState
+ elif data in asciiLetters:
+ self.temporaryBuffer += data
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": "</" + self.temporaryBuffer})
+ self.stream.unget(data)
+ self.state = self.scriptDataEscapedState
+ return True
+
+ def scriptDataDoubleEscapeStartState(self):
+ data = self.stream.char()
+ if data in (spaceCharacters | frozenset(("/", ">"))):
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data})
+ if self.temporaryBuffer.lower() == "script":
+ self.state = self.scriptDataDoubleEscapedState
+ else:
+ self.state = self.scriptDataEscapedState
+ elif data in asciiLetters:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data})
+ self.temporaryBuffer += data
+ else:
+ self.stream.unget(data)
+ self.state = self.scriptDataEscapedState
+ return True
+
+ def scriptDataDoubleEscapedState(self):
+ data = self.stream.char()
+ if data == "-":
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "-"})
+ self.state = self.scriptDataDoubleEscapedDashState
+ elif data == "<":
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"})
+ self.state = self.scriptDataDoubleEscapedLessThanSignState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": "\uFFFD"})
+ elif data == EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-script-in-script"})
+ self.state = self.dataState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data})
+ return True
+
+ def scriptDataDoubleEscapedDashState(self):
+ data = self.stream.char()
+ if data == "-":
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "-"})
+ self.state = self.scriptDataDoubleEscapedDashDashState
+ elif data == "<":
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"})
+ self.state = self.scriptDataDoubleEscapedLessThanSignState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": "\uFFFD"})
+ self.state = self.scriptDataDoubleEscapedState
+ elif data == EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-script-in-script"})
+ self.state = self.dataState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data})
+ self.state = self.scriptDataDoubleEscapedState
+ return True
+
+ def scriptDataDoubleEscapedDashDashState(self):
+ data = self.stream.char()
+ if data == "-":
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "-"})
+ elif data == "<":
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"})
+ self.state = self.scriptDataDoubleEscapedLessThanSignState
+ elif data == ">":
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": ">"})
+ self.state = self.scriptDataState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": "\uFFFD"})
+ self.state = self.scriptDataDoubleEscapedState
+ elif data == EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-script-in-script"})
+ self.state = self.dataState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data})
+ self.state = self.scriptDataDoubleEscapedState
+ return True
+
+ def scriptDataDoubleEscapedLessThanSignState(self):
+ data = self.stream.char()
+ if data == "/":
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "/"})
+ self.temporaryBuffer = ""
+ self.state = self.scriptDataDoubleEscapeEndState
+ else:
+ self.stream.unget(data)
+ self.state = self.scriptDataDoubleEscapedState
+ return True
+
+ def scriptDataDoubleEscapeEndState(self):
+ data = self.stream.char()
+ if data in (spaceCharacters | frozenset(("/", ">"))):
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data})
+ if self.temporaryBuffer.lower() == "script":
+ self.state = self.scriptDataEscapedState
+ else:
+ self.state = self.scriptDataDoubleEscapedState
+ elif data in asciiLetters:
+ self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data})
+ self.temporaryBuffer += data
+ else:
+ self.stream.unget(data)
+ self.state = self.scriptDataDoubleEscapedState
+ return True
+
+ def beforeAttributeNameState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ self.stream.charsUntil(spaceCharacters, True)
+ elif data in asciiLetters:
+ self.currentToken["data"].append([data, ""])
+ self.state = self.attributeNameState
+ elif data == ">":
+ self.emitCurrentToken()
+ elif data == "/":
+ self.state = self.selfClosingStartTagState
+ elif data in ("'", '"', "=", "<"):
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "invalid-character-in-attribute-name"})
+ self.currentToken["data"].append([data, ""])
+ self.state = self.attributeNameState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["data"].append(["\uFFFD", ""])
+ self.state = self.attributeNameState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-attribute-name-but-got-eof"})
+ self.state = self.dataState
+ else:
+ self.currentToken["data"].append([data, ""])
+ self.state = self.attributeNameState
+ return True
+
+ def attributeNameState(self):
+ data = self.stream.char()
+ leavingThisState = True
+ emitToken = False
+ if data == "=":
+ self.state = self.beforeAttributeValueState
+ elif data in asciiLetters:
+ self.currentToken["data"][-1][0] += data +\
+ self.stream.charsUntil(asciiLetters, True)
+ leavingThisState = False
+ elif data == ">":
+ # XXX If we emit here the attributes are converted to a dict
+ # without being checked and when the code below runs we error
+ # because data is a dict not a list
+ emitToken = True
+ elif data in spaceCharacters:
+ self.state = self.afterAttributeNameState
+ elif data == "/":
+ self.state = self.selfClosingStartTagState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["data"][-1][0] += "\uFFFD"
+ leavingThisState = False
+ elif data in ("'", '"', "<"):
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data":
+ "invalid-character-in-attribute-name"})
+ self.currentToken["data"][-1][0] += data
+ leavingThisState = False
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "eof-in-attribute-name"})
+ self.state = self.dataState
+ else:
+ self.currentToken["data"][-1][0] += data
+ leavingThisState = False
+
+ if leavingThisState:
+ # Attributes are not dropped at this stage. That happens when the
+ # start tag token is emitted so values can still be safely appended
+ # to attributes, but we do want to report the parse error in time.
+ self.currentToken["data"][-1][0] = (
+ self.currentToken["data"][-1][0].translate(asciiUpper2Lower))
+ for name, _ in self.currentToken["data"][:-1]:
+ if self.currentToken["data"][-1][0] == name:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "duplicate-attribute"})
+ break
+ # XXX Fix for above XXX
+ if emitToken:
+ self.emitCurrentToken()
+ return True
+
+ def afterAttributeNameState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ self.stream.charsUntil(spaceCharacters, True)
+ elif data == "=":
+ self.state = self.beforeAttributeValueState
+ elif data == ">":
+ self.emitCurrentToken()
+ elif data in asciiLetters:
+ self.currentToken["data"].append([data, ""])
+ self.state = self.attributeNameState
+ elif data == "/":
+ self.state = self.selfClosingStartTagState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["data"].append(["\uFFFD", ""])
+ self.state = self.attributeNameState
+ elif data in ("'", '"', "<"):
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "invalid-character-after-attribute-name"})
+ self.currentToken["data"].append([data, ""])
+ self.state = self.attributeNameState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-end-of-tag-but-got-eof"})
+ self.state = self.dataState
+ else:
+ self.currentToken["data"].append([data, ""])
+ self.state = self.attributeNameState
+ return True
+
+ def beforeAttributeValueState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ self.stream.charsUntil(spaceCharacters, True)
+ elif data == "\"":
+ self.state = self.attributeValueDoubleQuotedState
+ elif data == "&":
+ self.state = self.attributeValueUnQuotedState
+ self.stream.unget(data)
+ elif data == "'":
+ self.state = self.attributeValueSingleQuotedState
+ elif data == ">":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-attribute-value-but-got-right-bracket"})
+ self.emitCurrentToken()
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["data"][-1][1] += "\uFFFD"
+ self.state = self.attributeValueUnQuotedState
+ elif data in ("=", "<", "`"):
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "equals-in-unquoted-attribute-value"})
+ self.currentToken["data"][-1][1] += data
+ self.state = self.attributeValueUnQuotedState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-attribute-value-but-got-eof"})
+ self.state = self.dataState
+ else:
+ self.currentToken["data"][-1][1] += data
+ self.state = self.attributeValueUnQuotedState
+ return True
+
+ def attributeValueDoubleQuotedState(self):
+ data = self.stream.char()
+ if data == "\"":
+ self.state = self.afterAttributeValueState
+ elif data == "&":
+ self.processEntityInAttribute('"')
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["data"][-1][1] += "\uFFFD"
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-attribute-value-double-quote"})
+ self.state = self.dataState
+ else:
+ self.currentToken["data"][-1][1] += data +\
+ self.stream.charsUntil(("\"", "&", "\u0000"))
+ return True
+
+ def attributeValueSingleQuotedState(self):
+ data = self.stream.char()
+ if data == "'":
+ self.state = self.afterAttributeValueState
+ elif data == "&":
+ self.processEntityInAttribute("'")
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["data"][-1][1] += "\uFFFD"
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-attribute-value-single-quote"})
+ self.state = self.dataState
+ else:
+ self.currentToken["data"][-1][1] += data +\
+ self.stream.charsUntil(("'", "&", "\u0000"))
+ return True
+
+ def attributeValueUnQuotedState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ self.state = self.beforeAttributeNameState
+ elif data == "&":
+ self.processEntityInAttribute(">")
+ elif data == ">":
+ self.emitCurrentToken()
+ elif data in ('"', "'", "=", "<", "`"):
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-character-in-unquoted-attribute-value"})
+ self.currentToken["data"][-1][1] += data
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["data"][-1][1] += "\uFFFD"
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-attribute-value-no-quotes"})
+ self.state = self.dataState
+ else:
+ self.currentToken["data"][-1][1] += data + self.stream.charsUntil(
+ frozenset(("&", ">", '"', "'", "=", "<", "`", "\u0000")) | spaceCharacters)
+ return True
+
+ def afterAttributeValueState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ self.state = self.beforeAttributeNameState
+ elif data == ">":
+ self.emitCurrentToken()
+ elif data == "/":
+ self.state = self.selfClosingStartTagState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-EOF-after-attribute-value"})
+ self.stream.unget(data)
+ self.state = self.dataState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-character-after-attribute-value"})
+ self.stream.unget(data)
+ self.state = self.beforeAttributeNameState
+ return True
+
+ def selfClosingStartTagState(self):
+ data = self.stream.char()
+ if data == ">":
+ self.currentToken["selfClosing"] = True
+ self.emitCurrentToken()
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data":
+ "unexpected-EOF-after-solidus-in-tag"})
+ self.stream.unget(data)
+ self.state = self.dataState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-character-after-solidus-in-tag"})
+ self.stream.unget(data)
+ self.state = self.beforeAttributeNameState
+ return True
+
+ def bogusCommentState(self):
+ # Make a new comment token and give it as value all the characters
+ # until the first > or EOF (charsUntil checks for EOF automatically)
+ # and emit it.
+ data = self.stream.charsUntil(">")
+ data = data.replace("\u0000", "\uFFFD")
+ self.tokenQueue.append(
+ {"type": tokenTypes["Comment"], "data": data})
+
+ # Eat the character directly after the bogus comment which is either a
+ # ">" or an EOF.
+ self.stream.char()
+ self.state = self.dataState
+ return True
+
+ def markupDeclarationOpenState(self):
+ charStack = [self.stream.char()]
+ if charStack[-1] == "-":
+ charStack.append(self.stream.char())
+ if charStack[-1] == "-":
+ self.currentToken = {"type": tokenTypes["Comment"], "data": ""}
+ self.state = self.commentStartState
+ return True
+ elif charStack[-1] in ('d', 'D'):
+ matched = True
+ for expected in (('o', 'O'), ('c', 'C'), ('t', 'T'),
+ ('y', 'Y'), ('p', 'P'), ('e', 'E')):
+ charStack.append(self.stream.char())
+ if charStack[-1] not in expected:
+ matched = False
+ break
+ if matched:
+ self.currentToken = {"type": tokenTypes["Doctype"],
+ "name": "",
+ "publicId": None, "systemId": None,
+ "correct": True}
+ self.state = self.doctypeState
+ return True
+ elif (charStack[-1] == "[" and
+ self.parser is not None and
+ self.parser.tree.openElements and
+ self.parser.tree.openElements[-1].namespace != self.parser.tree.defaultNamespace):
+ matched = True
+ for expected in ["C", "D", "A", "T", "A", "["]:
+ charStack.append(self.stream.char())
+ if charStack[-1] != expected:
+ matched = False
+ break
+ if matched:
+ self.state = self.cdataSectionState
+ return True
+
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-dashes-or-doctype"})
+
+ while charStack:
+ self.stream.unget(charStack.pop())
+ self.state = self.bogusCommentState
+ return True
+
+ def commentStartState(self):
+ data = self.stream.char()
+ if data == "-":
+ self.state = self.commentStartDashState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["data"] += "\uFFFD"
+ elif data == ">":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "incorrect-comment"})
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-comment"})
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.currentToken["data"] += data
+ self.state = self.commentState
+ return True
+
+ def commentStartDashState(self):
+ data = self.stream.char()
+ if data == "-":
+ self.state = self.commentEndState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["data"] += "-\uFFFD"
+ elif data == ">":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "incorrect-comment"})
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-comment"})
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.currentToken["data"] += "-" + data
+ self.state = self.commentState
+ return True
+
+ def commentState(self):
+ data = self.stream.char()
+ if data == "-":
+ self.state = self.commentEndDashState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["data"] += "\uFFFD"
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "eof-in-comment"})
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.currentToken["data"] += data + \
+ self.stream.charsUntil(("-", "\u0000"))
+ return True
+
+ def commentEndDashState(self):
+ data = self.stream.char()
+ if data == "-":
+ self.state = self.commentEndState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["data"] += "-\uFFFD"
+ self.state = self.commentState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-comment-end-dash"})
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.currentToken["data"] += "-" + data
+ self.state = self.commentState
+ return True
+
+ def commentEndState(self):
+ data = self.stream.char()
+ if data == ">":
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["data"] += "--\uFFFD"
+ self.state = self.commentState
+ elif data == "!":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-bang-after-double-dash-in-comment"})
+ self.state = self.commentEndBangState
+ elif data == "-":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-dash-after-double-dash-in-comment"})
+ self.currentToken["data"] += data
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-comment-double-dash"})
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ # XXX
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-char-in-comment"})
+ self.currentToken["data"] += "--" + data
+ self.state = self.commentState
+ return True
+
+ def commentEndBangState(self):
+ data = self.stream.char()
+ if data == ">":
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data == "-":
+ self.currentToken["data"] += "--!"
+ self.state = self.commentEndDashState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["data"] += "--!\uFFFD"
+ self.state = self.commentState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-comment-end-bang-state"})
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.currentToken["data"] += "--!" + data
+ self.state = self.commentState
+ return True
+
+ def doctypeState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ self.state = self.beforeDoctypeNameState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-doctype-name-but-got-eof"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "need-space-after-doctype"})
+ self.stream.unget(data)
+ self.state = self.beforeDoctypeNameState
+ return True
+
+ def beforeDoctypeNameState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ pass
+ elif data == ">":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-doctype-name-but-got-right-bracket"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["name"] = "\uFFFD"
+ self.state = self.doctypeNameState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-doctype-name-but-got-eof"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.currentToken["name"] = data
+ self.state = self.doctypeNameState
+ return True
+
+ def doctypeNameState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ self.currentToken["name"] = self.currentToken["name"].translate(asciiUpper2Lower)
+ self.state = self.afterDoctypeNameState
+ elif data == ">":
+ self.currentToken["name"] = self.currentToken["name"].translate(asciiUpper2Lower)
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["name"] += "\uFFFD"
+ self.state = self.doctypeNameState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-doctype-name"})
+ self.currentToken["correct"] = False
+ self.currentToken["name"] = self.currentToken["name"].translate(asciiUpper2Lower)
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.currentToken["name"] += data
+ return True
+
+ def afterDoctypeNameState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ pass
+ elif data == ">":
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data is EOF:
+ self.currentToken["correct"] = False
+ self.stream.unget(data)
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-doctype"})
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ if data in ("p", "P"):
+ matched = True
+ for expected in (("u", "U"), ("b", "B"), ("l", "L"),
+ ("i", "I"), ("c", "C")):
+ data = self.stream.char()
+ if data not in expected:
+ matched = False
+ break
+ if matched:
+ self.state = self.afterDoctypePublicKeywordState
+ return True
+ elif data in ("s", "S"):
+ matched = True
+ for expected in (("y", "Y"), ("s", "S"), ("t", "T"),
+ ("e", "E"), ("m", "M")):
+ data = self.stream.char()
+ if data not in expected:
+ matched = False
+ break
+ if matched:
+ self.state = self.afterDoctypeSystemKeywordState
+ return True
+
+ # All the characters read before the current 'data' will be
+ # [a-zA-Z], so they're garbage in the bogus doctype and can be
+ # discarded; only the latest character might be '>' or EOF
+ # and needs to be ungetted
+ self.stream.unget(data)
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "expected-space-or-right-bracket-in-doctype", "datavars":
+ {"data": data}})
+ self.currentToken["correct"] = False
+ self.state = self.bogusDoctypeState
+
+ return True
+
+ def afterDoctypePublicKeywordState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ self.state = self.beforeDoctypePublicIdentifierState
+ elif data in ("'", '"'):
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-char-in-doctype"})
+ self.stream.unget(data)
+ self.state = self.beforeDoctypePublicIdentifierState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.stream.unget(data)
+ self.state = self.beforeDoctypePublicIdentifierState
+ return True
+
+ def beforeDoctypePublicIdentifierState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ pass
+ elif data == "\"":
+ self.currentToken["publicId"] = ""
+ self.state = self.doctypePublicIdentifierDoubleQuotedState
+ elif data == "'":
+ self.currentToken["publicId"] = ""
+ self.state = self.doctypePublicIdentifierSingleQuotedState
+ elif data == ">":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-end-of-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-char-in-doctype"})
+ self.currentToken["correct"] = False
+ self.state = self.bogusDoctypeState
+ return True
+
+ def doctypePublicIdentifierDoubleQuotedState(self):
+ data = self.stream.char()
+ if data == "\"":
+ self.state = self.afterDoctypePublicIdentifierState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["publicId"] += "\uFFFD"
+ elif data == ">":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-end-of-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.currentToken["publicId"] += data
+ return True
+
+ def doctypePublicIdentifierSingleQuotedState(self):
+ data = self.stream.char()
+ if data == "'":
+ self.state = self.afterDoctypePublicIdentifierState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["publicId"] += "\uFFFD"
+ elif data == ">":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-end-of-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.currentToken["publicId"] += data
+ return True
+
+ def afterDoctypePublicIdentifierState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ self.state = self.betweenDoctypePublicAndSystemIdentifiersState
+ elif data == ">":
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data == '"':
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-char-in-doctype"})
+ self.currentToken["systemId"] = ""
+ self.state = self.doctypeSystemIdentifierDoubleQuotedState
+ elif data == "'":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-char-in-doctype"})
+ self.currentToken["systemId"] = ""
+ self.state = self.doctypeSystemIdentifierSingleQuotedState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-char-in-doctype"})
+ self.currentToken["correct"] = False
+ self.state = self.bogusDoctypeState
+ return True
+
+ def betweenDoctypePublicAndSystemIdentifiersState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ pass
+ elif data == ">":
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data == '"':
+ self.currentToken["systemId"] = ""
+ self.state = self.doctypeSystemIdentifierDoubleQuotedState
+ elif data == "'":
+ self.currentToken["systemId"] = ""
+ self.state = self.doctypeSystemIdentifierSingleQuotedState
+ elif data == EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-char-in-doctype"})
+ self.currentToken["correct"] = False
+ self.state = self.bogusDoctypeState
+ return True
+
+ def afterDoctypeSystemKeywordState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ self.state = self.beforeDoctypeSystemIdentifierState
+ elif data in ("'", '"'):
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-char-in-doctype"})
+ self.stream.unget(data)
+ self.state = self.beforeDoctypeSystemIdentifierState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.stream.unget(data)
+ self.state = self.beforeDoctypeSystemIdentifierState
+ return True
+
+ def beforeDoctypeSystemIdentifierState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ pass
+ elif data == "\"":
+ self.currentToken["systemId"] = ""
+ self.state = self.doctypeSystemIdentifierDoubleQuotedState
+ elif data == "'":
+ self.currentToken["systemId"] = ""
+ self.state = self.doctypeSystemIdentifierSingleQuotedState
+ elif data == ">":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-char-in-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-char-in-doctype"})
+ self.currentToken["correct"] = False
+ self.state = self.bogusDoctypeState
+ return True
+
+ def doctypeSystemIdentifierDoubleQuotedState(self):
+ data = self.stream.char()
+ if data == "\"":
+ self.state = self.afterDoctypeSystemIdentifierState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["systemId"] += "\uFFFD"
+ elif data == ">":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-end-of-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.currentToken["systemId"] += data
+ return True
+
+ def doctypeSystemIdentifierSingleQuotedState(self):
+ data = self.stream.char()
+ if data == "'":
+ self.state = self.afterDoctypeSystemIdentifierState
+ elif data == "\u0000":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ self.currentToken["systemId"] += "\uFFFD"
+ elif data == ">":
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-end-of-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.currentToken["systemId"] += data
+ return True
+
+ def afterDoctypeSystemIdentifierState(self):
+ data = self.stream.char()
+ if data in spaceCharacters:
+ pass
+ elif data == ">":
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data is EOF:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "eof-in-doctype"})
+ self.currentToken["correct"] = False
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
+ "unexpected-char-in-doctype"})
+ self.state = self.bogusDoctypeState
+ return True
+
+ def bogusDoctypeState(self):
+ data = self.stream.char()
+ if data == ">":
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ elif data is EOF:
+ # XXX EMIT
+ self.stream.unget(data)
+ self.tokenQueue.append(self.currentToken)
+ self.state = self.dataState
+ else:
+ pass
+ return True
+
+ def cdataSectionState(self):
+ data = []
+ while True:
+ data.append(self.stream.charsUntil("]"))
+ data.append(self.stream.charsUntil(">"))
+ char = self.stream.char()
+ if char == EOF:
+ break
+ else:
+ assert char == ">"
+ if data[-1][-2:] == "]]":
+ data[-1] = data[-1][:-2]
+ break
+ else:
+ data.append(char)
+
+ data = "".join(data) # pylint:disable=redefined-variable-type
+ # Deal with null here rather than in the parser
+ nullCount = data.count("\u0000")
+ if nullCount > 0:
+ for _ in range(nullCount):
+ self.tokenQueue.append({"type": tokenTypes["ParseError"],
+ "data": "invalid-codepoint"})
+ data = data.replace("\u0000", "\uFFFD")
+ if data:
+ self.tokenQueue.append({"type": tokenTypes["Characters"],
+ "data": data})
+ self.state = self.dataState
+ return True
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/__init__.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/__init__.py
new file mode 100644
index 0000000000..07bad5d31c
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/__init__.py
@@ -0,0 +1,5 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from .py import Trie
+
+__all__ = ["Trie"]
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py
new file mode 100644
index 0000000000..6b71975f08
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py
@@ -0,0 +1,40 @@
+from __future__ import absolute_import, division, unicode_literals
+
+try:
+ from collections.abc import Mapping
+except ImportError: # Python 2.7
+ from collections import Mapping
+
+
+class Trie(Mapping):
+ """Abstract base class for tries"""
+
+ def keys(self, prefix=None):
+ # pylint:disable=arguments-differ
+ keys = super(Trie, self).keys()
+
+ if prefix is None:
+ return set(keys)
+
+ return {x for x in keys if x.startswith(prefix)}
+
+ def has_keys_with_prefix(self, prefix):
+ for key in self.keys():
+ if key.startswith(prefix):
+ return True
+
+ return False
+
+ def longest_prefix(self, prefix):
+ if prefix in self:
+ return prefix
+
+ for i in range(1, len(prefix) + 1):
+ if prefix[:-i] in self:
+ return prefix[:-i]
+
+ raise KeyError(prefix)
+
+ def longest_prefix_item(self, prefix):
+ lprefix = self.longest_prefix(prefix)
+ return (lprefix, self[lprefix])
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/py.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/py.py
new file mode 100644
index 0000000000..c2ba3da757
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/py.py
@@ -0,0 +1,67 @@
+from __future__ import absolute_import, division, unicode_literals
+from six import text_type
+
+from bisect import bisect_left
+
+from ._base import Trie as ABCTrie
+
+
+class Trie(ABCTrie):
+ def __init__(self, data):
+ if not all(isinstance(x, text_type) for x in data.keys()):
+ raise TypeError("All keys must be strings")
+
+ self._data = data
+ self._keys = sorted(data.keys())
+ self._cachestr = ""
+ self._cachepoints = (0, len(data))
+
+ def __contains__(self, key):
+ return key in self._data
+
+ def __len__(self):
+ return len(self._data)
+
+ def __iter__(self):
+ return iter(self._data)
+
+ def __getitem__(self, key):
+ return self._data[key]
+
+ def keys(self, prefix=None):
+ if prefix is None or prefix == "" or not self._keys:
+ return set(self._keys)
+
+ if prefix.startswith(self._cachestr):
+ lo, hi = self._cachepoints
+ start = i = bisect_left(self._keys, prefix, lo, hi)
+ else:
+ start = i = bisect_left(self._keys, prefix)
+
+ keys = set()
+ if start == len(self._keys):
+ return keys
+
+ while self._keys[i].startswith(prefix):
+ keys.add(self._keys[i])
+ i += 1
+
+ self._cachestr = prefix
+ self._cachepoints = (start, i)
+
+ return keys
+
+ def has_keys_with_prefix(self, prefix):
+ if prefix in self._data:
+ return True
+
+ if prefix.startswith(self._cachestr):
+ lo, hi = self._cachepoints
+ i = bisect_left(self._keys, prefix, lo, hi)
+ else:
+ i = bisect_left(self._keys, prefix)
+
+ if i == len(self._keys):
+ return False
+
+ return self._keys[i].startswith(prefix)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_utils.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_utils.py
new file mode 100644
index 0000000000..9ea5794214
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_utils.py
@@ -0,0 +1,159 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from types import ModuleType
+
+try:
+ from collections.abc import Mapping
+except ImportError:
+ from collections import Mapping
+
+from six import text_type, PY3
+
+if PY3:
+ import xml.etree.ElementTree as default_etree
+else:
+ try:
+ import xml.etree.cElementTree as default_etree
+ except ImportError:
+ import xml.etree.ElementTree as default_etree
+
+
+__all__ = ["default_etree", "MethodDispatcher", "isSurrogatePair",
+ "surrogatePairToCodepoint", "moduleFactoryFactory",
+ "supports_lone_surrogates"]
+
+
+# Platforms not supporting lone surrogates (\uD800-\uDFFF) should be
+# caught by the below test. In general this would be any platform
+# using UTF-16 as its encoding of unicode strings, such as
+# Jython. This is because UTF-16 itself is based on the use of such
+# surrogates, and there is no mechanism to further escape such
+# escapes.
+try:
+ _x = eval('"\\uD800"') # pylint:disable=eval-used
+ if not isinstance(_x, text_type):
+ # We need this with u"" because of http://bugs.jython.org/issue2039
+ _x = eval('u"\\uD800"') # pylint:disable=eval-used
+ assert isinstance(_x, text_type)
+except Exception:
+ supports_lone_surrogates = False
+else:
+ supports_lone_surrogates = True
+
+
+class MethodDispatcher(dict):
+ """Dict with 2 special properties:
+
+ On initiation, keys that are lists, sets or tuples are converted to
+ multiple keys so accessing any one of the items in the original
+ list-like object returns the matching value
+
+ md = MethodDispatcher({("foo", "bar"):"baz"})
+ md["foo"] == "baz"
+
+ A default value which can be set through the default attribute.
+ """
+
+ def __init__(self, items=()):
+ _dictEntries = []
+ for name, value in items:
+ if isinstance(name, (list, tuple, frozenset, set)):
+ for item in name:
+ _dictEntries.append((item, value))
+ else:
+ _dictEntries.append((name, value))
+ dict.__init__(self, _dictEntries)
+ assert len(self) == len(_dictEntries)
+ self.default = None
+
+ def __getitem__(self, key):
+ return dict.get(self, key, self.default)
+
+ def __get__(self, instance, owner=None):
+ return BoundMethodDispatcher(instance, self)
+
+
+class BoundMethodDispatcher(Mapping):
+ """Wraps a MethodDispatcher, binding its return values to `instance`"""
+ def __init__(self, instance, dispatcher):
+ self.instance = instance
+ self.dispatcher = dispatcher
+
+ def __getitem__(self, key):
+ # see https://docs.python.org/3/reference/datamodel.html#object.__get__
+ # on a function, __get__ is used to bind a function to an instance as a bound method
+ return self.dispatcher[key].__get__(self.instance)
+
+ def get(self, key, default):
+ if key in self.dispatcher:
+ return self[key]
+ else:
+ return default
+
+ def __iter__(self):
+ return iter(self.dispatcher)
+
+ def __len__(self):
+ return len(self.dispatcher)
+
+ def __contains__(self, key):
+ return key in self.dispatcher
+
+
+# Some utility functions to deal with weirdness around UCS2 vs UCS4
+# python builds
+
+def isSurrogatePair(data):
+ return (len(data) == 2 and
+ ord(data[0]) >= 0xD800 and ord(data[0]) <= 0xDBFF and
+ ord(data[1]) >= 0xDC00 and ord(data[1]) <= 0xDFFF)
+
+
+def surrogatePairToCodepoint(data):
+ char_val = (0x10000 + (ord(data[0]) - 0xD800) * 0x400 +
+ (ord(data[1]) - 0xDC00))
+ return char_val
+
+# Module Factory Factory (no, this isn't Java, I know)
+# Here to stop this being duplicated all over the place.
+
+
+def moduleFactoryFactory(factory):
+ moduleCache = {}
+
+ def moduleFactory(baseModule, *args, **kwargs):
+ if isinstance(ModuleType.__name__, type("")):
+ name = "_%s_factory" % baseModule.__name__
+ else:
+ name = b"_%s_factory" % baseModule.__name__
+
+ kwargs_tuple = tuple(kwargs.items())
+
+ try:
+ return moduleCache[name][args][kwargs_tuple]
+ except KeyError:
+ mod = ModuleType(name)
+ objs = factory(baseModule, *args, **kwargs)
+ mod.__dict__.update(objs)
+ if "name" not in moduleCache:
+ moduleCache[name] = {}
+ if "args" not in moduleCache[name]:
+ moduleCache[name][args] = {}
+ if "kwargs" not in moduleCache[name][args]:
+ moduleCache[name][args][kwargs_tuple] = {}
+ moduleCache[name][args][kwargs_tuple] = mod
+ return mod
+
+ return moduleFactory
+
+
+def memoize(func):
+ cache = {}
+
+ def wrapped(*args, **kwargs):
+ key = (tuple(args), tuple(kwargs.items()))
+ if key not in cache:
+ cache[key] = func(*args, **kwargs)
+ return cache[key]
+
+ return wrapped
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/constants.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/constants.py
new file mode 100644
index 0000000000..fe3e237cd8
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/constants.py
@@ -0,0 +1,2946 @@
+from __future__ import absolute_import, division, unicode_literals
+
+import string
+
+EOF = None
+
+E = {
+ "null-character":
+ "Null character in input stream, replaced with U+FFFD.",
+ "invalid-codepoint":
+ "Invalid codepoint in stream.",
+ "incorrectly-placed-solidus":
+ "Solidus (/) incorrectly placed in tag.",
+ "incorrect-cr-newline-entity":
+ "Incorrect CR newline entity, replaced with LF.",
+ "illegal-windows-1252-entity":
+ "Entity used with illegal number (windows-1252 reference).",
+ "cant-convert-numeric-entity":
+ "Numeric entity couldn't be converted to character "
+ "(codepoint U+%(charAsInt)08x).",
+ "illegal-codepoint-for-numeric-entity":
+ "Numeric entity represents an illegal codepoint: "
+ "U+%(charAsInt)08x.",
+ "numeric-entity-without-semicolon":
+ "Numeric entity didn't end with ';'.",
+ "expected-numeric-entity-but-got-eof":
+ "Numeric entity expected. Got end of file instead.",
+ "expected-numeric-entity":
+ "Numeric entity expected but none found.",
+ "named-entity-without-semicolon":
+ "Named entity didn't end with ';'.",
+ "expected-named-entity":
+ "Named entity expected. Got none.",
+ "attributes-in-end-tag":
+ "End tag contains unexpected attributes.",
+ 'self-closing-flag-on-end-tag':
+ "End tag contains unexpected self-closing flag.",
+ "expected-tag-name-but-got-right-bracket":
+ "Expected tag name. Got '>' instead.",
+ "expected-tag-name-but-got-question-mark":
+ "Expected tag name. Got '?' instead. (HTML doesn't "
+ "support processing instructions.)",
+ "expected-tag-name":
+ "Expected tag name. Got something else instead",
+ "expected-closing-tag-but-got-right-bracket":
+ "Expected closing tag. Got '>' instead. Ignoring '</>'.",
+ "expected-closing-tag-but-got-eof":
+ "Expected closing tag. Unexpected end of file.",
+ "expected-closing-tag-but-got-char":
+ "Expected closing tag. Unexpected character '%(data)s' found.",
+ "eof-in-tag-name":
+ "Unexpected end of file in the tag name.",
+ "expected-attribute-name-but-got-eof":
+ "Unexpected end of file. Expected attribute name instead.",
+ "eof-in-attribute-name":
+ "Unexpected end of file in attribute name.",
+ "invalid-character-in-attribute-name":
+ "Invalid character in attribute name",
+ "duplicate-attribute":
+ "Dropped duplicate attribute on tag.",
+ "expected-end-of-tag-name-but-got-eof":
+ "Unexpected end of file. Expected = or end of tag.",
+ "expected-attribute-value-but-got-eof":
+ "Unexpected end of file. Expected attribute value.",
+ "expected-attribute-value-but-got-right-bracket":
+ "Expected attribute value. Got '>' instead.",
+ 'equals-in-unquoted-attribute-value':
+ "Unexpected = in unquoted attribute",
+ 'unexpected-character-in-unquoted-attribute-value':
+ "Unexpected character in unquoted attribute",
+ "invalid-character-after-attribute-name":
+ "Unexpected character after attribute name.",
+ "unexpected-character-after-attribute-value":
+ "Unexpected character after attribute value.",
+ "eof-in-attribute-value-double-quote":
+ "Unexpected end of file in attribute value (\").",
+ "eof-in-attribute-value-single-quote":
+ "Unexpected end of file in attribute value (').",
+ "eof-in-attribute-value-no-quotes":
+ "Unexpected end of file in attribute value.",
+ "unexpected-EOF-after-solidus-in-tag":
+ "Unexpected end of file in tag. Expected >",
+ "unexpected-character-after-solidus-in-tag":
+ "Unexpected character after / in tag. Expected >",
+ "expected-dashes-or-doctype":
+ "Expected '--' or 'DOCTYPE'. Not found.",
+ "unexpected-bang-after-double-dash-in-comment":
+ "Unexpected ! after -- in comment",
+ "unexpected-space-after-double-dash-in-comment":
+ "Unexpected space after -- in comment",
+ "incorrect-comment":
+ "Incorrect comment.",
+ "eof-in-comment":
+ "Unexpected end of file in comment.",
+ "eof-in-comment-end-dash":
+ "Unexpected end of file in comment (-)",
+ "unexpected-dash-after-double-dash-in-comment":
+ "Unexpected '-' after '--' found in comment.",
+ "eof-in-comment-double-dash":
+ "Unexpected end of file in comment (--).",
+ "eof-in-comment-end-space-state":
+ "Unexpected end of file in comment.",
+ "eof-in-comment-end-bang-state":
+ "Unexpected end of file in comment.",
+ "unexpected-char-in-comment":
+ "Unexpected character in comment found.",
+ "need-space-after-doctype":
+ "No space after literal string 'DOCTYPE'.",
+ "expected-doctype-name-but-got-right-bracket":
+ "Unexpected > character. Expected DOCTYPE name.",
+ "expected-doctype-name-but-got-eof":
+ "Unexpected end of file. Expected DOCTYPE name.",
+ "eof-in-doctype-name":
+ "Unexpected end of file in DOCTYPE name.",
+ "eof-in-doctype":
+ "Unexpected end of file in DOCTYPE.",
+ "expected-space-or-right-bracket-in-doctype":
+ "Expected space or '>'. Got '%(data)s'",
+ "unexpected-end-of-doctype":
+ "Unexpected end of DOCTYPE.",
+ "unexpected-char-in-doctype":
+ "Unexpected character in DOCTYPE.",
+ "eof-in-innerhtml":
+ "XXX innerHTML EOF",
+ "unexpected-doctype":
+ "Unexpected DOCTYPE. Ignored.",
+ "non-html-root":
+ "html needs to be the first start tag.",
+ "expected-doctype-but-got-eof":
+ "Unexpected End of file. Expected DOCTYPE.",
+ "unknown-doctype":
+ "Erroneous DOCTYPE.",
+ "expected-doctype-but-got-chars":
+ "Unexpected non-space characters. Expected DOCTYPE.",
+ "expected-doctype-but-got-start-tag":
+ "Unexpected start tag (%(name)s). Expected DOCTYPE.",
+ "expected-doctype-but-got-end-tag":
+ "Unexpected end tag (%(name)s). Expected DOCTYPE.",
+ "end-tag-after-implied-root":
+ "Unexpected end tag (%(name)s) after the (implied) root element.",
+ "expected-named-closing-tag-but-got-eof":
+ "Unexpected end of file. Expected end tag (%(name)s).",
+ "two-heads-are-not-better-than-one":
+ "Unexpected start tag head in existing head. Ignored.",
+ "unexpected-end-tag":
+ "Unexpected end tag (%(name)s). Ignored.",
+ "unexpected-start-tag-out-of-my-head":
+ "Unexpected start tag (%(name)s) that can be in head. Moved.",
+ "unexpected-start-tag":
+ "Unexpected start tag (%(name)s).",
+ "missing-end-tag":
+ "Missing end tag (%(name)s).",
+ "missing-end-tags":
+ "Missing end tags (%(name)s).",
+ "unexpected-start-tag-implies-end-tag":
+ "Unexpected start tag (%(startName)s) "
+ "implies end tag (%(endName)s).",
+ "unexpected-start-tag-treated-as":
+ "Unexpected start tag (%(originalName)s). Treated as %(newName)s.",
+ "deprecated-tag":
+ "Unexpected start tag %(name)s. Don't use it!",
+ "unexpected-start-tag-ignored":
+ "Unexpected start tag %(name)s. Ignored.",
+ "expected-one-end-tag-but-got-another":
+ "Unexpected end tag (%(gotName)s). "
+ "Missing end tag (%(expectedName)s).",
+ "end-tag-too-early":
+ "End tag (%(name)s) seen too early. Expected other end tag.",
+ "end-tag-too-early-named":
+ "Unexpected end tag (%(gotName)s). Expected end tag (%(expectedName)s).",
+ "end-tag-too-early-ignored":
+ "End tag (%(name)s) seen too early. Ignored.",
+ "adoption-agency-1.1":
+ "End tag (%(name)s) violates step 1, "
+ "paragraph 1 of the adoption agency algorithm.",
+ "adoption-agency-1.2":
+ "End tag (%(name)s) violates step 1, "
+ "paragraph 2 of the adoption agency algorithm.",
+ "adoption-agency-1.3":
+ "End tag (%(name)s) violates step 1, "
+ "paragraph 3 of the adoption agency algorithm.",
+ "adoption-agency-4.4":
+ "End tag (%(name)s) violates step 4, "
+ "paragraph 4 of the adoption agency algorithm.",
+ "unexpected-end-tag-treated-as":
+ "Unexpected end tag (%(originalName)s). Treated as %(newName)s.",
+ "no-end-tag":
+ "This element (%(name)s) has no end tag.",
+ "unexpected-implied-end-tag-in-table":
+ "Unexpected implied end tag (%(name)s) in the table phase.",
+ "unexpected-implied-end-tag-in-table-body":
+ "Unexpected implied end tag (%(name)s) in the table body phase.",
+ "unexpected-char-implies-table-voodoo":
+ "Unexpected non-space characters in "
+ "table context caused voodoo mode.",
+ "unexpected-hidden-input-in-table":
+ "Unexpected input with type hidden in table context.",
+ "unexpected-form-in-table":
+ "Unexpected form in table context.",
+ "unexpected-start-tag-implies-table-voodoo":
+ "Unexpected start tag (%(name)s) in "
+ "table context caused voodoo mode.",
+ "unexpected-end-tag-implies-table-voodoo":
+ "Unexpected end tag (%(name)s) in "
+ "table context caused voodoo mode.",
+ "unexpected-cell-in-table-body":
+ "Unexpected table cell start tag (%(name)s) "
+ "in the table body phase.",
+ "unexpected-cell-end-tag":
+ "Got table cell end tag (%(name)s) "
+ "while required end tags are missing.",
+ "unexpected-end-tag-in-table-body":
+ "Unexpected end tag (%(name)s) in the table body phase. Ignored.",
+ "unexpected-implied-end-tag-in-table-row":
+ "Unexpected implied end tag (%(name)s) in the table row phase.",
+ "unexpected-end-tag-in-table-row":
+ "Unexpected end tag (%(name)s) in the table row phase. Ignored.",
+ "unexpected-select-in-select":
+ "Unexpected select start tag in the select phase "
+ "treated as select end tag.",
+ "unexpected-input-in-select":
+ "Unexpected input start tag in the select phase.",
+ "unexpected-start-tag-in-select":
+ "Unexpected start tag token (%(name)s in the select phase. "
+ "Ignored.",
+ "unexpected-end-tag-in-select":
+ "Unexpected end tag (%(name)s) in the select phase. Ignored.",
+ "unexpected-table-element-start-tag-in-select-in-table":
+ "Unexpected table element start tag (%(name)s) in the select in table phase.",
+ "unexpected-table-element-end-tag-in-select-in-table":
+ "Unexpected table element end tag (%(name)s) in the select in table phase.",
+ "unexpected-char-after-body":
+ "Unexpected non-space characters in the after body phase.",
+ "unexpected-start-tag-after-body":
+ "Unexpected start tag token (%(name)s)"
+ " in the after body phase.",
+ "unexpected-end-tag-after-body":
+ "Unexpected end tag token (%(name)s)"
+ " in the after body phase.",
+ "unexpected-char-in-frameset":
+ "Unexpected characters in the frameset phase. Characters ignored.",
+ "unexpected-start-tag-in-frameset":
+ "Unexpected start tag token (%(name)s)"
+ " in the frameset phase. Ignored.",
+ "unexpected-frameset-in-frameset-innerhtml":
+ "Unexpected end tag token (frameset) "
+ "in the frameset phase (innerHTML).",
+ "unexpected-end-tag-in-frameset":
+ "Unexpected end tag token (%(name)s)"
+ " in the frameset phase. Ignored.",
+ "unexpected-char-after-frameset":
+ "Unexpected non-space characters in the "
+ "after frameset phase. Ignored.",
+ "unexpected-start-tag-after-frameset":
+ "Unexpected start tag (%(name)s)"
+ " in the after frameset phase. Ignored.",
+ "unexpected-end-tag-after-frameset":
+ "Unexpected end tag (%(name)s)"
+ " in the after frameset phase. Ignored.",
+ "unexpected-end-tag-after-body-innerhtml":
+ "Unexpected end tag after body(innerHtml)",
+ "expected-eof-but-got-char":
+ "Unexpected non-space characters. Expected end of file.",
+ "expected-eof-but-got-start-tag":
+ "Unexpected start tag (%(name)s)"
+ ". Expected end of file.",
+ "expected-eof-but-got-end-tag":
+ "Unexpected end tag (%(name)s)"
+ ". Expected end of file.",
+ "eof-in-table":
+ "Unexpected end of file. Expected table content.",
+ "eof-in-select":
+ "Unexpected end of file. Expected select content.",
+ "eof-in-frameset":
+ "Unexpected end of file. Expected frameset content.",
+ "eof-in-script-in-script":
+ "Unexpected end of file. Expected script content.",
+ "eof-in-foreign-lands":
+ "Unexpected end of file. Expected foreign content",
+ "non-void-element-with-trailing-solidus":
+ "Trailing solidus not allowed on element %(name)s",
+ "unexpected-html-element-in-foreign-content":
+ "Element %(name)s not allowed in a non-html context",
+ "unexpected-end-tag-before-html":
+ "Unexpected end tag (%(name)s) before html.",
+ "unexpected-inhead-noscript-tag":
+ "Element %(name)s not allowed in a inhead-noscript context",
+ "eof-in-head-noscript":
+ "Unexpected end of file. Expected inhead-noscript content",
+ "char-in-head-noscript":
+ "Unexpected non-space character. Expected inhead-noscript content",
+ "XXX-undefined-error":
+ "Undefined error (this sucks and should be fixed)",
+}
+
+namespaces = {
+ "html": "http://www.w3.org/1999/xhtml",
+ "mathml": "http://www.w3.org/1998/Math/MathML",
+ "svg": "http://www.w3.org/2000/svg",
+ "xlink": "http://www.w3.org/1999/xlink",
+ "xml": "http://www.w3.org/XML/1998/namespace",
+ "xmlns": "http://www.w3.org/2000/xmlns/"
+}
+
+scopingElements = frozenset([
+ (namespaces["html"], "applet"),
+ (namespaces["html"], "caption"),
+ (namespaces["html"], "html"),
+ (namespaces["html"], "marquee"),
+ (namespaces["html"], "object"),
+ (namespaces["html"], "table"),
+ (namespaces["html"], "td"),
+ (namespaces["html"], "th"),
+ (namespaces["mathml"], "mi"),
+ (namespaces["mathml"], "mo"),
+ (namespaces["mathml"], "mn"),
+ (namespaces["mathml"], "ms"),
+ (namespaces["mathml"], "mtext"),
+ (namespaces["mathml"], "annotation-xml"),
+ (namespaces["svg"], "foreignObject"),
+ (namespaces["svg"], "desc"),
+ (namespaces["svg"], "title"),
+])
+
+formattingElements = frozenset([
+ (namespaces["html"], "a"),
+ (namespaces["html"], "b"),
+ (namespaces["html"], "big"),
+ (namespaces["html"], "code"),
+ (namespaces["html"], "em"),
+ (namespaces["html"], "font"),
+ (namespaces["html"], "i"),
+ (namespaces["html"], "nobr"),
+ (namespaces["html"], "s"),
+ (namespaces["html"], "small"),
+ (namespaces["html"], "strike"),
+ (namespaces["html"], "strong"),
+ (namespaces["html"], "tt"),
+ (namespaces["html"], "u")
+])
+
+specialElements = frozenset([
+ (namespaces["html"], "address"),
+ (namespaces["html"], "applet"),
+ (namespaces["html"], "area"),
+ (namespaces["html"], "article"),
+ (namespaces["html"], "aside"),
+ (namespaces["html"], "base"),
+ (namespaces["html"], "basefont"),
+ (namespaces["html"], "bgsound"),
+ (namespaces["html"], "blockquote"),
+ (namespaces["html"], "body"),
+ (namespaces["html"], "br"),
+ (namespaces["html"], "button"),
+ (namespaces["html"], "caption"),
+ (namespaces["html"], "center"),
+ (namespaces["html"], "col"),
+ (namespaces["html"], "colgroup"),
+ (namespaces["html"], "command"),
+ (namespaces["html"], "dd"),
+ (namespaces["html"], "details"),
+ (namespaces["html"], "dir"),
+ (namespaces["html"], "div"),
+ (namespaces["html"], "dl"),
+ (namespaces["html"], "dt"),
+ (namespaces["html"], "embed"),
+ (namespaces["html"], "fieldset"),
+ (namespaces["html"], "figure"),
+ (namespaces["html"], "footer"),
+ (namespaces["html"], "form"),
+ (namespaces["html"], "frame"),
+ (namespaces["html"], "frameset"),
+ (namespaces["html"], "h1"),
+ (namespaces["html"], "h2"),
+ (namespaces["html"], "h3"),
+ (namespaces["html"], "h4"),
+ (namespaces["html"], "h5"),
+ (namespaces["html"], "h6"),
+ (namespaces["html"], "head"),
+ (namespaces["html"], "header"),
+ (namespaces["html"], "hr"),
+ (namespaces["html"], "html"),
+ (namespaces["html"], "iframe"),
+ # Note that image is commented out in the spec as "this isn't an
+ # element that can end up on the stack, so it doesn't matter,"
+ (namespaces["html"], "image"),
+ (namespaces["html"], "img"),
+ (namespaces["html"], "input"),
+ (namespaces["html"], "isindex"),
+ (namespaces["html"], "li"),
+ (namespaces["html"], "link"),
+ (namespaces["html"], "listing"),
+ (namespaces["html"], "marquee"),
+ (namespaces["html"], "menu"),
+ (namespaces["html"], "meta"),
+ (namespaces["html"], "nav"),
+ (namespaces["html"], "noembed"),
+ (namespaces["html"], "noframes"),
+ (namespaces["html"], "noscript"),
+ (namespaces["html"], "object"),
+ (namespaces["html"], "ol"),
+ (namespaces["html"], "p"),
+ (namespaces["html"], "param"),
+ (namespaces["html"], "plaintext"),
+ (namespaces["html"], "pre"),
+ (namespaces["html"], "script"),
+ (namespaces["html"], "section"),
+ (namespaces["html"], "select"),
+ (namespaces["html"], "style"),
+ (namespaces["html"], "table"),
+ (namespaces["html"], "tbody"),
+ (namespaces["html"], "td"),
+ (namespaces["html"], "textarea"),
+ (namespaces["html"], "tfoot"),
+ (namespaces["html"], "th"),
+ (namespaces["html"], "thead"),
+ (namespaces["html"], "title"),
+ (namespaces["html"], "tr"),
+ (namespaces["html"], "ul"),
+ (namespaces["html"], "wbr"),
+ (namespaces["html"], "xmp"),
+ (namespaces["svg"], "foreignObject")
+])
+
+htmlIntegrationPointElements = frozenset([
+ (namespaces["mathml"], "annotation-xml"),
+ (namespaces["svg"], "foreignObject"),
+ (namespaces["svg"], "desc"),
+ (namespaces["svg"], "title")
+])
+
+mathmlTextIntegrationPointElements = frozenset([
+ (namespaces["mathml"], "mi"),
+ (namespaces["mathml"], "mo"),
+ (namespaces["mathml"], "mn"),
+ (namespaces["mathml"], "ms"),
+ (namespaces["mathml"], "mtext")
+])
+
+adjustSVGAttributes = {
+ "attributename": "attributeName",
+ "attributetype": "attributeType",
+ "basefrequency": "baseFrequency",
+ "baseprofile": "baseProfile",
+ "calcmode": "calcMode",
+ "clippathunits": "clipPathUnits",
+ "contentscripttype": "contentScriptType",
+ "contentstyletype": "contentStyleType",
+ "diffuseconstant": "diffuseConstant",
+ "edgemode": "edgeMode",
+ "externalresourcesrequired": "externalResourcesRequired",
+ "filterres": "filterRes",
+ "filterunits": "filterUnits",
+ "glyphref": "glyphRef",
+ "gradienttransform": "gradientTransform",
+ "gradientunits": "gradientUnits",
+ "kernelmatrix": "kernelMatrix",
+ "kernelunitlength": "kernelUnitLength",
+ "keypoints": "keyPoints",
+ "keysplines": "keySplines",
+ "keytimes": "keyTimes",
+ "lengthadjust": "lengthAdjust",
+ "limitingconeangle": "limitingConeAngle",
+ "markerheight": "markerHeight",
+ "markerunits": "markerUnits",
+ "markerwidth": "markerWidth",
+ "maskcontentunits": "maskContentUnits",
+ "maskunits": "maskUnits",
+ "numoctaves": "numOctaves",
+ "pathlength": "pathLength",
+ "patterncontentunits": "patternContentUnits",
+ "patterntransform": "patternTransform",
+ "patternunits": "patternUnits",
+ "pointsatx": "pointsAtX",
+ "pointsaty": "pointsAtY",
+ "pointsatz": "pointsAtZ",
+ "preservealpha": "preserveAlpha",
+ "preserveaspectratio": "preserveAspectRatio",
+ "primitiveunits": "primitiveUnits",
+ "refx": "refX",
+ "refy": "refY",
+ "repeatcount": "repeatCount",
+ "repeatdur": "repeatDur",
+ "requiredextensions": "requiredExtensions",
+ "requiredfeatures": "requiredFeatures",
+ "specularconstant": "specularConstant",
+ "specularexponent": "specularExponent",
+ "spreadmethod": "spreadMethod",
+ "startoffset": "startOffset",
+ "stddeviation": "stdDeviation",
+ "stitchtiles": "stitchTiles",
+ "surfacescale": "surfaceScale",
+ "systemlanguage": "systemLanguage",
+ "tablevalues": "tableValues",
+ "targetx": "targetX",
+ "targety": "targetY",
+ "textlength": "textLength",
+ "viewbox": "viewBox",
+ "viewtarget": "viewTarget",
+ "xchannelselector": "xChannelSelector",
+ "ychannelselector": "yChannelSelector",
+ "zoomandpan": "zoomAndPan"
+}
+
+adjustMathMLAttributes = {"definitionurl": "definitionURL"}
+
+adjustForeignAttributes = {
+ "xlink:actuate": ("xlink", "actuate", namespaces["xlink"]),
+ "xlink:arcrole": ("xlink", "arcrole", namespaces["xlink"]),
+ "xlink:href": ("xlink", "href", namespaces["xlink"]),
+ "xlink:role": ("xlink", "role", namespaces["xlink"]),
+ "xlink:show": ("xlink", "show", namespaces["xlink"]),
+ "xlink:title": ("xlink", "title", namespaces["xlink"]),
+ "xlink:type": ("xlink", "type", namespaces["xlink"]),
+ "xml:base": ("xml", "base", namespaces["xml"]),
+ "xml:lang": ("xml", "lang", namespaces["xml"]),
+ "xml:space": ("xml", "space", namespaces["xml"]),
+ "xmlns": (None, "xmlns", namespaces["xmlns"]),
+ "xmlns:xlink": ("xmlns", "xlink", namespaces["xmlns"])
+}
+
+unadjustForeignAttributes = {(ns, local): qname for qname, (prefix, local, ns) in
+ adjustForeignAttributes.items()}
+
+spaceCharacters = frozenset([
+ "\t",
+ "\n",
+ "\u000C",
+ " ",
+ "\r"
+])
+
+tableInsertModeElements = frozenset([
+ "table",
+ "tbody",
+ "tfoot",
+ "thead",
+ "tr"
+])
+
+asciiLowercase = frozenset(string.ascii_lowercase)
+asciiUppercase = frozenset(string.ascii_uppercase)
+asciiLetters = frozenset(string.ascii_letters)
+digits = frozenset(string.digits)
+hexDigits = frozenset(string.hexdigits)
+
+asciiUpper2Lower = {ord(c): ord(c.lower()) for c in string.ascii_uppercase}
+
+# Heading elements need to be ordered
+headingElements = (
+ "h1",
+ "h2",
+ "h3",
+ "h4",
+ "h5",
+ "h6"
+)
+
+voidElements = frozenset([
+ "base",
+ "command",
+ "event-source",
+ "link",
+ "meta",
+ "hr",
+ "br",
+ "img",
+ "embed",
+ "param",
+ "area",
+ "col",
+ "input",
+ "source",
+ "track"
+])
+
+cdataElements = frozenset(['title', 'textarea'])
+
+rcdataElements = frozenset([
+ 'style',
+ 'script',
+ 'xmp',
+ 'iframe',
+ 'noembed',
+ 'noframes',
+ 'noscript'
+])
+
+booleanAttributes = {
+ "": frozenset(["irrelevant", "itemscope"]),
+ "style": frozenset(["scoped"]),
+ "img": frozenset(["ismap"]),
+ "audio": frozenset(["autoplay", "controls"]),
+ "video": frozenset(["autoplay", "controls"]),
+ "script": frozenset(["defer", "async"]),
+ "details": frozenset(["open"]),
+ "datagrid": frozenset(["multiple", "disabled"]),
+ "command": frozenset(["hidden", "disabled", "checked", "default"]),
+ "hr": frozenset(["noshade"]),
+ "menu": frozenset(["autosubmit"]),
+ "fieldset": frozenset(["disabled", "readonly"]),
+ "option": frozenset(["disabled", "readonly", "selected"]),
+ "optgroup": frozenset(["disabled", "readonly"]),
+ "button": frozenset(["disabled", "autofocus"]),
+ "input": frozenset(["disabled", "readonly", "required", "autofocus", "checked", "ismap"]),
+ "select": frozenset(["disabled", "readonly", "autofocus", "multiple"]),
+ "output": frozenset(["disabled", "readonly"]),
+ "iframe": frozenset(["seamless"]),
+}
+
+# entitiesWindows1252 has to be _ordered_ and needs to have an index. It
+# therefore can't be a frozenset.
+entitiesWindows1252 = (
+ 8364, # 0x80 0x20AC EURO SIGN
+ 65533, # 0x81 UNDEFINED
+ 8218, # 0x82 0x201A SINGLE LOW-9 QUOTATION MARK
+ 402, # 0x83 0x0192 LATIN SMALL LETTER F WITH HOOK
+ 8222, # 0x84 0x201E DOUBLE LOW-9 QUOTATION MARK
+ 8230, # 0x85 0x2026 HORIZONTAL ELLIPSIS
+ 8224, # 0x86 0x2020 DAGGER
+ 8225, # 0x87 0x2021 DOUBLE DAGGER
+ 710, # 0x88 0x02C6 MODIFIER LETTER CIRCUMFLEX ACCENT
+ 8240, # 0x89 0x2030 PER MILLE SIGN
+ 352, # 0x8A 0x0160 LATIN CAPITAL LETTER S WITH CARON
+ 8249, # 0x8B 0x2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ 338, # 0x8C 0x0152 LATIN CAPITAL LIGATURE OE
+ 65533, # 0x8D UNDEFINED
+ 381, # 0x8E 0x017D LATIN CAPITAL LETTER Z WITH CARON
+ 65533, # 0x8F UNDEFINED
+ 65533, # 0x90 UNDEFINED
+ 8216, # 0x91 0x2018 LEFT SINGLE QUOTATION MARK
+ 8217, # 0x92 0x2019 RIGHT SINGLE QUOTATION MARK
+ 8220, # 0x93 0x201C LEFT DOUBLE QUOTATION MARK
+ 8221, # 0x94 0x201D RIGHT DOUBLE QUOTATION MARK
+ 8226, # 0x95 0x2022 BULLET
+ 8211, # 0x96 0x2013 EN DASH
+ 8212, # 0x97 0x2014 EM DASH
+ 732, # 0x98 0x02DC SMALL TILDE
+ 8482, # 0x99 0x2122 TRADE MARK SIGN
+ 353, # 0x9A 0x0161 LATIN SMALL LETTER S WITH CARON
+ 8250, # 0x9B 0x203A SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ 339, # 0x9C 0x0153 LATIN SMALL LIGATURE OE
+ 65533, # 0x9D UNDEFINED
+ 382, # 0x9E 0x017E LATIN SMALL LETTER Z WITH CARON
+ 376 # 0x9F 0x0178 LATIN CAPITAL LETTER Y WITH DIAERESIS
+)
+
+xmlEntities = frozenset(['lt;', 'gt;', 'amp;', 'apos;', 'quot;'])
+
+entities = {
+ "AElig": "\xc6",
+ "AElig;": "\xc6",
+ "AMP": "&",
+ "AMP;": "&",
+ "Aacute": "\xc1",
+ "Aacute;": "\xc1",
+ "Abreve;": "\u0102",
+ "Acirc": "\xc2",
+ "Acirc;": "\xc2",
+ "Acy;": "\u0410",
+ "Afr;": "\U0001d504",
+ "Agrave": "\xc0",
+ "Agrave;": "\xc0",
+ "Alpha;": "\u0391",
+ "Amacr;": "\u0100",
+ "And;": "\u2a53",
+ "Aogon;": "\u0104",
+ "Aopf;": "\U0001d538",
+ "ApplyFunction;": "\u2061",
+ "Aring": "\xc5",
+ "Aring;": "\xc5",
+ "Ascr;": "\U0001d49c",
+ "Assign;": "\u2254",
+ "Atilde": "\xc3",
+ "Atilde;": "\xc3",
+ "Auml": "\xc4",
+ "Auml;": "\xc4",
+ "Backslash;": "\u2216",
+ "Barv;": "\u2ae7",
+ "Barwed;": "\u2306",
+ "Bcy;": "\u0411",
+ "Because;": "\u2235",
+ "Bernoullis;": "\u212c",
+ "Beta;": "\u0392",
+ "Bfr;": "\U0001d505",
+ "Bopf;": "\U0001d539",
+ "Breve;": "\u02d8",
+ "Bscr;": "\u212c",
+ "Bumpeq;": "\u224e",
+ "CHcy;": "\u0427",
+ "COPY": "\xa9",
+ "COPY;": "\xa9",
+ "Cacute;": "\u0106",
+ "Cap;": "\u22d2",
+ "CapitalDifferentialD;": "\u2145",
+ "Cayleys;": "\u212d",
+ "Ccaron;": "\u010c",
+ "Ccedil": "\xc7",
+ "Ccedil;": "\xc7",
+ "Ccirc;": "\u0108",
+ "Cconint;": "\u2230",
+ "Cdot;": "\u010a",
+ "Cedilla;": "\xb8",
+ "CenterDot;": "\xb7",
+ "Cfr;": "\u212d",
+ "Chi;": "\u03a7",
+ "CircleDot;": "\u2299",
+ "CircleMinus;": "\u2296",
+ "CirclePlus;": "\u2295",
+ "CircleTimes;": "\u2297",
+ "ClockwiseContourIntegral;": "\u2232",
+ "CloseCurlyDoubleQuote;": "\u201d",
+ "CloseCurlyQuote;": "\u2019",
+ "Colon;": "\u2237",
+ "Colone;": "\u2a74",
+ "Congruent;": "\u2261",
+ "Conint;": "\u222f",
+ "ContourIntegral;": "\u222e",
+ "Copf;": "\u2102",
+ "Coproduct;": "\u2210",
+ "CounterClockwiseContourIntegral;": "\u2233",
+ "Cross;": "\u2a2f",
+ "Cscr;": "\U0001d49e",
+ "Cup;": "\u22d3",
+ "CupCap;": "\u224d",
+ "DD;": "\u2145",
+ "DDotrahd;": "\u2911",
+ "DJcy;": "\u0402",
+ "DScy;": "\u0405",
+ "DZcy;": "\u040f",
+ "Dagger;": "\u2021",
+ "Darr;": "\u21a1",
+ "Dashv;": "\u2ae4",
+ "Dcaron;": "\u010e",
+ "Dcy;": "\u0414",
+ "Del;": "\u2207",
+ "Delta;": "\u0394",
+ "Dfr;": "\U0001d507",
+ "DiacriticalAcute;": "\xb4",
+ "DiacriticalDot;": "\u02d9",
+ "DiacriticalDoubleAcute;": "\u02dd",
+ "DiacriticalGrave;": "`",
+ "DiacriticalTilde;": "\u02dc",
+ "Diamond;": "\u22c4",
+ "DifferentialD;": "\u2146",
+ "Dopf;": "\U0001d53b",
+ "Dot;": "\xa8",
+ "DotDot;": "\u20dc",
+ "DotEqual;": "\u2250",
+ "DoubleContourIntegral;": "\u222f",
+ "DoubleDot;": "\xa8",
+ "DoubleDownArrow;": "\u21d3",
+ "DoubleLeftArrow;": "\u21d0",
+ "DoubleLeftRightArrow;": "\u21d4",
+ "DoubleLeftTee;": "\u2ae4",
+ "DoubleLongLeftArrow;": "\u27f8",
+ "DoubleLongLeftRightArrow;": "\u27fa",
+ "DoubleLongRightArrow;": "\u27f9",
+ "DoubleRightArrow;": "\u21d2",
+ "DoubleRightTee;": "\u22a8",
+ "DoubleUpArrow;": "\u21d1",
+ "DoubleUpDownArrow;": "\u21d5",
+ "DoubleVerticalBar;": "\u2225",
+ "DownArrow;": "\u2193",
+ "DownArrowBar;": "\u2913",
+ "DownArrowUpArrow;": "\u21f5",
+ "DownBreve;": "\u0311",
+ "DownLeftRightVector;": "\u2950",
+ "DownLeftTeeVector;": "\u295e",
+ "DownLeftVector;": "\u21bd",
+ "DownLeftVectorBar;": "\u2956",
+ "DownRightTeeVector;": "\u295f",
+ "DownRightVector;": "\u21c1",
+ "DownRightVectorBar;": "\u2957",
+ "DownTee;": "\u22a4",
+ "DownTeeArrow;": "\u21a7",
+ "Downarrow;": "\u21d3",
+ "Dscr;": "\U0001d49f",
+ "Dstrok;": "\u0110",
+ "ENG;": "\u014a",
+ "ETH": "\xd0",
+ "ETH;": "\xd0",
+ "Eacute": "\xc9",
+ "Eacute;": "\xc9",
+ "Ecaron;": "\u011a",
+ "Ecirc": "\xca",
+ "Ecirc;": "\xca",
+ "Ecy;": "\u042d",
+ "Edot;": "\u0116",
+ "Efr;": "\U0001d508",
+ "Egrave": "\xc8",
+ "Egrave;": "\xc8",
+ "Element;": "\u2208",
+ "Emacr;": "\u0112",
+ "EmptySmallSquare;": "\u25fb",
+ "EmptyVerySmallSquare;": "\u25ab",
+ "Eogon;": "\u0118",
+ "Eopf;": "\U0001d53c",
+ "Epsilon;": "\u0395",
+ "Equal;": "\u2a75",
+ "EqualTilde;": "\u2242",
+ "Equilibrium;": "\u21cc",
+ "Escr;": "\u2130",
+ "Esim;": "\u2a73",
+ "Eta;": "\u0397",
+ "Euml": "\xcb",
+ "Euml;": "\xcb",
+ "Exists;": "\u2203",
+ "ExponentialE;": "\u2147",
+ "Fcy;": "\u0424",
+ "Ffr;": "\U0001d509",
+ "FilledSmallSquare;": "\u25fc",
+ "FilledVerySmallSquare;": "\u25aa",
+ "Fopf;": "\U0001d53d",
+ "ForAll;": "\u2200",
+ "Fouriertrf;": "\u2131",
+ "Fscr;": "\u2131",
+ "GJcy;": "\u0403",
+ "GT": ">",
+ "GT;": ">",
+ "Gamma;": "\u0393",
+ "Gammad;": "\u03dc",
+ "Gbreve;": "\u011e",
+ "Gcedil;": "\u0122",
+ "Gcirc;": "\u011c",
+ "Gcy;": "\u0413",
+ "Gdot;": "\u0120",
+ "Gfr;": "\U0001d50a",
+ "Gg;": "\u22d9",
+ "Gopf;": "\U0001d53e",
+ "GreaterEqual;": "\u2265",
+ "GreaterEqualLess;": "\u22db",
+ "GreaterFullEqual;": "\u2267",
+ "GreaterGreater;": "\u2aa2",
+ "GreaterLess;": "\u2277",
+ "GreaterSlantEqual;": "\u2a7e",
+ "GreaterTilde;": "\u2273",
+ "Gscr;": "\U0001d4a2",
+ "Gt;": "\u226b",
+ "HARDcy;": "\u042a",
+ "Hacek;": "\u02c7",
+ "Hat;": "^",
+ "Hcirc;": "\u0124",
+ "Hfr;": "\u210c",
+ "HilbertSpace;": "\u210b",
+ "Hopf;": "\u210d",
+ "HorizontalLine;": "\u2500",
+ "Hscr;": "\u210b",
+ "Hstrok;": "\u0126",
+ "HumpDownHump;": "\u224e",
+ "HumpEqual;": "\u224f",
+ "IEcy;": "\u0415",
+ "IJlig;": "\u0132",
+ "IOcy;": "\u0401",
+ "Iacute": "\xcd",
+ "Iacute;": "\xcd",
+ "Icirc": "\xce",
+ "Icirc;": "\xce",
+ "Icy;": "\u0418",
+ "Idot;": "\u0130",
+ "Ifr;": "\u2111",
+ "Igrave": "\xcc",
+ "Igrave;": "\xcc",
+ "Im;": "\u2111",
+ "Imacr;": "\u012a",
+ "ImaginaryI;": "\u2148",
+ "Implies;": "\u21d2",
+ "Int;": "\u222c",
+ "Integral;": "\u222b",
+ "Intersection;": "\u22c2",
+ "InvisibleComma;": "\u2063",
+ "InvisibleTimes;": "\u2062",
+ "Iogon;": "\u012e",
+ "Iopf;": "\U0001d540",
+ "Iota;": "\u0399",
+ "Iscr;": "\u2110",
+ "Itilde;": "\u0128",
+ "Iukcy;": "\u0406",
+ "Iuml": "\xcf",
+ "Iuml;": "\xcf",
+ "Jcirc;": "\u0134",
+ "Jcy;": "\u0419",
+ "Jfr;": "\U0001d50d",
+ "Jopf;": "\U0001d541",
+ "Jscr;": "\U0001d4a5",
+ "Jsercy;": "\u0408",
+ "Jukcy;": "\u0404",
+ "KHcy;": "\u0425",
+ "KJcy;": "\u040c",
+ "Kappa;": "\u039a",
+ "Kcedil;": "\u0136",
+ "Kcy;": "\u041a",
+ "Kfr;": "\U0001d50e",
+ "Kopf;": "\U0001d542",
+ "Kscr;": "\U0001d4a6",
+ "LJcy;": "\u0409",
+ "LT": "<",
+ "LT;": "<",
+ "Lacute;": "\u0139",
+ "Lambda;": "\u039b",
+ "Lang;": "\u27ea",
+ "Laplacetrf;": "\u2112",
+ "Larr;": "\u219e",
+ "Lcaron;": "\u013d",
+ "Lcedil;": "\u013b",
+ "Lcy;": "\u041b",
+ "LeftAngleBracket;": "\u27e8",
+ "LeftArrow;": "\u2190",
+ "LeftArrowBar;": "\u21e4",
+ "LeftArrowRightArrow;": "\u21c6",
+ "LeftCeiling;": "\u2308",
+ "LeftDoubleBracket;": "\u27e6",
+ "LeftDownTeeVector;": "\u2961",
+ "LeftDownVector;": "\u21c3",
+ "LeftDownVectorBar;": "\u2959",
+ "LeftFloor;": "\u230a",
+ "LeftRightArrow;": "\u2194",
+ "LeftRightVector;": "\u294e",
+ "LeftTee;": "\u22a3",
+ "LeftTeeArrow;": "\u21a4",
+ "LeftTeeVector;": "\u295a",
+ "LeftTriangle;": "\u22b2",
+ "LeftTriangleBar;": "\u29cf",
+ "LeftTriangleEqual;": "\u22b4",
+ "LeftUpDownVector;": "\u2951",
+ "LeftUpTeeVector;": "\u2960",
+ "LeftUpVector;": "\u21bf",
+ "LeftUpVectorBar;": "\u2958",
+ "LeftVector;": "\u21bc",
+ "LeftVectorBar;": "\u2952",
+ "Leftarrow;": "\u21d0",
+ "Leftrightarrow;": "\u21d4",
+ "LessEqualGreater;": "\u22da",
+ "LessFullEqual;": "\u2266",
+ "LessGreater;": "\u2276",
+ "LessLess;": "\u2aa1",
+ "LessSlantEqual;": "\u2a7d",
+ "LessTilde;": "\u2272",
+ "Lfr;": "\U0001d50f",
+ "Ll;": "\u22d8",
+ "Lleftarrow;": "\u21da",
+ "Lmidot;": "\u013f",
+ "LongLeftArrow;": "\u27f5",
+ "LongLeftRightArrow;": "\u27f7",
+ "LongRightArrow;": "\u27f6",
+ "Longleftarrow;": "\u27f8",
+ "Longleftrightarrow;": "\u27fa",
+ "Longrightarrow;": "\u27f9",
+ "Lopf;": "\U0001d543",
+ "LowerLeftArrow;": "\u2199",
+ "LowerRightArrow;": "\u2198",
+ "Lscr;": "\u2112",
+ "Lsh;": "\u21b0",
+ "Lstrok;": "\u0141",
+ "Lt;": "\u226a",
+ "Map;": "\u2905",
+ "Mcy;": "\u041c",
+ "MediumSpace;": "\u205f",
+ "Mellintrf;": "\u2133",
+ "Mfr;": "\U0001d510",
+ "MinusPlus;": "\u2213",
+ "Mopf;": "\U0001d544",
+ "Mscr;": "\u2133",
+ "Mu;": "\u039c",
+ "NJcy;": "\u040a",
+ "Nacute;": "\u0143",
+ "Ncaron;": "\u0147",
+ "Ncedil;": "\u0145",
+ "Ncy;": "\u041d",
+ "NegativeMediumSpace;": "\u200b",
+ "NegativeThickSpace;": "\u200b",
+ "NegativeThinSpace;": "\u200b",
+ "NegativeVeryThinSpace;": "\u200b",
+ "NestedGreaterGreater;": "\u226b",
+ "NestedLessLess;": "\u226a",
+ "NewLine;": "\n",
+ "Nfr;": "\U0001d511",
+ "NoBreak;": "\u2060",
+ "NonBreakingSpace;": "\xa0",
+ "Nopf;": "\u2115",
+ "Not;": "\u2aec",
+ "NotCongruent;": "\u2262",
+ "NotCupCap;": "\u226d",
+ "NotDoubleVerticalBar;": "\u2226",
+ "NotElement;": "\u2209",
+ "NotEqual;": "\u2260",
+ "NotEqualTilde;": "\u2242\u0338",
+ "NotExists;": "\u2204",
+ "NotGreater;": "\u226f",
+ "NotGreaterEqual;": "\u2271",
+ "NotGreaterFullEqual;": "\u2267\u0338",
+ "NotGreaterGreater;": "\u226b\u0338",
+ "NotGreaterLess;": "\u2279",
+ "NotGreaterSlantEqual;": "\u2a7e\u0338",
+ "NotGreaterTilde;": "\u2275",
+ "NotHumpDownHump;": "\u224e\u0338",
+ "NotHumpEqual;": "\u224f\u0338",
+ "NotLeftTriangle;": "\u22ea",
+ "NotLeftTriangleBar;": "\u29cf\u0338",
+ "NotLeftTriangleEqual;": "\u22ec",
+ "NotLess;": "\u226e",
+ "NotLessEqual;": "\u2270",
+ "NotLessGreater;": "\u2278",
+ "NotLessLess;": "\u226a\u0338",
+ "NotLessSlantEqual;": "\u2a7d\u0338",
+ "NotLessTilde;": "\u2274",
+ "NotNestedGreaterGreater;": "\u2aa2\u0338",
+ "NotNestedLessLess;": "\u2aa1\u0338",
+ "NotPrecedes;": "\u2280",
+ "NotPrecedesEqual;": "\u2aaf\u0338",
+ "NotPrecedesSlantEqual;": "\u22e0",
+ "NotReverseElement;": "\u220c",
+ "NotRightTriangle;": "\u22eb",
+ "NotRightTriangleBar;": "\u29d0\u0338",
+ "NotRightTriangleEqual;": "\u22ed",
+ "NotSquareSubset;": "\u228f\u0338",
+ "NotSquareSubsetEqual;": "\u22e2",
+ "NotSquareSuperset;": "\u2290\u0338",
+ "NotSquareSupersetEqual;": "\u22e3",
+ "NotSubset;": "\u2282\u20d2",
+ "NotSubsetEqual;": "\u2288",
+ "NotSucceeds;": "\u2281",
+ "NotSucceedsEqual;": "\u2ab0\u0338",
+ "NotSucceedsSlantEqual;": "\u22e1",
+ "NotSucceedsTilde;": "\u227f\u0338",
+ "NotSuperset;": "\u2283\u20d2",
+ "NotSupersetEqual;": "\u2289",
+ "NotTilde;": "\u2241",
+ "NotTildeEqual;": "\u2244",
+ "NotTildeFullEqual;": "\u2247",
+ "NotTildeTilde;": "\u2249",
+ "NotVerticalBar;": "\u2224",
+ "Nscr;": "\U0001d4a9",
+ "Ntilde": "\xd1",
+ "Ntilde;": "\xd1",
+ "Nu;": "\u039d",
+ "OElig;": "\u0152",
+ "Oacute": "\xd3",
+ "Oacute;": "\xd3",
+ "Ocirc": "\xd4",
+ "Ocirc;": "\xd4",
+ "Ocy;": "\u041e",
+ "Odblac;": "\u0150",
+ "Ofr;": "\U0001d512",
+ "Ograve": "\xd2",
+ "Ograve;": "\xd2",
+ "Omacr;": "\u014c",
+ "Omega;": "\u03a9",
+ "Omicron;": "\u039f",
+ "Oopf;": "\U0001d546",
+ "OpenCurlyDoubleQuote;": "\u201c",
+ "OpenCurlyQuote;": "\u2018",
+ "Or;": "\u2a54",
+ "Oscr;": "\U0001d4aa",
+ "Oslash": "\xd8",
+ "Oslash;": "\xd8",
+ "Otilde": "\xd5",
+ "Otilde;": "\xd5",
+ "Otimes;": "\u2a37",
+ "Ouml": "\xd6",
+ "Ouml;": "\xd6",
+ "OverBar;": "\u203e",
+ "OverBrace;": "\u23de",
+ "OverBracket;": "\u23b4",
+ "OverParenthesis;": "\u23dc",
+ "PartialD;": "\u2202",
+ "Pcy;": "\u041f",
+ "Pfr;": "\U0001d513",
+ "Phi;": "\u03a6",
+ "Pi;": "\u03a0",
+ "PlusMinus;": "\xb1",
+ "Poincareplane;": "\u210c",
+ "Popf;": "\u2119",
+ "Pr;": "\u2abb",
+ "Precedes;": "\u227a",
+ "PrecedesEqual;": "\u2aaf",
+ "PrecedesSlantEqual;": "\u227c",
+ "PrecedesTilde;": "\u227e",
+ "Prime;": "\u2033",
+ "Product;": "\u220f",
+ "Proportion;": "\u2237",
+ "Proportional;": "\u221d",
+ "Pscr;": "\U0001d4ab",
+ "Psi;": "\u03a8",
+ "QUOT": "\"",
+ "QUOT;": "\"",
+ "Qfr;": "\U0001d514",
+ "Qopf;": "\u211a",
+ "Qscr;": "\U0001d4ac",
+ "RBarr;": "\u2910",
+ "REG": "\xae",
+ "REG;": "\xae",
+ "Racute;": "\u0154",
+ "Rang;": "\u27eb",
+ "Rarr;": "\u21a0",
+ "Rarrtl;": "\u2916",
+ "Rcaron;": "\u0158",
+ "Rcedil;": "\u0156",
+ "Rcy;": "\u0420",
+ "Re;": "\u211c",
+ "ReverseElement;": "\u220b",
+ "ReverseEquilibrium;": "\u21cb",
+ "ReverseUpEquilibrium;": "\u296f",
+ "Rfr;": "\u211c",
+ "Rho;": "\u03a1",
+ "RightAngleBracket;": "\u27e9",
+ "RightArrow;": "\u2192",
+ "RightArrowBar;": "\u21e5",
+ "RightArrowLeftArrow;": "\u21c4",
+ "RightCeiling;": "\u2309",
+ "RightDoubleBracket;": "\u27e7",
+ "RightDownTeeVector;": "\u295d",
+ "RightDownVector;": "\u21c2",
+ "RightDownVectorBar;": "\u2955",
+ "RightFloor;": "\u230b",
+ "RightTee;": "\u22a2",
+ "RightTeeArrow;": "\u21a6",
+ "RightTeeVector;": "\u295b",
+ "RightTriangle;": "\u22b3",
+ "RightTriangleBar;": "\u29d0",
+ "RightTriangleEqual;": "\u22b5",
+ "RightUpDownVector;": "\u294f",
+ "RightUpTeeVector;": "\u295c",
+ "RightUpVector;": "\u21be",
+ "RightUpVectorBar;": "\u2954",
+ "RightVector;": "\u21c0",
+ "RightVectorBar;": "\u2953",
+ "Rightarrow;": "\u21d2",
+ "Ropf;": "\u211d",
+ "RoundImplies;": "\u2970",
+ "Rrightarrow;": "\u21db",
+ "Rscr;": "\u211b",
+ "Rsh;": "\u21b1",
+ "RuleDelayed;": "\u29f4",
+ "SHCHcy;": "\u0429",
+ "SHcy;": "\u0428",
+ "SOFTcy;": "\u042c",
+ "Sacute;": "\u015a",
+ "Sc;": "\u2abc",
+ "Scaron;": "\u0160",
+ "Scedil;": "\u015e",
+ "Scirc;": "\u015c",
+ "Scy;": "\u0421",
+ "Sfr;": "\U0001d516",
+ "ShortDownArrow;": "\u2193",
+ "ShortLeftArrow;": "\u2190",
+ "ShortRightArrow;": "\u2192",
+ "ShortUpArrow;": "\u2191",
+ "Sigma;": "\u03a3",
+ "SmallCircle;": "\u2218",
+ "Sopf;": "\U0001d54a",
+ "Sqrt;": "\u221a",
+ "Square;": "\u25a1",
+ "SquareIntersection;": "\u2293",
+ "SquareSubset;": "\u228f",
+ "SquareSubsetEqual;": "\u2291",
+ "SquareSuperset;": "\u2290",
+ "SquareSupersetEqual;": "\u2292",
+ "SquareUnion;": "\u2294",
+ "Sscr;": "\U0001d4ae",
+ "Star;": "\u22c6",
+ "Sub;": "\u22d0",
+ "Subset;": "\u22d0",
+ "SubsetEqual;": "\u2286",
+ "Succeeds;": "\u227b",
+ "SucceedsEqual;": "\u2ab0",
+ "SucceedsSlantEqual;": "\u227d",
+ "SucceedsTilde;": "\u227f",
+ "SuchThat;": "\u220b",
+ "Sum;": "\u2211",
+ "Sup;": "\u22d1",
+ "Superset;": "\u2283",
+ "SupersetEqual;": "\u2287",
+ "Supset;": "\u22d1",
+ "THORN": "\xde",
+ "THORN;": "\xde",
+ "TRADE;": "\u2122",
+ "TSHcy;": "\u040b",
+ "TScy;": "\u0426",
+ "Tab;": "\t",
+ "Tau;": "\u03a4",
+ "Tcaron;": "\u0164",
+ "Tcedil;": "\u0162",
+ "Tcy;": "\u0422",
+ "Tfr;": "\U0001d517",
+ "Therefore;": "\u2234",
+ "Theta;": "\u0398",
+ "ThickSpace;": "\u205f\u200a",
+ "ThinSpace;": "\u2009",
+ "Tilde;": "\u223c",
+ "TildeEqual;": "\u2243",
+ "TildeFullEqual;": "\u2245",
+ "TildeTilde;": "\u2248",
+ "Topf;": "\U0001d54b",
+ "TripleDot;": "\u20db",
+ "Tscr;": "\U0001d4af",
+ "Tstrok;": "\u0166",
+ "Uacute": "\xda",
+ "Uacute;": "\xda",
+ "Uarr;": "\u219f",
+ "Uarrocir;": "\u2949",
+ "Ubrcy;": "\u040e",
+ "Ubreve;": "\u016c",
+ "Ucirc": "\xdb",
+ "Ucirc;": "\xdb",
+ "Ucy;": "\u0423",
+ "Udblac;": "\u0170",
+ "Ufr;": "\U0001d518",
+ "Ugrave": "\xd9",
+ "Ugrave;": "\xd9",
+ "Umacr;": "\u016a",
+ "UnderBar;": "_",
+ "UnderBrace;": "\u23df",
+ "UnderBracket;": "\u23b5",
+ "UnderParenthesis;": "\u23dd",
+ "Union;": "\u22c3",
+ "UnionPlus;": "\u228e",
+ "Uogon;": "\u0172",
+ "Uopf;": "\U0001d54c",
+ "UpArrow;": "\u2191",
+ "UpArrowBar;": "\u2912",
+ "UpArrowDownArrow;": "\u21c5",
+ "UpDownArrow;": "\u2195",
+ "UpEquilibrium;": "\u296e",
+ "UpTee;": "\u22a5",
+ "UpTeeArrow;": "\u21a5",
+ "Uparrow;": "\u21d1",
+ "Updownarrow;": "\u21d5",
+ "UpperLeftArrow;": "\u2196",
+ "UpperRightArrow;": "\u2197",
+ "Upsi;": "\u03d2",
+ "Upsilon;": "\u03a5",
+ "Uring;": "\u016e",
+ "Uscr;": "\U0001d4b0",
+ "Utilde;": "\u0168",
+ "Uuml": "\xdc",
+ "Uuml;": "\xdc",
+ "VDash;": "\u22ab",
+ "Vbar;": "\u2aeb",
+ "Vcy;": "\u0412",
+ "Vdash;": "\u22a9",
+ "Vdashl;": "\u2ae6",
+ "Vee;": "\u22c1",
+ "Verbar;": "\u2016",
+ "Vert;": "\u2016",
+ "VerticalBar;": "\u2223",
+ "VerticalLine;": "|",
+ "VerticalSeparator;": "\u2758",
+ "VerticalTilde;": "\u2240",
+ "VeryThinSpace;": "\u200a",
+ "Vfr;": "\U0001d519",
+ "Vopf;": "\U0001d54d",
+ "Vscr;": "\U0001d4b1",
+ "Vvdash;": "\u22aa",
+ "Wcirc;": "\u0174",
+ "Wedge;": "\u22c0",
+ "Wfr;": "\U0001d51a",
+ "Wopf;": "\U0001d54e",
+ "Wscr;": "\U0001d4b2",
+ "Xfr;": "\U0001d51b",
+ "Xi;": "\u039e",
+ "Xopf;": "\U0001d54f",
+ "Xscr;": "\U0001d4b3",
+ "YAcy;": "\u042f",
+ "YIcy;": "\u0407",
+ "YUcy;": "\u042e",
+ "Yacute": "\xdd",
+ "Yacute;": "\xdd",
+ "Ycirc;": "\u0176",
+ "Ycy;": "\u042b",
+ "Yfr;": "\U0001d51c",
+ "Yopf;": "\U0001d550",
+ "Yscr;": "\U0001d4b4",
+ "Yuml;": "\u0178",
+ "ZHcy;": "\u0416",
+ "Zacute;": "\u0179",
+ "Zcaron;": "\u017d",
+ "Zcy;": "\u0417",
+ "Zdot;": "\u017b",
+ "ZeroWidthSpace;": "\u200b",
+ "Zeta;": "\u0396",
+ "Zfr;": "\u2128",
+ "Zopf;": "\u2124",
+ "Zscr;": "\U0001d4b5",
+ "aacute": "\xe1",
+ "aacute;": "\xe1",
+ "abreve;": "\u0103",
+ "ac;": "\u223e",
+ "acE;": "\u223e\u0333",
+ "acd;": "\u223f",
+ "acirc": "\xe2",
+ "acirc;": "\xe2",
+ "acute": "\xb4",
+ "acute;": "\xb4",
+ "acy;": "\u0430",
+ "aelig": "\xe6",
+ "aelig;": "\xe6",
+ "af;": "\u2061",
+ "afr;": "\U0001d51e",
+ "agrave": "\xe0",
+ "agrave;": "\xe0",
+ "alefsym;": "\u2135",
+ "aleph;": "\u2135",
+ "alpha;": "\u03b1",
+ "amacr;": "\u0101",
+ "amalg;": "\u2a3f",
+ "amp": "&",
+ "amp;": "&",
+ "and;": "\u2227",
+ "andand;": "\u2a55",
+ "andd;": "\u2a5c",
+ "andslope;": "\u2a58",
+ "andv;": "\u2a5a",
+ "ang;": "\u2220",
+ "ange;": "\u29a4",
+ "angle;": "\u2220",
+ "angmsd;": "\u2221",
+ "angmsdaa;": "\u29a8",
+ "angmsdab;": "\u29a9",
+ "angmsdac;": "\u29aa",
+ "angmsdad;": "\u29ab",
+ "angmsdae;": "\u29ac",
+ "angmsdaf;": "\u29ad",
+ "angmsdag;": "\u29ae",
+ "angmsdah;": "\u29af",
+ "angrt;": "\u221f",
+ "angrtvb;": "\u22be",
+ "angrtvbd;": "\u299d",
+ "angsph;": "\u2222",
+ "angst;": "\xc5",
+ "angzarr;": "\u237c",
+ "aogon;": "\u0105",
+ "aopf;": "\U0001d552",
+ "ap;": "\u2248",
+ "apE;": "\u2a70",
+ "apacir;": "\u2a6f",
+ "ape;": "\u224a",
+ "apid;": "\u224b",
+ "apos;": "'",
+ "approx;": "\u2248",
+ "approxeq;": "\u224a",
+ "aring": "\xe5",
+ "aring;": "\xe5",
+ "ascr;": "\U0001d4b6",
+ "ast;": "*",
+ "asymp;": "\u2248",
+ "asympeq;": "\u224d",
+ "atilde": "\xe3",
+ "atilde;": "\xe3",
+ "auml": "\xe4",
+ "auml;": "\xe4",
+ "awconint;": "\u2233",
+ "awint;": "\u2a11",
+ "bNot;": "\u2aed",
+ "backcong;": "\u224c",
+ "backepsilon;": "\u03f6",
+ "backprime;": "\u2035",
+ "backsim;": "\u223d",
+ "backsimeq;": "\u22cd",
+ "barvee;": "\u22bd",
+ "barwed;": "\u2305",
+ "barwedge;": "\u2305",
+ "bbrk;": "\u23b5",
+ "bbrktbrk;": "\u23b6",
+ "bcong;": "\u224c",
+ "bcy;": "\u0431",
+ "bdquo;": "\u201e",
+ "becaus;": "\u2235",
+ "because;": "\u2235",
+ "bemptyv;": "\u29b0",
+ "bepsi;": "\u03f6",
+ "bernou;": "\u212c",
+ "beta;": "\u03b2",
+ "beth;": "\u2136",
+ "between;": "\u226c",
+ "bfr;": "\U0001d51f",
+ "bigcap;": "\u22c2",
+ "bigcirc;": "\u25ef",
+ "bigcup;": "\u22c3",
+ "bigodot;": "\u2a00",
+ "bigoplus;": "\u2a01",
+ "bigotimes;": "\u2a02",
+ "bigsqcup;": "\u2a06",
+ "bigstar;": "\u2605",
+ "bigtriangledown;": "\u25bd",
+ "bigtriangleup;": "\u25b3",
+ "biguplus;": "\u2a04",
+ "bigvee;": "\u22c1",
+ "bigwedge;": "\u22c0",
+ "bkarow;": "\u290d",
+ "blacklozenge;": "\u29eb",
+ "blacksquare;": "\u25aa",
+ "blacktriangle;": "\u25b4",
+ "blacktriangledown;": "\u25be",
+ "blacktriangleleft;": "\u25c2",
+ "blacktriangleright;": "\u25b8",
+ "blank;": "\u2423",
+ "blk12;": "\u2592",
+ "blk14;": "\u2591",
+ "blk34;": "\u2593",
+ "block;": "\u2588",
+ "bne;": "=\u20e5",
+ "bnequiv;": "\u2261\u20e5",
+ "bnot;": "\u2310",
+ "bopf;": "\U0001d553",
+ "bot;": "\u22a5",
+ "bottom;": "\u22a5",
+ "bowtie;": "\u22c8",
+ "boxDL;": "\u2557",
+ "boxDR;": "\u2554",
+ "boxDl;": "\u2556",
+ "boxDr;": "\u2553",
+ "boxH;": "\u2550",
+ "boxHD;": "\u2566",
+ "boxHU;": "\u2569",
+ "boxHd;": "\u2564",
+ "boxHu;": "\u2567",
+ "boxUL;": "\u255d",
+ "boxUR;": "\u255a",
+ "boxUl;": "\u255c",
+ "boxUr;": "\u2559",
+ "boxV;": "\u2551",
+ "boxVH;": "\u256c",
+ "boxVL;": "\u2563",
+ "boxVR;": "\u2560",
+ "boxVh;": "\u256b",
+ "boxVl;": "\u2562",
+ "boxVr;": "\u255f",
+ "boxbox;": "\u29c9",
+ "boxdL;": "\u2555",
+ "boxdR;": "\u2552",
+ "boxdl;": "\u2510",
+ "boxdr;": "\u250c",
+ "boxh;": "\u2500",
+ "boxhD;": "\u2565",
+ "boxhU;": "\u2568",
+ "boxhd;": "\u252c",
+ "boxhu;": "\u2534",
+ "boxminus;": "\u229f",
+ "boxplus;": "\u229e",
+ "boxtimes;": "\u22a0",
+ "boxuL;": "\u255b",
+ "boxuR;": "\u2558",
+ "boxul;": "\u2518",
+ "boxur;": "\u2514",
+ "boxv;": "\u2502",
+ "boxvH;": "\u256a",
+ "boxvL;": "\u2561",
+ "boxvR;": "\u255e",
+ "boxvh;": "\u253c",
+ "boxvl;": "\u2524",
+ "boxvr;": "\u251c",
+ "bprime;": "\u2035",
+ "breve;": "\u02d8",
+ "brvbar": "\xa6",
+ "brvbar;": "\xa6",
+ "bscr;": "\U0001d4b7",
+ "bsemi;": "\u204f",
+ "bsim;": "\u223d",
+ "bsime;": "\u22cd",
+ "bsol;": "\\",
+ "bsolb;": "\u29c5",
+ "bsolhsub;": "\u27c8",
+ "bull;": "\u2022",
+ "bullet;": "\u2022",
+ "bump;": "\u224e",
+ "bumpE;": "\u2aae",
+ "bumpe;": "\u224f",
+ "bumpeq;": "\u224f",
+ "cacute;": "\u0107",
+ "cap;": "\u2229",
+ "capand;": "\u2a44",
+ "capbrcup;": "\u2a49",
+ "capcap;": "\u2a4b",
+ "capcup;": "\u2a47",
+ "capdot;": "\u2a40",
+ "caps;": "\u2229\ufe00",
+ "caret;": "\u2041",
+ "caron;": "\u02c7",
+ "ccaps;": "\u2a4d",
+ "ccaron;": "\u010d",
+ "ccedil": "\xe7",
+ "ccedil;": "\xe7",
+ "ccirc;": "\u0109",
+ "ccups;": "\u2a4c",
+ "ccupssm;": "\u2a50",
+ "cdot;": "\u010b",
+ "cedil": "\xb8",
+ "cedil;": "\xb8",
+ "cemptyv;": "\u29b2",
+ "cent": "\xa2",
+ "cent;": "\xa2",
+ "centerdot;": "\xb7",
+ "cfr;": "\U0001d520",
+ "chcy;": "\u0447",
+ "check;": "\u2713",
+ "checkmark;": "\u2713",
+ "chi;": "\u03c7",
+ "cir;": "\u25cb",
+ "cirE;": "\u29c3",
+ "circ;": "\u02c6",
+ "circeq;": "\u2257",
+ "circlearrowleft;": "\u21ba",
+ "circlearrowright;": "\u21bb",
+ "circledR;": "\xae",
+ "circledS;": "\u24c8",
+ "circledast;": "\u229b",
+ "circledcirc;": "\u229a",
+ "circleddash;": "\u229d",
+ "cire;": "\u2257",
+ "cirfnint;": "\u2a10",
+ "cirmid;": "\u2aef",
+ "cirscir;": "\u29c2",
+ "clubs;": "\u2663",
+ "clubsuit;": "\u2663",
+ "colon;": ":",
+ "colone;": "\u2254",
+ "coloneq;": "\u2254",
+ "comma;": ",",
+ "commat;": "@",
+ "comp;": "\u2201",
+ "compfn;": "\u2218",
+ "complement;": "\u2201",
+ "complexes;": "\u2102",
+ "cong;": "\u2245",
+ "congdot;": "\u2a6d",
+ "conint;": "\u222e",
+ "copf;": "\U0001d554",
+ "coprod;": "\u2210",
+ "copy": "\xa9",
+ "copy;": "\xa9",
+ "copysr;": "\u2117",
+ "crarr;": "\u21b5",
+ "cross;": "\u2717",
+ "cscr;": "\U0001d4b8",
+ "csub;": "\u2acf",
+ "csube;": "\u2ad1",
+ "csup;": "\u2ad0",
+ "csupe;": "\u2ad2",
+ "ctdot;": "\u22ef",
+ "cudarrl;": "\u2938",
+ "cudarrr;": "\u2935",
+ "cuepr;": "\u22de",
+ "cuesc;": "\u22df",
+ "cularr;": "\u21b6",
+ "cularrp;": "\u293d",
+ "cup;": "\u222a",
+ "cupbrcap;": "\u2a48",
+ "cupcap;": "\u2a46",
+ "cupcup;": "\u2a4a",
+ "cupdot;": "\u228d",
+ "cupor;": "\u2a45",
+ "cups;": "\u222a\ufe00",
+ "curarr;": "\u21b7",
+ "curarrm;": "\u293c",
+ "curlyeqprec;": "\u22de",
+ "curlyeqsucc;": "\u22df",
+ "curlyvee;": "\u22ce",
+ "curlywedge;": "\u22cf",
+ "curren": "\xa4",
+ "curren;": "\xa4",
+ "curvearrowleft;": "\u21b6",
+ "curvearrowright;": "\u21b7",
+ "cuvee;": "\u22ce",
+ "cuwed;": "\u22cf",
+ "cwconint;": "\u2232",
+ "cwint;": "\u2231",
+ "cylcty;": "\u232d",
+ "dArr;": "\u21d3",
+ "dHar;": "\u2965",
+ "dagger;": "\u2020",
+ "daleth;": "\u2138",
+ "darr;": "\u2193",
+ "dash;": "\u2010",
+ "dashv;": "\u22a3",
+ "dbkarow;": "\u290f",
+ "dblac;": "\u02dd",
+ "dcaron;": "\u010f",
+ "dcy;": "\u0434",
+ "dd;": "\u2146",
+ "ddagger;": "\u2021",
+ "ddarr;": "\u21ca",
+ "ddotseq;": "\u2a77",
+ "deg": "\xb0",
+ "deg;": "\xb0",
+ "delta;": "\u03b4",
+ "demptyv;": "\u29b1",
+ "dfisht;": "\u297f",
+ "dfr;": "\U0001d521",
+ "dharl;": "\u21c3",
+ "dharr;": "\u21c2",
+ "diam;": "\u22c4",
+ "diamond;": "\u22c4",
+ "diamondsuit;": "\u2666",
+ "diams;": "\u2666",
+ "die;": "\xa8",
+ "digamma;": "\u03dd",
+ "disin;": "\u22f2",
+ "div;": "\xf7",
+ "divide": "\xf7",
+ "divide;": "\xf7",
+ "divideontimes;": "\u22c7",
+ "divonx;": "\u22c7",
+ "djcy;": "\u0452",
+ "dlcorn;": "\u231e",
+ "dlcrop;": "\u230d",
+ "dollar;": "$",
+ "dopf;": "\U0001d555",
+ "dot;": "\u02d9",
+ "doteq;": "\u2250",
+ "doteqdot;": "\u2251",
+ "dotminus;": "\u2238",
+ "dotplus;": "\u2214",
+ "dotsquare;": "\u22a1",
+ "doublebarwedge;": "\u2306",
+ "downarrow;": "\u2193",
+ "downdownarrows;": "\u21ca",
+ "downharpoonleft;": "\u21c3",
+ "downharpoonright;": "\u21c2",
+ "drbkarow;": "\u2910",
+ "drcorn;": "\u231f",
+ "drcrop;": "\u230c",
+ "dscr;": "\U0001d4b9",
+ "dscy;": "\u0455",
+ "dsol;": "\u29f6",
+ "dstrok;": "\u0111",
+ "dtdot;": "\u22f1",
+ "dtri;": "\u25bf",
+ "dtrif;": "\u25be",
+ "duarr;": "\u21f5",
+ "duhar;": "\u296f",
+ "dwangle;": "\u29a6",
+ "dzcy;": "\u045f",
+ "dzigrarr;": "\u27ff",
+ "eDDot;": "\u2a77",
+ "eDot;": "\u2251",
+ "eacute": "\xe9",
+ "eacute;": "\xe9",
+ "easter;": "\u2a6e",
+ "ecaron;": "\u011b",
+ "ecir;": "\u2256",
+ "ecirc": "\xea",
+ "ecirc;": "\xea",
+ "ecolon;": "\u2255",
+ "ecy;": "\u044d",
+ "edot;": "\u0117",
+ "ee;": "\u2147",
+ "efDot;": "\u2252",
+ "efr;": "\U0001d522",
+ "eg;": "\u2a9a",
+ "egrave": "\xe8",
+ "egrave;": "\xe8",
+ "egs;": "\u2a96",
+ "egsdot;": "\u2a98",
+ "el;": "\u2a99",
+ "elinters;": "\u23e7",
+ "ell;": "\u2113",
+ "els;": "\u2a95",
+ "elsdot;": "\u2a97",
+ "emacr;": "\u0113",
+ "empty;": "\u2205",
+ "emptyset;": "\u2205",
+ "emptyv;": "\u2205",
+ "emsp13;": "\u2004",
+ "emsp14;": "\u2005",
+ "emsp;": "\u2003",
+ "eng;": "\u014b",
+ "ensp;": "\u2002",
+ "eogon;": "\u0119",
+ "eopf;": "\U0001d556",
+ "epar;": "\u22d5",
+ "eparsl;": "\u29e3",
+ "eplus;": "\u2a71",
+ "epsi;": "\u03b5",
+ "epsilon;": "\u03b5",
+ "epsiv;": "\u03f5",
+ "eqcirc;": "\u2256",
+ "eqcolon;": "\u2255",
+ "eqsim;": "\u2242",
+ "eqslantgtr;": "\u2a96",
+ "eqslantless;": "\u2a95",
+ "equals;": "=",
+ "equest;": "\u225f",
+ "equiv;": "\u2261",
+ "equivDD;": "\u2a78",
+ "eqvparsl;": "\u29e5",
+ "erDot;": "\u2253",
+ "erarr;": "\u2971",
+ "escr;": "\u212f",
+ "esdot;": "\u2250",
+ "esim;": "\u2242",
+ "eta;": "\u03b7",
+ "eth": "\xf0",
+ "eth;": "\xf0",
+ "euml": "\xeb",
+ "euml;": "\xeb",
+ "euro;": "\u20ac",
+ "excl;": "!",
+ "exist;": "\u2203",
+ "expectation;": "\u2130",
+ "exponentiale;": "\u2147",
+ "fallingdotseq;": "\u2252",
+ "fcy;": "\u0444",
+ "female;": "\u2640",
+ "ffilig;": "\ufb03",
+ "fflig;": "\ufb00",
+ "ffllig;": "\ufb04",
+ "ffr;": "\U0001d523",
+ "filig;": "\ufb01",
+ "fjlig;": "fj",
+ "flat;": "\u266d",
+ "fllig;": "\ufb02",
+ "fltns;": "\u25b1",
+ "fnof;": "\u0192",
+ "fopf;": "\U0001d557",
+ "forall;": "\u2200",
+ "fork;": "\u22d4",
+ "forkv;": "\u2ad9",
+ "fpartint;": "\u2a0d",
+ "frac12": "\xbd",
+ "frac12;": "\xbd",
+ "frac13;": "\u2153",
+ "frac14": "\xbc",
+ "frac14;": "\xbc",
+ "frac15;": "\u2155",
+ "frac16;": "\u2159",
+ "frac18;": "\u215b",
+ "frac23;": "\u2154",
+ "frac25;": "\u2156",
+ "frac34": "\xbe",
+ "frac34;": "\xbe",
+ "frac35;": "\u2157",
+ "frac38;": "\u215c",
+ "frac45;": "\u2158",
+ "frac56;": "\u215a",
+ "frac58;": "\u215d",
+ "frac78;": "\u215e",
+ "frasl;": "\u2044",
+ "frown;": "\u2322",
+ "fscr;": "\U0001d4bb",
+ "gE;": "\u2267",
+ "gEl;": "\u2a8c",
+ "gacute;": "\u01f5",
+ "gamma;": "\u03b3",
+ "gammad;": "\u03dd",
+ "gap;": "\u2a86",
+ "gbreve;": "\u011f",
+ "gcirc;": "\u011d",
+ "gcy;": "\u0433",
+ "gdot;": "\u0121",
+ "ge;": "\u2265",
+ "gel;": "\u22db",
+ "geq;": "\u2265",
+ "geqq;": "\u2267",
+ "geqslant;": "\u2a7e",
+ "ges;": "\u2a7e",
+ "gescc;": "\u2aa9",
+ "gesdot;": "\u2a80",
+ "gesdoto;": "\u2a82",
+ "gesdotol;": "\u2a84",
+ "gesl;": "\u22db\ufe00",
+ "gesles;": "\u2a94",
+ "gfr;": "\U0001d524",
+ "gg;": "\u226b",
+ "ggg;": "\u22d9",
+ "gimel;": "\u2137",
+ "gjcy;": "\u0453",
+ "gl;": "\u2277",
+ "glE;": "\u2a92",
+ "gla;": "\u2aa5",
+ "glj;": "\u2aa4",
+ "gnE;": "\u2269",
+ "gnap;": "\u2a8a",
+ "gnapprox;": "\u2a8a",
+ "gne;": "\u2a88",
+ "gneq;": "\u2a88",
+ "gneqq;": "\u2269",
+ "gnsim;": "\u22e7",
+ "gopf;": "\U0001d558",
+ "grave;": "`",
+ "gscr;": "\u210a",
+ "gsim;": "\u2273",
+ "gsime;": "\u2a8e",
+ "gsiml;": "\u2a90",
+ "gt": ">",
+ "gt;": ">",
+ "gtcc;": "\u2aa7",
+ "gtcir;": "\u2a7a",
+ "gtdot;": "\u22d7",
+ "gtlPar;": "\u2995",
+ "gtquest;": "\u2a7c",
+ "gtrapprox;": "\u2a86",
+ "gtrarr;": "\u2978",
+ "gtrdot;": "\u22d7",
+ "gtreqless;": "\u22db",
+ "gtreqqless;": "\u2a8c",
+ "gtrless;": "\u2277",
+ "gtrsim;": "\u2273",
+ "gvertneqq;": "\u2269\ufe00",
+ "gvnE;": "\u2269\ufe00",
+ "hArr;": "\u21d4",
+ "hairsp;": "\u200a",
+ "half;": "\xbd",
+ "hamilt;": "\u210b",
+ "hardcy;": "\u044a",
+ "harr;": "\u2194",
+ "harrcir;": "\u2948",
+ "harrw;": "\u21ad",
+ "hbar;": "\u210f",
+ "hcirc;": "\u0125",
+ "hearts;": "\u2665",
+ "heartsuit;": "\u2665",
+ "hellip;": "\u2026",
+ "hercon;": "\u22b9",
+ "hfr;": "\U0001d525",
+ "hksearow;": "\u2925",
+ "hkswarow;": "\u2926",
+ "hoarr;": "\u21ff",
+ "homtht;": "\u223b",
+ "hookleftarrow;": "\u21a9",
+ "hookrightarrow;": "\u21aa",
+ "hopf;": "\U0001d559",
+ "horbar;": "\u2015",
+ "hscr;": "\U0001d4bd",
+ "hslash;": "\u210f",
+ "hstrok;": "\u0127",
+ "hybull;": "\u2043",
+ "hyphen;": "\u2010",
+ "iacute": "\xed",
+ "iacute;": "\xed",
+ "ic;": "\u2063",
+ "icirc": "\xee",
+ "icirc;": "\xee",
+ "icy;": "\u0438",
+ "iecy;": "\u0435",
+ "iexcl": "\xa1",
+ "iexcl;": "\xa1",
+ "iff;": "\u21d4",
+ "ifr;": "\U0001d526",
+ "igrave": "\xec",
+ "igrave;": "\xec",
+ "ii;": "\u2148",
+ "iiiint;": "\u2a0c",
+ "iiint;": "\u222d",
+ "iinfin;": "\u29dc",
+ "iiota;": "\u2129",
+ "ijlig;": "\u0133",
+ "imacr;": "\u012b",
+ "image;": "\u2111",
+ "imagline;": "\u2110",
+ "imagpart;": "\u2111",
+ "imath;": "\u0131",
+ "imof;": "\u22b7",
+ "imped;": "\u01b5",
+ "in;": "\u2208",
+ "incare;": "\u2105",
+ "infin;": "\u221e",
+ "infintie;": "\u29dd",
+ "inodot;": "\u0131",
+ "int;": "\u222b",
+ "intcal;": "\u22ba",
+ "integers;": "\u2124",
+ "intercal;": "\u22ba",
+ "intlarhk;": "\u2a17",
+ "intprod;": "\u2a3c",
+ "iocy;": "\u0451",
+ "iogon;": "\u012f",
+ "iopf;": "\U0001d55a",
+ "iota;": "\u03b9",
+ "iprod;": "\u2a3c",
+ "iquest": "\xbf",
+ "iquest;": "\xbf",
+ "iscr;": "\U0001d4be",
+ "isin;": "\u2208",
+ "isinE;": "\u22f9",
+ "isindot;": "\u22f5",
+ "isins;": "\u22f4",
+ "isinsv;": "\u22f3",
+ "isinv;": "\u2208",
+ "it;": "\u2062",
+ "itilde;": "\u0129",
+ "iukcy;": "\u0456",
+ "iuml": "\xef",
+ "iuml;": "\xef",
+ "jcirc;": "\u0135",
+ "jcy;": "\u0439",
+ "jfr;": "\U0001d527",
+ "jmath;": "\u0237",
+ "jopf;": "\U0001d55b",
+ "jscr;": "\U0001d4bf",
+ "jsercy;": "\u0458",
+ "jukcy;": "\u0454",
+ "kappa;": "\u03ba",
+ "kappav;": "\u03f0",
+ "kcedil;": "\u0137",
+ "kcy;": "\u043a",
+ "kfr;": "\U0001d528",
+ "kgreen;": "\u0138",
+ "khcy;": "\u0445",
+ "kjcy;": "\u045c",
+ "kopf;": "\U0001d55c",
+ "kscr;": "\U0001d4c0",
+ "lAarr;": "\u21da",
+ "lArr;": "\u21d0",
+ "lAtail;": "\u291b",
+ "lBarr;": "\u290e",
+ "lE;": "\u2266",
+ "lEg;": "\u2a8b",
+ "lHar;": "\u2962",
+ "lacute;": "\u013a",
+ "laemptyv;": "\u29b4",
+ "lagran;": "\u2112",
+ "lambda;": "\u03bb",
+ "lang;": "\u27e8",
+ "langd;": "\u2991",
+ "langle;": "\u27e8",
+ "lap;": "\u2a85",
+ "laquo": "\xab",
+ "laquo;": "\xab",
+ "larr;": "\u2190",
+ "larrb;": "\u21e4",
+ "larrbfs;": "\u291f",
+ "larrfs;": "\u291d",
+ "larrhk;": "\u21a9",
+ "larrlp;": "\u21ab",
+ "larrpl;": "\u2939",
+ "larrsim;": "\u2973",
+ "larrtl;": "\u21a2",
+ "lat;": "\u2aab",
+ "latail;": "\u2919",
+ "late;": "\u2aad",
+ "lates;": "\u2aad\ufe00",
+ "lbarr;": "\u290c",
+ "lbbrk;": "\u2772",
+ "lbrace;": "{",
+ "lbrack;": "[",
+ "lbrke;": "\u298b",
+ "lbrksld;": "\u298f",
+ "lbrkslu;": "\u298d",
+ "lcaron;": "\u013e",
+ "lcedil;": "\u013c",
+ "lceil;": "\u2308",
+ "lcub;": "{",
+ "lcy;": "\u043b",
+ "ldca;": "\u2936",
+ "ldquo;": "\u201c",
+ "ldquor;": "\u201e",
+ "ldrdhar;": "\u2967",
+ "ldrushar;": "\u294b",
+ "ldsh;": "\u21b2",
+ "le;": "\u2264",
+ "leftarrow;": "\u2190",
+ "leftarrowtail;": "\u21a2",
+ "leftharpoondown;": "\u21bd",
+ "leftharpoonup;": "\u21bc",
+ "leftleftarrows;": "\u21c7",
+ "leftrightarrow;": "\u2194",
+ "leftrightarrows;": "\u21c6",
+ "leftrightharpoons;": "\u21cb",
+ "leftrightsquigarrow;": "\u21ad",
+ "leftthreetimes;": "\u22cb",
+ "leg;": "\u22da",
+ "leq;": "\u2264",
+ "leqq;": "\u2266",
+ "leqslant;": "\u2a7d",
+ "les;": "\u2a7d",
+ "lescc;": "\u2aa8",
+ "lesdot;": "\u2a7f",
+ "lesdoto;": "\u2a81",
+ "lesdotor;": "\u2a83",
+ "lesg;": "\u22da\ufe00",
+ "lesges;": "\u2a93",
+ "lessapprox;": "\u2a85",
+ "lessdot;": "\u22d6",
+ "lesseqgtr;": "\u22da",
+ "lesseqqgtr;": "\u2a8b",
+ "lessgtr;": "\u2276",
+ "lesssim;": "\u2272",
+ "lfisht;": "\u297c",
+ "lfloor;": "\u230a",
+ "lfr;": "\U0001d529",
+ "lg;": "\u2276",
+ "lgE;": "\u2a91",
+ "lhard;": "\u21bd",
+ "lharu;": "\u21bc",
+ "lharul;": "\u296a",
+ "lhblk;": "\u2584",
+ "ljcy;": "\u0459",
+ "ll;": "\u226a",
+ "llarr;": "\u21c7",
+ "llcorner;": "\u231e",
+ "llhard;": "\u296b",
+ "lltri;": "\u25fa",
+ "lmidot;": "\u0140",
+ "lmoust;": "\u23b0",
+ "lmoustache;": "\u23b0",
+ "lnE;": "\u2268",
+ "lnap;": "\u2a89",
+ "lnapprox;": "\u2a89",
+ "lne;": "\u2a87",
+ "lneq;": "\u2a87",
+ "lneqq;": "\u2268",
+ "lnsim;": "\u22e6",
+ "loang;": "\u27ec",
+ "loarr;": "\u21fd",
+ "lobrk;": "\u27e6",
+ "longleftarrow;": "\u27f5",
+ "longleftrightarrow;": "\u27f7",
+ "longmapsto;": "\u27fc",
+ "longrightarrow;": "\u27f6",
+ "looparrowleft;": "\u21ab",
+ "looparrowright;": "\u21ac",
+ "lopar;": "\u2985",
+ "lopf;": "\U0001d55d",
+ "loplus;": "\u2a2d",
+ "lotimes;": "\u2a34",
+ "lowast;": "\u2217",
+ "lowbar;": "_",
+ "loz;": "\u25ca",
+ "lozenge;": "\u25ca",
+ "lozf;": "\u29eb",
+ "lpar;": "(",
+ "lparlt;": "\u2993",
+ "lrarr;": "\u21c6",
+ "lrcorner;": "\u231f",
+ "lrhar;": "\u21cb",
+ "lrhard;": "\u296d",
+ "lrm;": "\u200e",
+ "lrtri;": "\u22bf",
+ "lsaquo;": "\u2039",
+ "lscr;": "\U0001d4c1",
+ "lsh;": "\u21b0",
+ "lsim;": "\u2272",
+ "lsime;": "\u2a8d",
+ "lsimg;": "\u2a8f",
+ "lsqb;": "[",
+ "lsquo;": "\u2018",
+ "lsquor;": "\u201a",
+ "lstrok;": "\u0142",
+ "lt": "<",
+ "lt;": "<",
+ "ltcc;": "\u2aa6",
+ "ltcir;": "\u2a79",
+ "ltdot;": "\u22d6",
+ "lthree;": "\u22cb",
+ "ltimes;": "\u22c9",
+ "ltlarr;": "\u2976",
+ "ltquest;": "\u2a7b",
+ "ltrPar;": "\u2996",
+ "ltri;": "\u25c3",
+ "ltrie;": "\u22b4",
+ "ltrif;": "\u25c2",
+ "lurdshar;": "\u294a",
+ "luruhar;": "\u2966",
+ "lvertneqq;": "\u2268\ufe00",
+ "lvnE;": "\u2268\ufe00",
+ "mDDot;": "\u223a",
+ "macr": "\xaf",
+ "macr;": "\xaf",
+ "male;": "\u2642",
+ "malt;": "\u2720",
+ "maltese;": "\u2720",
+ "map;": "\u21a6",
+ "mapsto;": "\u21a6",
+ "mapstodown;": "\u21a7",
+ "mapstoleft;": "\u21a4",
+ "mapstoup;": "\u21a5",
+ "marker;": "\u25ae",
+ "mcomma;": "\u2a29",
+ "mcy;": "\u043c",
+ "mdash;": "\u2014",
+ "measuredangle;": "\u2221",
+ "mfr;": "\U0001d52a",
+ "mho;": "\u2127",
+ "micro": "\xb5",
+ "micro;": "\xb5",
+ "mid;": "\u2223",
+ "midast;": "*",
+ "midcir;": "\u2af0",
+ "middot": "\xb7",
+ "middot;": "\xb7",
+ "minus;": "\u2212",
+ "minusb;": "\u229f",
+ "minusd;": "\u2238",
+ "minusdu;": "\u2a2a",
+ "mlcp;": "\u2adb",
+ "mldr;": "\u2026",
+ "mnplus;": "\u2213",
+ "models;": "\u22a7",
+ "mopf;": "\U0001d55e",
+ "mp;": "\u2213",
+ "mscr;": "\U0001d4c2",
+ "mstpos;": "\u223e",
+ "mu;": "\u03bc",
+ "multimap;": "\u22b8",
+ "mumap;": "\u22b8",
+ "nGg;": "\u22d9\u0338",
+ "nGt;": "\u226b\u20d2",
+ "nGtv;": "\u226b\u0338",
+ "nLeftarrow;": "\u21cd",
+ "nLeftrightarrow;": "\u21ce",
+ "nLl;": "\u22d8\u0338",
+ "nLt;": "\u226a\u20d2",
+ "nLtv;": "\u226a\u0338",
+ "nRightarrow;": "\u21cf",
+ "nVDash;": "\u22af",
+ "nVdash;": "\u22ae",
+ "nabla;": "\u2207",
+ "nacute;": "\u0144",
+ "nang;": "\u2220\u20d2",
+ "nap;": "\u2249",
+ "napE;": "\u2a70\u0338",
+ "napid;": "\u224b\u0338",
+ "napos;": "\u0149",
+ "napprox;": "\u2249",
+ "natur;": "\u266e",
+ "natural;": "\u266e",
+ "naturals;": "\u2115",
+ "nbsp": "\xa0",
+ "nbsp;": "\xa0",
+ "nbump;": "\u224e\u0338",
+ "nbumpe;": "\u224f\u0338",
+ "ncap;": "\u2a43",
+ "ncaron;": "\u0148",
+ "ncedil;": "\u0146",
+ "ncong;": "\u2247",
+ "ncongdot;": "\u2a6d\u0338",
+ "ncup;": "\u2a42",
+ "ncy;": "\u043d",
+ "ndash;": "\u2013",
+ "ne;": "\u2260",
+ "neArr;": "\u21d7",
+ "nearhk;": "\u2924",
+ "nearr;": "\u2197",
+ "nearrow;": "\u2197",
+ "nedot;": "\u2250\u0338",
+ "nequiv;": "\u2262",
+ "nesear;": "\u2928",
+ "nesim;": "\u2242\u0338",
+ "nexist;": "\u2204",
+ "nexists;": "\u2204",
+ "nfr;": "\U0001d52b",
+ "ngE;": "\u2267\u0338",
+ "nge;": "\u2271",
+ "ngeq;": "\u2271",
+ "ngeqq;": "\u2267\u0338",
+ "ngeqslant;": "\u2a7e\u0338",
+ "nges;": "\u2a7e\u0338",
+ "ngsim;": "\u2275",
+ "ngt;": "\u226f",
+ "ngtr;": "\u226f",
+ "nhArr;": "\u21ce",
+ "nharr;": "\u21ae",
+ "nhpar;": "\u2af2",
+ "ni;": "\u220b",
+ "nis;": "\u22fc",
+ "nisd;": "\u22fa",
+ "niv;": "\u220b",
+ "njcy;": "\u045a",
+ "nlArr;": "\u21cd",
+ "nlE;": "\u2266\u0338",
+ "nlarr;": "\u219a",
+ "nldr;": "\u2025",
+ "nle;": "\u2270",
+ "nleftarrow;": "\u219a",
+ "nleftrightarrow;": "\u21ae",
+ "nleq;": "\u2270",
+ "nleqq;": "\u2266\u0338",
+ "nleqslant;": "\u2a7d\u0338",
+ "nles;": "\u2a7d\u0338",
+ "nless;": "\u226e",
+ "nlsim;": "\u2274",
+ "nlt;": "\u226e",
+ "nltri;": "\u22ea",
+ "nltrie;": "\u22ec",
+ "nmid;": "\u2224",
+ "nopf;": "\U0001d55f",
+ "not": "\xac",
+ "not;": "\xac",
+ "notin;": "\u2209",
+ "notinE;": "\u22f9\u0338",
+ "notindot;": "\u22f5\u0338",
+ "notinva;": "\u2209",
+ "notinvb;": "\u22f7",
+ "notinvc;": "\u22f6",
+ "notni;": "\u220c",
+ "notniva;": "\u220c",
+ "notnivb;": "\u22fe",
+ "notnivc;": "\u22fd",
+ "npar;": "\u2226",
+ "nparallel;": "\u2226",
+ "nparsl;": "\u2afd\u20e5",
+ "npart;": "\u2202\u0338",
+ "npolint;": "\u2a14",
+ "npr;": "\u2280",
+ "nprcue;": "\u22e0",
+ "npre;": "\u2aaf\u0338",
+ "nprec;": "\u2280",
+ "npreceq;": "\u2aaf\u0338",
+ "nrArr;": "\u21cf",
+ "nrarr;": "\u219b",
+ "nrarrc;": "\u2933\u0338",
+ "nrarrw;": "\u219d\u0338",
+ "nrightarrow;": "\u219b",
+ "nrtri;": "\u22eb",
+ "nrtrie;": "\u22ed",
+ "nsc;": "\u2281",
+ "nsccue;": "\u22e1",
+ "nsce;": "\u2ab0\u0338",
+ "nscr;": "\U0001d4c3",
+ "nshortmid;": "\u2224",
+ "nshortparallel;": "\u2226",
+ "nsim;": "\u2241",
+ "nsime;": "\u2244",
+ "nsimeq;": "\u2244",
+ "nsmid;": "\u2224",
+ "nspar;": "\u2226",
+ "nsqsube;": "\u22e2",
+ "nsqsupe;": "\u22e3",
+ "nsub;": "\u2284",
+ "nsubE;": "\u2ac5\u0338",
+ "nsube;": "\u2288",
+ "nsubset;": "\u2282\u20d2",
+ "nsubseteq;": "\u2288",
+ "nsubseteqq;": "\u2ac5\u0338",
+ "nsucc;": "\u2281",
+ "nsucceq;": "\u2ab0\u0338",
+ "nsup;": "\u2285",
+ "nsupE;": "\u2ac6\u0338",
+ "nsupe;": "\u2289",
+ "nsupset;": "\u2283\u20d2",
+ "nsupseteq;": "\u2289",
+ "nsupseteqq;": "\u2ac6\u0338",
+ "ntgl;": "\u2279",
+ "ntilde": "\xf1",
+ "ntilde;": "\xf1",
+ "ntlg;": "\u2278",
+ "ntriangleleft;": "\u22ea",
+ "ntrianglelefteq;": "\u22ec",
+ "ntriangleright;": "\u22eb",
+ "ntrianglerighteq;": "\u22ed",
+ "nu;": "\u03bd",
+ "num;": "#",
+ "numero;": "\u2116",
+ "numsp;": "\u2007",
+ "nvDash;": "\u22ad",
+ "nvHarr;": "\u2904",
+ "nvap;": "\u224d\u20d2",
+ "nvdash;": "\u22ac",
+ "nvge;": "\u2265\u20d2",
+ "nvgt;": ">\u20d2",
+ "nvinfin;": "\u29de",
+ "nvlArr;": "\u2902",
+ "nvle;": "\u2264\u20d2",
+ "nvlt;": "<\u20d2",
+ "nvltrie;": "\u22b4\u20d2",
+ "nvrArr;": "\u2903",
+ "nvrtrie;": "\u22b5\u20d2",
+ "nvsim;": "\u223c\u20d2",
+ "nwArr;": "\u21d6",
+ "nwarhk;": "\u2923",
+ "nwarr;": "\u2196",
+ "nwarrow;": "\u2196",
+ "nwnear;": "\u2927",
+ "oS;": "\u24c8",
+ "oacute": "\xf3",
+ "oacute;": "\xf3",
+ "oast;": "\u229b",
+ "ocir;": "\u229a",
+ "ocirc": "\xf4",
+ "ocirc;": "\xf4",
+ "ocy;": "\u043e",
+ "odash;": "\u229d",
+ "odblac;": "\u0151",
+ "odiv;": "\u2a38",
+ "odot;": "\u2299",
+ "odsold;": "\u29bc",
+ "oelig;": "\u0153",
+ "ofcir;": "\u29bf",
+ "ofr;": "\U0001d52c",
+ "ogon;": "\u02db",
+ "ograve": "\xf2",
+ "ograve;": "\xf2",
+ "ogt;": "\u29c1",
+ "ohbar;": "\u29b5",
+ "ohm;": "\u03a9",
+ "oint;": "\u222e",
+ "olarr;": "\u21ba",
+ "olcir;": "\u29be",
+ "olcross;": "\u29bb",
+ "oline;": "\u203e",
+ "olt;": "\u29c0",
+ "omacr;": "\u014d",
+ "omega;": "\u03c9",
+ "omicron;": "\u03bf",
+ "omid;": "\u29b6",
+ "ominus;": "\u2296",
+ "oopf;": "\U0001d560",
+ "opar;": "\u29b7",
+ "operp;": "\u29b9",
+ "oplus;": "\u2295",
+ "or;": "\u2228",
+ "orarr;": "\u21bb",
+ "ord;": "\u2a5d",
+ "order;": "\u2134",
+ "orderof;": "\u2134",
+ "ordf": "\xaa",
+ "ordf;": "\xaa",
+ "ordm": "\xba",
+ "ordm;": "\xba",
+ "origof;": "\u22b6",
+ "oror;": "\u2a56",
+ "orslope;": "\u2a57",
+ "orv;": "\u2a5b",
+ "oscr;": "\u2134",
+ "oslash": "\xf8",
+ "oslash;": "\xf8",
+ "osol;": "\u2298",
+ "otilde": "\xf5",
+ "otilde;": "\xf5",
+ "otimes;": "\u2297",
+ "otimesas;": "\u2a36",
+ "ouml": "\xf6",
+ "ouml;": "\xf6",
+ "ovbar;": "\u233d",
+ "par;": "\u2225",
+ "para": "\xb6",
+ "para;": "\xb6",
+ "parallel;": "\u2225",
+ "parsim;": "\u2af3",
+ "parsl;": "\u2afd",
+ "part;": "\u2202",
+ "pcy;": "\u043f",
+ "percnt;": "%",
+ "period;": ".",
+ "permil;": "\u2030",
+ "perp;": "\u22a5",
+ "pertenk;": "\u2031",
+ "pfr;": "\U0001d52d",
+ "phi;": "\u03c6",
+ "phiv;": "\u03d5",
+ "phmmat;": "\u2133",
+ "phone;": "\u260e",
+ "pi;": "\u03c0",
+ "pitchfork;": "\u22d4",
+ "piv;": "\u03d6",
+ "planck;": "\u210f",
+ "planckh;": "\u210e",
+ "plankv;": "\u210f",
+ "plus;": "+",
+ "plusacir;": "\u2a23",
+ "plusb;": "\u229e",
+ "pluscir;": "\u2a22",
+ "plusdo;": "\u2214",
+ "plusdu;": "\u2a25",
+ "pluse;": "\u2a72",
+ "plusmn": "\xb1",
+ "plusmn;": "\xb1",
+ "plussim;": "\u2a26",
+ "plustwo;": "\u2a27",
+ "pm;": "\xb1",
+ "pointint;": "\u2a15",
+ "popf;": "\U0001d561",
+ "pound": "\xa3",
+ "pound;": "\xa3",
+ "pr;": "\u227a",
+ "prE;": "\u2ab3",
+ "prap;": "\u2ab7",
+ "prcue;": "\u227c",
+ "pre;": "\u2aaf",
+ "prec;": "\u227a",
+ "precapprox;": "\u2ab7",
+ "preccurlyeq;": "\u227c",
+ "preceq;": "\u2aaf",
+ "precnapprox;": "\u2ab9",
+ "precneqq;": "\u2ab5",
+ "precnsim;": "\u22e8",
+ "precsim;": "\u227e",
+ "prime;": "\u2032",
+ "primes;": "\u2119",
+ "prnE;": "\u2ab5",
+ "prnap;": "\u2ab9",
+ "prnsim;": "\u22e8",
+ "prod;": "\u220f",
+ "profalar;": "\u232e",
+ "profline;": "\u2312",
+ "profsurf;": "\u2313",
+ "prop;": "\u221d",
+ "propto;": "\u221d",
+ "prsim;": "\u227e",
+ "prurel;": "\u22b0",
+ "pscr;": "\U0001d4c5",
+ "psi;": "\u03c8",
+ "puncsp;": "\u2008",
+ "qfr;": "\U0001d52e",
+ "qint;": "\u2a0c",
+ "qopf;": "\U0001d562",
+ "qprime;": "\u2057",
+ "qscr;": "\U0001d4c6",
+ "quaternions;": "\u210d",
+ "quatint;": "\u2a16",
+ "quest;": "?",
+ "questeq;": "\u225f",
+ "quot": "\"",
+ "quot;": "\"",
+ "rAarr;": "\u21db",
+ "rArr;": "\u21d2",
+ "rAtail;": "\u291c",
+ "rBarr;": "\u290f",
+ "rHar;": "\u2964",
+ "race;": "\u223d\u0331",
+ "racute;": "\u0155",
+ "radic;": "\u221a",
+ "raemptyv;": "\u29b3",
+ "rang;": "\u27e9",
+ "rangd;": "\u2992",
+ "range;": "\u29a5",
+ "rangle;": "\u27e9",
+ "raquo": "\xbb",
+ "raquo;": "\xbb",
+ "rarr;": "\u2192",
+ "rarrap;": "\u2975",
+ "rarrb;": "\u21e5",
+ "rarrbfs;": "\u2920",
+ "rarrc;": "\u2933",
+ "rarrfs;": "\u291e",
+ "rarrhk;": "\u21aa",
+ "rarrlp;": "\u21ac",
+ "rarrpl;": "\u2945",
+ "rarrsim;": "\u2974",
+ "rarrtl;": "\u21a3",
+ "rarrw;": "\u219d",
+ "ratail;": "\u291a",
+ "ratio;": "\u2236",
+ "rationals;": "\u211a",
+ "rbarr;": "\u290d",
+ "rbbrk;": "\u2773",
+ "rbrace;": "}",
+ "rbrack;": "]",
+ "rbrke;": "\u298c",
+ "rbrksld;": "\u298e",
+ "rbrkslu;": "\u2990",
+ "rcaron;": "\u0159",
+ "rcedil;": "\u0157",
+ "rceil;": "\u2309",
+ "rcub;": "}",
+ "rcy;": "\u0440",
+ "rdca;": "\u2937",
+ "rdldhar;": "\u2969",
+ "rdquo;": "\u201d",
+ "rdquor;": "\u201d",
+ "rdsh;": "\u21b3",
+ "real;": "\u211c",
+ "realine;": "\u211b",
+ "realpart;": "\u211c",
+ "reals;": "\u211d",
+ "rect;": "\u25ad",
+ "reg": "\xae",
+ "reg;": "\xae",
+ "rfisht;": "\u297d",
+ "rfloor;": "\u230b",
+ "rfr;": "\U0001d52f",
+ "rhard;": "\u21c1",
+ "rharu;": "\u21c0",
+ "rharul;": "\u296c",
+ "rho;": "\u03c1",
+ "rhov;": "\u03f1",
+ "rightarrow;": "\u2192",
+ "rightarrowtail;": "\u21a3",
+ "rightharpoondown;": "\u21c1",
+ "rightharpoonup;": "\u21c0",
+ "rightleftarrows;": "\u21c4",
+ "rightleftharpoons;": "\u21cc",
+ "rightrightarrows;": "\u21c9",
+ "rightsquigarrow;": "\u219d",
+ "rightthreetimes;": "\u22cc",
+ "ring;": "\u02da",
+ "risingdotseq;": "\u2253",
+ "rlarr;": "\u21c4",
+ "rlhar;": "\u21cc",
+ "rlm;": "\u200f",
+ "rmoust;": "\u23b1",
+ "rmoustache;": "\u23b1",
+ "rnmid;": "\u2aee",
+ "roang;": "\u27ed",
+ "roarr;": "\u21fe",
+ "robrk;": "\u27e7",
+ "ropar;": "\u2986",
+ "ropf;": "\U0001d563",
+ "roplus;": "\u2a2e",
+ "rotimes;": "\u2a35",
+ "rpar;": ")",
+ "rpargt;": "\u2994",
+ "rppolint;": "\u2a12",
+ "rrarr;": "\u21c9",
+ "rsaquo;": "\u203a",
+ "rscr;": "\U0001d4c7",
+ "rsh;": "\u21b1",
+ "rsqb;": "]",
+ "rsquo;": "\u2019",
+ "rsquor;": "\u2019",
+ "rthree;": "\u22cc",
+ "rtimes;": "\u22ca",
+ "rtri;": "\u25b9",
+ "rtrie;": "\u22b5",
+ "rtrif;": "\u25b8",
+ "rtriltri;": "\u29ce",
+ "ruluhar;": "\u2968",
+ "rx;": "\u211e",
+ "sacute;": "\u015b",
+ "sbquo;": "\u201a",
+ "sc;": "\u227b",
+ "scE;": "\u2ab4",
+ "scap;": "\u2ab8",
+ "scaron;": "\u0161",
+ "sccue;": "\u227d",
+ "sce;": "\u2ab0",
+ "scedil;": "\u015f",
+ "scirc;": "\u015d",
+ "scnE;": "\u2ab6",
+ "scnap;": "\u2aba",
+ "scnsim;": "\u22e9",
+ "scpolint;": "\u2a13",
+ "scsim;": "\u227f",
+ "scy;": "\u0441",
+ "sdot;": "\u22c5",
+ "sdotb;": "\u22a1",
+ "sdote;": "\u2a66",
+ "seArr;": "\u21d8",
+ "searhk;": "\u2925",
+ "searr;": "\u2198",
+ "searrow;": "\u2198",
+ "sect": "\xa7",
+ "sect;": "\xa7",
+ "semi;": ";",
+ "seswar;": "\u2929",
+ "setminus;": "\u2216",
+ "setmn;": "\u2216",
+ "sext;": "\u2736",
+ "sfr;": "\U0001d530",
+ "sfrown;": "\u2322",
+ "sharp;": "\u266f",
+ "shchcy;": "\u0449",
+ "shcy;": "\u0448",
+ "shortmid;": "\u2223",
+ "shortparallel;": "\u2225",
+ "shy": "\xad",
+ "shy;": "\xad",
+ "sigma;": "\u03c3",
+ "sigmaf;": "\u03c2",
+ "sigmav;": "\u03c2",
+ "sim;": "\u223c",
+ "simdot;": "\u2a6a",
+ "sime;": "\u2243",
+ "simeq;": "\u2243",
+ "simg;": "\u2a9e",
+ "simgE;": "\u2aa0",
+ "siml;": "\u2a9d",
+ "simlE;": "\u2a9f",
+ "simne;": "\u2246",
+ "simplus;": "\u2a24",
+ "simrarr;": "\u2972",
+ "slarr;": "\u2190",
+ "smallsetminus;": "\u2216",
+ "smashp;": "\u2a33",
+ "smeparsl;": "\u29e4",
+ "smid;": "\u2223",
+ "smile;": "\u2323",
+ "smt;": "\u2aaa",
+ "smte;": "\u2aac",
+ "smtes;": "\u2aac\ufe00",
+ "softcy;": "\u044c",
+ "sol;": "/",
+ "solb;": "\u29c4",
+ "solbar;": "\u233f",
+ "sopf;": "\U0001d564",
+ "spades;": "\u2660",
+ "spadesuit;": "\u2660",
+ "spar;": "\u2225",
+ "sqcap;": "\u2293",
+ "sqcaps;": "\u2293\ufe00",
+ "sqcup;": "\u2294",
+ "sqcups;": "\u2294\ufe00",
+ "sqsub;": "\u228f",
+ "sqsube;": "\u2291",
+ "sqsubset;": "\u228f",
+ "sqsubseteq;": "\u2291",
+ "sqsup;": "\u2290",
+ "sqsupe;": "\u2292",
+ "sqsupset;": "\u2290",
+ "sqsupseteq;": "\u2292",
+ "squ;": "\u25a1",
+ "square;": "\u25a1",
+ "squarf;": "\u25aa",
+ "squf;": "\u25aa",
+ "srarr;": "\u2192",
+ "sscr;": "\U0001d4c8",
+ "ssetmn;": "\u2216",
+ "ssmile;": "\u2323",
+ "sstarf;": "\u22c6",
+ "star;": "\u2606",
+ "starf;": "\u2605",
+ "straightepsilon;": "\u03f5",
+ "straightphi;": "\u03d5",
+ "strns;": "\xaf",
+ "sub;": "\u2282",
+ "subE;": "\u2ac5",
+ "subdot;": "\u2abd",
+ "sube;": "\u2286",
+ "subedot;": "\u2ac3",
+ "submult;": "\u2ac1",
+ "subnE;": "\u2acb",
+ "subne;": "\u228a",
+ "subplus;": "\u2abf",
+ "subrarr;": "\u2979",
+ "subset;": "\u2282",
+ "subseteq;": "\u2286",
+ "subseteqq;": "\u2ac5",
+ "subsetneq;": "\u228a",
+ "subsetneqq;": "\u2acb",
+ "subsim;": "\u2ac7",
+ "subsub;": "\u2ad5",
+ "subsup;": "\u2ad3",
+ "succ;": "\u227b",
+ "succapprox;": "\u2ab8",
+ "succcurlyeq;": "\u227d",
+ "succeq;": "\u2ab0",
+ "succnapprox;": "\u2aba",
+ "succneqq;": "\u2ab6",
+ "succnsim;": "\u22e9",
+ "succsim;": "\u227f",
+ "sum;": "\u2211",
+ "sung;": "\u266a",
+ "sup1": "\xb9",
+ "sup1;": "\xb9",
+ "sup2": "\xb2",
+ "sup2;": "\xb2",
+ "sup3": "\xb3",
+ "sup3;": "\xb3",
+ "sup;": "\u2283",
+ "supE;": "\u2ac6",
+ "supdot;": "\u2abe",
+ "supdsub;": "\u2ad8",
+ "supe;": "\u2287",
+ "supedot;": "\u2ac4",
+ "suphsol;": "\u27c9",
+ "suphsub;": "\u2ad7",
+ "suplarr;": "\u297b",
+ "supmult;": "\u2ac2",
+ "supnE;": "\u2acc",
+ "supne;": "\u228b",
+ "supplus;": "\u2ac0",
+ "supset;": "\u2283",
+ "supseteq;": "\u2287",
+ "supseteqq;": "\u2ac6",
+ "supsetneq;": "\u228b",
+ "supsetneqq;": "\u2acc",
+ "supsim;": "\u2ac8",
+ "supsub;": "\u2ad4",
+ "supsup;": "\u2ad6",
+ "swArr;": "\u21d9",
+ "swarhk;": "\u2926",
+ "swarr;": "\u2199",
+ "swarrow;": "\u2199",
+ "swnwar;": "\u292a",
+ "szlig": "\xdf",
+ "szlig;": "\xdf",
+ "target;": "\u2316",
+ "tau;": "\u03c4",
+ "tbrk;": "\u23b4",
+ "tcaron;": "\u0165",
+ "tcedil;": "\u0163",
+ "tcy;": "\u0442",
+ "tdot;": "\u20db",
+ "telrec;": "\u2315",
+ "tfr;": "\U0001d531",
+ "there4;": "\u2234",
+ "therefore;": "\u2234",
+ "theta;": "\u03b8",
+ "thetasym;": "\u03d1",
+ "thetav;": "\u03d1",
+ "thickapprox;": "\u2248",
+ "thicksim;": "\u223c",
+ "thinsp;": "\u2009",
+ "thkap;": "\u2248",
+ "thksim;": "\u223c",
+ "thorn": "\xfe",
+ "thorn;": "\xfe",
+ "tilde;": "\u02dc",
+ "times": "\xd7",
+ "times;": "\xd7",
+ "timesb;": "\u22a0",
+ "timesbar;": "\u2a31",
+ "timesd;": "\u2a30",
+ "tint;": "\u222d",
+ "toea;": "\u2928",
+ "top;": "\u22a4",
+ "topbot;": "\u2336",
+ "topcir;": "\u2af1",
+ "topf;": "\U0001d565",
+ "topfork;": "\u2ada",
+ "tosa;": "\u2929",
+ "tprime;": "\u2034",
+ "trade;": "\u2122",
+ "triangle;": "\u25b5",
+ "triangledown;": "\u25bf",
+ "triangleleft;": "\u25c3",
+ "trianglelefteq;": "\u22b4",
+ "triangleq;": "\u225c",
+ "triangleright;": "\u25b9",
+ "trianglerighteq;": "\u22b5",
+ "tridot;": "\u25ec",
+ "trie;": "\u225c",
+ "triminus;": "\u2a3a",
+ "triplus;": "\u2a39",
+ "trisb;": "\u29cd",
+ "tritime;": "\u2a3b",
+ "trpezium;": "\u23e2",
+ "tscr;": "\U0001d4c9",
+ "tscy;": "\u0446",
+ "tshcy;": "\u045b",
+ "tstrok;": "\u0167",
+ "twixt;": "\u226c",
+ "twoheadleftarrow;": "\u219e",
+ "twoheadrightarrow;": "\u21a0",
+ "uArr;": "\u21d1",
+ "uHar;": "\u2963",
+ "uacute": "\xfa",
+ "uacute;": "\xfa",
+ "uarr;": "\u2191",
+ "ubrcy;": "\u045e",
+ "ubreve;": "\u016d",
+ "ucirc": "\xfb",
+ "ucirc;": "\xfb",
+ "ucy;": "\u0443",
+ "udarr;": "\u21c5",
+ "udblac;": "\u0171",
+ "udhar;": "\u296e",
+ "ufisht;": "\u297e",
+ "ufr;": "\U0001d532",
+ "ugrave": "\xf9",
+ "ugrave;": "\xf9",
+ "uharl;": "\u21bf",
+ "uharr;": "\u21be",
+ "uhblk;": "\u2580",
+ "ulcorn;": "\u231c",
+ "ulcorner;": "\u231c",
+ "ulcrop;": "\u230f",
+ "ultri;": "\u25f8",
+ "umacr;": "\u016b",
+ "uml": "\xa8",
+ "uml;": "\xa8",
+ "uogon;": "\u0173",
+ "uopf;": "\U0001d566",
+ "uparrow;": "\u2191",
+ "updownarrow;": "\u2195",
+ "upharpoonleft;": "\u21bf",
+ "upharpoonright;": "\u21be",
+ "uplus;": "\u228e",
+ "upsi;": "\u03c5",
+ "upsih;": "\u03d2",
+ "upsilon;": "\u03c5",
+ "upuparrows;": "\u21c8",
+ "urcorn;": "\u231d",
+ "urcorner;": "\u231d",
+ "urcrop;": "\u230e",
+ "uring;": "\u016f",
+ "urtri;": "\u25f9",
+ "uscr;": "\U0001d4ca",
+ "utdot;": "\u22f0",
+ "utilde;": "\u0169",
+ "utri;": "\u25b5",
+ "utrif;": "\u25b4",
+ "uuarr;": "\u21c8",
+ "uuml": "\xfc",
+ "uuml;": "\xfc",
+ "uwangle;": "\u29a7",
+ "vArr;": "\u21d5",
+ "vBar;": "\u2ae8",
+ "vBarv;": "\u2ae9",
+ "vDash;": "\u22a8",
+ "vangrt;": "\u299c",
+ "varepsilon;": "\u03f5",
+ "varkappa;": "\u03f0",
+ "varnothing;": "\u2205",
+ "varphi;": "\u03d5",
+ "varpi;": "\u03d6",
+ "varpropto;": "\u221d",
+ "varr;": "\u2195",
+ "varrho;": "\u03f1",
+ "varsigma;": "\u03c2",
+ "varsubsetneq;": "\u228a\ufe00",
+ "varsubsetneqq;": "\u2acb\ufe00",
+ "varsupsetneq;": "\u228b\ufe00",
+ "varsupsetneqq;": "\u2acc\ufe00",
+ "vartheta;": "\u03d1",
+ "vartriangleleft;": "\u22b2",
+ "vartriangleright;": "\u22b3",
+ "vcy;": "\u0432",
+ "vdash;": "\u22a2",
+ "vee;": "\u2228",
+ "veebar;": "\u22bb",
+ "veeeq;": "\u225a",
+ "vellip;": "\u22ee",
+ "verbar;": "|",
+ "vert;": "|",
+ "vfr;": "\U0001d533",
+ "vltri;": "\u22b2",
+ "vnsub;": "\u2282\u20d2",
+ "vnsup;": "\u2283\u20d2",
+ "vopf;": "\U0001d567",
+ "vprop;": "\u221d",
+ "vrtri;": "\u22b3",
+ "vscr;": "\U0001d4cb",
+ "vsubnE;": "\u2acb\ufe00",
+ "vsubne;": "\u228a\ufe00",
+ "vsupnE;": "\u2acc\ufe00",
+ "vsupne;": "\u228b\ufe00",
+ "vzigzag;": "\u299a",
+ "wcirc;": "\u0175",
+ "wedbar;": "\u2a5f",
+ "wedge;": "\u2227",
+ "wedgeq;": "\u2259",
+ "weierp;": "\u2118",
+ "wfr;": "\U0001d534",
+ "wopf;": "\U0001d568",
+ "wp;": "\u2118",
+ "wr;": "\u2240",
+ "wreath;": "\u2240",
+ "wscr;": "\U0001d4cc",
+ "xcap;": "\u22c2",
+ "xcirc;": "\u25ef",
+ "xcup;": "\u22c3",
+ "xdtri;": "\u25bd",
+ "xfr;": "\U0001d535",
+ "xhArr;": "\u27fa",
+ "xharr;": "\u27f7",
+ "xi;": "\u03be",
+ "xlArr;": "\u27f8",
+ "xlarr;": "\u27f5",
+ "xmap;": "\u27fc",
+ "xnis;": "\u22fb",
+ "xodot;": "\u2a00",
+ "xopf;": "\U0001d569",
+ "xoplus;": "\u2a01",
+ "xotime;": "\u2a02",
+ "xrArr;": "\u27f9",
+ "xrarr;": "\u27f6",
+ "xscr;": "\U0001d4cd",
+ "xsqcup;": "\u2a06",
+ "xuplus;": "\u2a04",
+ "xutri;": "\u25b3",
+ "xvee;": "\u22c1",
+ "xwedge;": "\u22c0",
+ "yacute": "\xfd",
+ "yacute;": "\xfd",
+ "yacy;": "\u044f",
+ "ycirc;": "\u0177",
+ "ycy;": "\u044b",
+ "yen": "\xa5",
+ "yen;": "\xa5",
+ "yfr;": "\U0001d536",
+ "yicy;": "\u0457",
+ "yopf;": "\U0001d56a",
+ "yscr;": "\U0001d4ce",
+ "yucy;": "\u044e",
+ "yuml": "\xff",
+ "yuml;": "\xff",
+ "zacute;": "\u017a",
+ "zcaron;": "\u017e",
+ "zcy;": "\u0437",
+ "zdot;": "\u017c",
+ "zeetrf;": "\u2128",
+ "zeta;": "\u03b6",
+ "zfr;": "\U0001d537",
+ "zhcy;": "\u0436",
+ "zigrarr;": "\u21dd",
+ "zopf;": "\U0001d56b",
+ "zscr;": "\U0001d4cf",
+ "zwj;": "\u200d",
+ "zwnj;": "\u200c",
+}
+
+replacementCharacters = {
+ 0x0: "\uFFFD",
+ 0x0d: "\u000D",
+ 0x80: "\u20AC",
+ 0x81: "\u0081",
+ 0x82: "\u201A",
+ 0x83: "\u0192",
+ 0x84: "\u201E",
+ 0x85: "\u2026",
+ 0x86: "\u2020",
+ 0x87: "\u2021",
+ 0x88: "\u02C6",
+ 0x89: "\u2030",
+ 0x8A: "\u0160",
+ 0x8B: "\u2039",
+ 0x8C: "\u0152",
+ 0x8D: "\u008D",
+ 0x8E: "\u017D",
+ 0x8F: "\u008F",
+ 0x90: "\u0090",
+ 0x91: "\u2018",
+ 0x92: "\u2019",
+ 0x93: "\u201C",
+ 0x94: "\u201D",
+ 0x95: "\u2022",
+ 0x96: "\u2013",
+ 0x97: "\u2014",
+ 0x98: "\u02DC",
+ 0x99: "\u2122",
+ 0x9A: "\u0161",
+ 0x9B: "\u203A",
+ 0x9C: "\u0153",
+ 0x9D: "\u009D",
+ 0x9E: "\u017E",
+ 0x9F: "\u0178",
+}
+
+tokenTypes = {
+ "Doctype": 0,
+ "Characters": 1,
+ "SpaceCharacters": 2,
+ "StartTag": 3,
+ "EndTag": 4,
+ "EmptyTag": 5,
+ "Comment": 6,
+ "ParseError": 7
+}
+
+tagTokenTypes = frozenset([tokenTypes["StartTag"], tokenTypes["EndTag"],
+ tokenTypes["EmptyTag"]])
+
+
+prefixes = {v: k for k, v in namespaces.items()}
+prefixes["http://www.w3.org/1998/Math/MathML"] = "math"
+
+
+class DataLossWarning(UserWarning):
+ """Raised when the current tree is unable to represent the input data"""
+ pass
+
+
+class _ReparseException(Exception):
+ pass
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/__init__.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/__init__.py
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/alphabeticalattributes.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/alphabeticalattributes.py
new file mode 100644
index 0000000000..5ba926e3b0
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/alphabeticalattributes.py
@@ -0,0 +1,29 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from . import base
+
+from collections import OrderedDict
+
+
+def _attr_key(attr):
+ """Return an appropriate key for an attribute for sorting
+
+ Attributes have a namespace that can be either ``None`` or a string. We
+ can't compare the two because they're different types, so we convert
+ ``None`` to an empty string first.
+
+ """
+ return (attr[0][0] or ''), attr[0][1]
+
+
+class Filter(base.Filter):
+ """Alphabetizes attributes for elements"""
+ def __iter__(self):
+ for token in base.Filter.__iter__(self):
+ if token["type"] in ("StartTag", "EmptyTag"):
+ attrs = OrderedDict()
+ for name, value in sorted(token["data"].items(),
+ key=_attr_key):
+ attrs[name] = value
+ token["data"] = attrs
+ yield token
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/base.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/base.py
new file mode 100644
index 0000000000..c7dbaed0fa
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/base.py
@@ -0,0 +1,12 @@
+from __future__ import absolute_import, division, unicode_literals
+
+
+class Filter(object):
+ def __init__(self, source):
+ self.source = source
+
+ def __iter__(self):
+ return iter(self.source)
+
+ def __getattr__(self, name):
+ return getattr(self.source, name)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/inject_meta_charset.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/inject_meta_charset.py
new file mode 100644
index 0000000000..aefb5c842c
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/inject_meta_charset.py
@@ -0,0 +1,73 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from . import base
+
+
+class Filter(base.Filter):
+ """Injects ``<meta charset=ENCODING>`` tag into head of document"""
+ def __init__(self, source, encoding):
+ """Creates a Filter
+
+ :arg source: the source token stream
+
+ :arg encoding: the encoding to set
+
+ """
+ base.Filter.__init__(self, source)
+ self.encoding = encoding
+
+ def __iter__(self):
+ state = "pre_head"
+ meta_found = (self.encoding is None)
+ pending = []
+
+ for token in base.Filter.__iter__(self):
+ type = token["type"]
+ if type == "StartTag":
+ if token["name"].lower() == "head":
+ state = "in_head"
+
+ elif type == "EmptyTag":
+ if token["name"].lower() == "meta":
+ # replace charset with actual encoding
+ has_http_equiv_content_type = False
+ for (namespace, name), value in token["data"].items():
+ if namespace is not None:
+ continue
+ elif name.lower() == 'charset':
+ token["data"][(namespace, name)] = self.encoding
+ meta_found = True
+ break
+ elif name == 'http-equiv' and value.lower() == 'content-type':
+ has_http_equiv_content_type = True
+ else:
+ if has_http_equiv_content_type and (None, "content") in token["data"]:
+ token["data"][(None, "content")] = 'text/html; charset=%s' % self.encoding
+ meta_found = True
+
+ elif token["name"].lower() == "head" and not meta_found:
+ # insert meta into empty head
+ yield {"type": "StartTag", "name": "head",
+ "data": token["data"]}
+ yield {"type": "EmptyTag", "name": "meta",
+ "data": {(None, "charset"): self.encoding}}
+ yield {"type": "EndTag", "name": "head"}
+ meta_found = True
+ continue
+
+ elif type == "EndTag":
+ if token["name"].lower() == "head" and pending:
+ # insert meta into head (if necessary) and flush pending queue
+ yield pending.pop(0)
+ if not meta_found:
+ yield {"type": "EmptyTag", "name": "meta",
+ "data": {(None, "charset"): self.encoding}}
+ while pending:
+ yield pending.pop(0)
+ meta_found = True
+ state = "post_head"
+
+ if state == "in_head":
+ pending.append(token)
+ else:
+ yield token
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/lint.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/lint.py
new file mode 100644
index 0000000000..acd4d7a2af
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/lint.py
@@ -0,0 +1,93 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from six import text_type
+
+from . import base
+from ..constants import namespaces, voidElements
+
+from ..constants import spaceCharacters
+spaceCharacters = "".join(spaceCharacters)
+
+
+class Filter(base.Filter):
+ """Lints the token stream for errors
+
+ If it finds any errors, it'll raise an ``AssertionError``.
+
+ """
+ def __init__(self, source, require_matching_tags=True):
+ """Creates a Filter
+
+ :arg source: the source token stream
+
+ :arg require_matching_tags: whether or not to require matching tags
+
+ """
+ super(Filter, self).__init__(source)
+ self.require_matching_tags = require_matching_tags
+
+ def __iter__(self):
+ open_elements = []
+ for token in base.Filter.__iter__(self):
+ type = token["type"]
+ if type in ("StartTag", "EmptyTag"):
+ namespace = token["namespace"]
+ name = token["name"]
+ assert namespace is None or isinstance(namespace, text_type)
+ assert namespace != ""
+ assert isinstance(name, text_type)
+ assert name != ""
+ assert isinstance(token["data"], dict)
+ if (not namespace or namespace == namespaces["html"]) and name in voidElements:
+ assert type == "EmptyTag"
+ else:
+ assert type == "StartTag"
+ if type == "StartTag" and self.require_matching_tags:
+ open_elements.append((namespace, name))
+ for (namespace, name), value in token["data"].items():
+ assert namespace is None or isinstance(namespace, text_type)
+ assert namespace != ""
+ assert isinstance(name, text_type)
+ assert name != ""
+ assert isinstance(value, text_type)
+
+ elif type == "EndTag":
+ namespace = token["namespace"]
+ name = token["name"]
+ assert namespace is None or isinstance(namespace, text_type)
+ assert namespace != ""
+ assert isinstance(name, text_type)
+ assert name != ""
+ if (not namespace or namespace == namespaces["html"]) and name in voidElements:
+ assert False, "Void element reported as EndTag token: %(tag)s" % {"tag": name}
+ elif self.require_matching_tags:
+ start = open_elements.pop()
+ assert start == (namespace, name)
+
+ elif type == "Comment":
+ data = token["data"]
+ assert isinstance(data, text_type)
+
+ elif type in ("Characters", "SpaceCharacters"):
+ data = token["data"]
+ assert isinstance(data, text_type)
+ assert data != ""
+ if type == "SpaceCharacters":
+ assert data.strip(spaceCharacters) == ""
+
+ elif type == "Doctype":
+ name = token["name"]
+ assert name is None or isinstance(name, text_type)
+ assert token["publicId"] is None or isinstance(name, text_type)
+ assert token["systemId"] is None or isinstance(name, text_type)
+
+ elif type == "Entity":
+ assert isinstance(token["name"], text_type)
+
+ elif type == "SerializerError":
+ assert isinstance(token["data"], text_type)
+
+ else:
+ assert False, "Unknown token type: %(type)s" % {"type": type}
+
+ yield token
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/optionaltags.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/optionaltags.py
new file mode 100644
index 0000000000..4a865012c1
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/optionaltags.py
@@ -0,0 +1,207 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from . import base
+
+
+class Filter(base.Filter):
+ """Removes optional tags from the token stream"""
+ def slider(self):
+ previous1 = previous2 = None
+ for token in self.source:
+ if previous1 is not None:
+ yield previous2, previous1, token
+ previous2 = previous1
+ previous1 = token
+ if previous1 is not None:
+ yield previous2, previous1, None
+
+ def __iter__(self):
+ for previous, token, next in self.slider():
+ type = token["type"]
+ if type == "StartTag":
+ if (token["data"] or
+ not self.is_optional_start(token["name"], previous, next)):
+ yield token
+ elif type == "EndTag":
+ if not self.is_optional_end(token["name"], next):
+ yield token
+ else:
+ yield token
+
+ def is_optional_start(self, tagname, previous, next):
+ type = next and next["type"] or None
+ if tagname in 'html':
+ # An html element's start tag may be omitted if the first thing
+ # inside the html element is not a space character or a comment.
+ return type not in ("Comment", "SpaceCharacters")
+ elif tagname == 'head':
+ # A head element's start tag may be omitted if the first thing
+ # inside the head element is an element.
+ # XXX: we also omit the start tag if the head element is empty
+ if type in ("StartTag", "EmptyTag"):
+ return True
+ elif type == "EndTag":
+ return next["name"] == "head"
+ elif tagname == 'body':
+ # A body element's start tag may be omitted if the first thing
+ # inside the body element is not a space character or a comment,
+ # except if the first thing inside the body element is a script
+ # or style element and the node immediately preceding the body
+ # element is a head element whose end tag has been omitted.
+ if type in ("Comment", "SpaceCharacters"):
+ return False
+ elif type == "StartTag":
+ # XXX: we do not look at the preceding event, so we never omit
+ # the body element's start tag if it's followed by a script or
+ # a style element.
+ return next["name"] not in ('script', 'style')
+ else:
+ return True
+ elif tagname == 'colgroup':
+ # A colgroup element's start tag may be omitted if the first thing
+ # inside the colgroup element is a col element, and if the element
+ # is not immediately preceded by another colgroup element whose
+ # end tag has been omitted.
+ if type in ("StartTag", "EmptyTag"):
+ # XXX: we do not look at the preceding event, so instead we never
+ # omit the colgroup element's end tag when it is immediately
+ # followed by another colgroup element. See is_optional_end.
+ return next["name"] == "col"
+ else:
+ return False
+ elif tagname == 'tbody':
+ # A tbody element's start tag may be omitted if the first thing
+ # inside the tbody element is a tr element, and if the element is
+ # not immediately preceded by a tbody, thead, or tfoot element
+ # whose end tag has been omitted.
+ if type == "StartTag":
+ # omit the thead and tfoot elements' end tag when they are
+ # immediately followed by a tbody element. See is_optional_end.
+ if previous and previous['type'] == 'EndTag' and \
+ previous['name'] in ('tbody', 'thead', 'tfoot'):
+ return False
+ return next["name"] == 'tr'
+ else:
+ return False
+ return False
+
+ def is_optional_end(self, tagname, next):
+ type = next and next["type"] or None
+ if tagname in ('html', 'head', 'body'):
+ # An html element's end tag may be omitted if the html element
+ # is not immediately followed by a space character or a comment.
+ return type not in ("Comment", "SpaceCharacters")
+ elif tagname in ('li', 'optgroup', 'tr'):
+ # A li element's end tag may be omitted if the li element is
+ # immediately followed by another li element or if there is
+ # no more content in the parent element.
+ # An optgroup element's end tag may be omitted if the optgroup
+ # element is immediately followed by another optgroup element,
+ # or if there is no more content in the parent element.
+ # A tr element's end tag may be omitted if the tr element is
+ # immediately followed by another tr element, or if there is
+ # no more content in the parent element.
+ if type == "StartTag":
+ return next["name"] == tagname
+ else:
+ return type == "EndTag" or type is None
+ elif tagname in ('dt', 'dd'):
+ # A dt element's end tag may be omitted if the dt element is
+ # immediately followed by another dt element or a dd element.
+ # A dd element's end tag may be omitted if the dd element is
+ # immediately followed by another dd element or a dt element,
+ # or if there is no more content in the parent element.
+ if type == "StartTag":
+ return next["name"] in ('dt', 'dd')
+ elif tagname == 'dd':
+ return type == "EndTag" or type is None
+ else:
+ return False
+ elif tagname == 'p':
+ # A p element's end tag may be omitted if the p element is
+ # immediately followed by an address, article, aside,
+ # blockquote, datagrid, dialog, dir, div, dl, fieldset,
+ # footer, form, h1, h2, h3, h4, h5, h6, header, hr, menu,
+ # nav, ol, p, pre, section, table, or ul, element, or if
+ # there is no more content in the parent element.
+ if type in ("StartTag", "EmptyTag"):
+ return next["name"] in ('address', 'article', 'aside',
+ 'blockquote', 'datagrid', 'dialog',
+ 'dir', 'div', 'dl', 'fieldset', 'footer',
+ 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
+ 'header', 'hr', 'menu', 'nav', 'ol',
+ 'p', 'pre', 'section', 'table', 'ul')
+ else:
+ return type == "EndTag" or type is None
+ elif tagname == 'option':
+ # An option element's end tag may be omitted if the option
+ # element is immediately followed by another option element,
+ # or if it is immediately followed by an <code>optgroup</code>
+ # element, or if there is no more content in the parent
+ # element.
+ if type == "StartTag":
+ return next["name"] in ('option', 'optgroup')
+ else:
+ return type == "EndTag" or type is None
+ elif tagname in ('rt', 'rp'):
+ # An rt element's end tag may be omitted if the rt element is
+ # immediately followed by an rt or rp element, or if there is
+ # no more content in the parent element.
+ # An rp element's end tag may be omitted if the rp element is
+ # immediately followed by an rt or rp element, or if there is
+ # no more content in the parent element.
+ if type == "StartTag":
+ return next["name"] in ('rt', 'rp')
+ else:
+ return type == "EndTag" or type is None
+ elif tagname == 'colgroup':
+ # A colgroup element's end tag may be omitted if the colgroup
+ # element is not immediately followed by a space character or
+ # a comment.
+ if type in ("Comment", "SpaceCharacters"):
+ return False
+ elif type == "StartTag":
+ # XXX: we also look for an immediately following colgroup
+ # element. See is_optional_start.
+ return next["name"] != 'colgroup'
+ else:
+ return True
+ elif tagname in ('thead', 'tbody'):
+ # A thead element's end tag may be omitted if the thead element
+ # is immediately followed by a tbody or tfoot element.
+ # A tbody element's end tag may be omitted if the tbody element
+ # is immediately followed by a tbody or tfoot element, or if
+ # there is no more content in the parent element.
+ # A tfoot element's end tag may be omitted if the tfoot element
+ # is immediately followed by a tbody element, or if there is no
+ # more content in the parent element.
+ # XXX: we never omit the end tag when the following element is
+ # a tbody. See is_optional_start.
+ if type == "StartTag":
+ return next["name"] in ['tbody', 'tfoot']
+ elif tagname == 'tbody':
+ return type == "EndTag" or type is None
+ else:
+ return False
+ elif tagname == 'tfoot':
+ # A tfoot element's end tag may be omitted if the tfoot element
+ # is immediately followed by a tbody element, or if there is no
+ # more content in the parent element.
+ # XXX: we never omit the end tag when the following element is
+ # a tbody. See is_optional_start.
+ if type == "StartTag":
+ return next["name"] == 'tbody'
+ else:
+ return type == "EndTag" or type is None
+ elif tagname in ('td', 'th'):
+ # A td element's end tag may be omitted if the td element is
+ # immediately followed by a td or th element, or if there is
+ # no more content in the parent element.
+ # A th element's end tag may be omitted if the th element is
+ # immediately followed by a td or th element, or if there is
+ # no more content in the parent element.
+ if type == "StartTag":
+ return next["name"] in ('td', 'th')
+ else:
+ return type == "EndTag" or type is None
+ return False
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/sanitizer.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/sanitizer.py
new file mode 100644
index 0000000000..70ef90665e
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/sanitizer.py
@@ -0,0 +1,916 @@
+"""Deprecated from html5lib 1.1.
+
+See `here <https://github.com/html5lib/html5lib-python/issues/443>`_ for
+information about its deprecation; `Bleach <https://github.com/mozilla/bleach>`_
+is recommended as a replacement. Please let us know in the aforementioned issue
+if Bleach is unsuitable for your needs.
+
+"""
+from __future__ import absolute_import, division, unicode_literals
+
+import re
+import warnings
+from xml.sax.saxutils import escape, unescape
+
+from six.moves import urllib_parse as urlparse
+
+from . import base
+from ..constants import namespaces, prefixes
+
+__all__ = ["Filter"]
+
+
+_deprecation_msg = (
+ "html5lib's sanitizer is deprecated; see " +
+ "https://github.com/html5lib/html5lib-python/issues/443 and please let " +
+ "us know if Bleach is unsuitable for your needs"
+)
+
+warnings.warn(_deprecation_msg, DeprecationWarning)
+
+allowed_elements = frozenset((
+ (namespaces['html'], 'a'),
+ (namespaces['html'], 'abbr'),
+ (namespaces['html'], 'acronym'),
+ (namespaces['html'], 'address'),
+ (namespaces['html'], 'area'),
+ (namespaces['html'], 'article'),
+ (namespaces['html'], 'aside'),
+ (namespaces['html'], 'audio'),
+ (namespaces['html'], 'b'),
+ (namespaces['html'], 'big'),
+ (namespaces['html'], 'blockquote'),
+ (namespaces['html'], 'br'),
+ (namespaces['html'], 'button'),
+ (namespaces['html'], 'canvas'),
+ (namespaces['html'], 'caption'),
+ (namespaces['html'], 'center'),
+ (namespaces['html'], 'cite'),
+ (namespaces['html'], 'code'),
+ (namespaces['html'], 'col'),
+ (namespaces['html'], 'colgroup'),
+ (namespaces['html'], 'command'),
+ (namespaces['html'], 'datagrid'),
+ (namespaces['html'], 'datalist'),
+ (namespaces['html'], 'dd'),
+ (namespaces['html'], 'del'),
+ (namespaces['html'], 'details'),
+ (namespaces['html'], 'dfn'),
+ (namespaces['html'], 'dialog'),
+ (namespaces['html'], 'dir'),
+ (namespaces['html'], 'div'),
+ (namespaces['html'], 'dl'),
+ (namespaces['html'], 'dt'),
+ (namespaces['html'], 'em'),
+ (namespaces['html'], 'event-source'),
+ (namespaces['html'], 'fieldset'),
+ (namespaces['html'], 'figcaption'),
+ (namespaces['html'], 'figure'),
+ (namespaces['html'], 'footer'),
+ (namespaces['html'], 'font'),
+ (namespaces['html'], 'form'),
+ (namespaces['html'], 'header'),
+ (namespaces['html'], 'h1'),
+ (namespaces['html'], 'h2'),
+ (namespaces['html'], 'h3'),
+ (namespaces['html'], 'h4'),
+ (namespaces['html'], 'h5'),
+ (namespaces['html'], 'h6'),
+ (namespaces['html'], 'hr'),
+ (namespaces['html'], 'i'),
+ (namespaces['html'], 'img'),
+ (namespaces['html'], 'input'),
+ (namespaces['html'], 'ins'),
+ (namespaces['html'], 'keygen'),
+ (namespaces['html'], 'kbd'),
+ (namespaces['html'], 'label'),
+ (namespaces['html'], 'legend'),
+ (namespaces['html'], 'li'),
+ (namespaces['html'], 'm'),
+ (namespaces['html'], 'map'),
+ (namespaces['html'], 'menu'),
+ (namespaces['html'], 'meter'),
+ (namespaces['html'], 'multicol'),
+ (namespaces['html'], 'nav'),
+ (namespaces['html'], 'nextid'),
+ (namespaces['html'], 'ol'),
+ (namespaces['html'], 'output'),
+ (namespaces['html'], 'optgroup'),
+ (namespaces['html'], 'option'),
+ (namespaces['html'], 'p'),
+ (namespaces['html'], 'pre'),
+ (namespaces['html'], 'progress'),
+ (namespaces['html'], 'q'),
+ (namespaces['html'], 's'),
+ (namespaces['html'], 'samp'),
+ (namespaces['html'], 'section'),
+ (namespaces['html'], 'select'),
+ (namespaces['html'], 'small'),
+ (namespaces['html'], 'sound'),
+ (namespaces['html'], 'source'),
+ (namespaces['html'], 'spacer'),
+ (namespaces['html'], 'span'),
+ (namespaces['html'], 'strike'),
+ (namespaces['html'], 'strong'),
+ (namespaces['html'], 'sub'),
+ (namespaces['html'], 'sup'),
+ (namespaces['html'], 'table'),
+ (namespaces['html'], 'tbody'),
+ (namespaces['html'], 'td'),
+ (namespaces['html'], 'textarea'),
+ (namespaces['html'], 'time'),
+ (namespaces['html'], 'tfoot'),
+ (namespaces['html'], 'th'),
+ (namespaces['html'], 'thead'),
+ (namespaces['html'], 'tr'),
+ (namespaces['html'], 'tt'),
+ (namespaces['html'], 'u'),
+ (namespaces['html'], 'ul'),
+ (namespaces['html'], 'var'),
+ (namespaces['html'], 'video'),
+ (namespaces['mathml'], 'maction'),
+ (namespaces['mathml'], 'math'),
+ (namespaces['mathml'], 'merror'),
+ (namespaces['mathml'], 'mfrac'),
+ (namespaces['mathml'], 'mi'),
+ (namespaces['mathml'], 'mmultiscripts'),
+ (namespaces['mathml'], 'mn'),
+ (namespaces['mathml'], 'mo'),
+ (namespaces['mathml'], 'mover'),
+ (namespaces['mathml'], 'mpadded'),
+ (namespaces['mathml'], 'mphantom'),
+ (namespaces['mathml'], 'mprescripts'),
+ (namespaces['mathml'], 'mroot'),
+ (namespaces['mathml'], 'mrow'),
+ (namespaces['mathml'], 'mspace'),
+ (namespaces['mathml'], 'msqrt'),
+ (namespaces['mathml'], 'mstyle'),
+ (namespaces['mathml'], 'msub'),
+ (namespaces['mathml'], 'msubsup'),
+ (namespaces['mathml'], 'msup'),
+ (namespaces['mathml'], 'mtable'),
+ (namespaces['mathml'], 'mtd'),
+ (namespaces['mathml'], 'mtext'),
+ (namespaces['mathml'], 'mtr'),
+ (namespaces['mathml'], 'munder'),
+ (namespaces['mathml'], 'munderover'),
+ (namespaces['mathml'], 'none'),
+ (namespaces['svg'], 'a'),
+ (namespaces['svg'], 'animate'),
+ (namespaces['svg'], 'animateColor'),
+ (namespaces['svg'], 'animateMotion'),
+ (namespaces['svg'], 'animateTransform'),
+ (namespaces['svg'], 'clipPath'),
+ (namespaces['svg'], 'circle'),
+ (namespaces['svg'], 'defs'),
+ (namespaces['svg'], 'desc'),
+ (namespaces['svg'], 'ellipse'),
+ (namespaces['svg'], 'font-face'),
+ (namespaces['svg'], 'font-face-name'),
+ (namespaces['svg'], 'font-face-src'),
+ (namespaces['svg'], 'g'),
+ (namespaces['svg'], 'glyph'),
+ (namespaces['svg'], 'hkern'),
+ (namespaces['svg'], 'linearGradient'),
+ (namespaces['svg'], 'line'),
+ (namespaces['svg'], 'marker'),
+ (namespaces['svg'], 'metadata'),
+ (namespaces['svg'], 'missing-glyph'),
+ (namespaces['svg'], 'mpath'),
+ (namespaces['svg'], 'path'),
+ (namespaces['svg'], 'polygon'),
+ (namespaces['svg'], 'polyline'),
+ (namespaces['svg'], 'radialGradient'),
+ (namespaces['svg'], 'rect'),
+ (namespaces['svg'], 'set'),
+ (namespaces['svg'], 'stop'),
+ (namespaces['svg'], 'svg'),
+ (namespaces['svg'], 'switch'),
+ (namespaces['svg'], 'text'),
+ (namespaces['svg'], 'title'),
+ (namespaces['svg'], 'tspan'),
+ (namespaces['svg'], 'use'),
+))
+
+allowed_attributes = frozenset((
+ # HTML attributes
+ (None, 'abbr'),
+ (None, 'accept'),
+ (None, 'accept-charset'),
+ (None, 'accesskey'),
+ (None, 'action'),
+ (None, 'align'),
+ (None, 'alt'),
+ (None, 'autocomplete'),
+ (None, 'autofocus'),
+ (None, 'axis'),
+ (None, 'background'),
+ (None, 'balance'),
+ (None, 'bgcolor'),
+ (None, 'bgproperties'),
+ (None, 'border'),
+ (None, 'bordercolor'),
+ (None, 'bordercolordark'),
+ (None, 'bordercolorlight'),
+ (None, 'bottompadding'),
+ (None, 'cellpadding'),
+ (None, 'cellspacing'),
+ (None, 'ch'),
+ (None, 'challenge'),
+ (None, 'char'),
+ (None, 'charoff'),
+ (None, 'choff'),
+ (None, 'charset'),
+ (None, 'checked'),
+ (None, 'cite'),
+ (None, 'class'),
+ (None, 'clear'),
+ (None, 'color'),
+ (None, 'cols'),
+ (None, 'colspan'),
+ (None, 'compact'),
+ (None, 'contenteditable'),
+ (None, 'controls'),
+ (None, 'coords'),
+ (None, 'data'),
+ (None, 'datafld'),
+ (None, 'datapagesize'),
+ (None, 'datasrc'),
+ (None, 'datetime'),
+ (None, 'default'),
+ (None, 'delay'),
+ (None, 'dir'),
+ (None, 'disabled'),
+ (None, 'draggable'),
+ (None, 'dynsrc'),
+ (None, 'enctype'),
+ (None, 'end'),
+ (None, 'face'),
+ (None, 'for'),
+ (None, 'form'),
+ (None, 'frame'),
+ (None, 'galleryimg'),
+ (None, 'gutter'),
+ (None, 'headers'),
+ (None, 'height'),
+ (None, 'hidefocus'),
+ (None, 'hidden'),
+ (None, 'high'),
+ (None, 'href'),
+ (None, 'hreflang'),
+ (None, 'hspace'),
+ (None, 'icon'),
+ (None, 'id'),
+ (None, 'inputmode'),
+ (None, 'ismap'),
+ (None, 'keytype'),
+ (None, 'label'),
+ (None, 'leftspacing'),
+ (None, 'lang'),
+ (None, 'list'),
+ (None, 'longdesc'),
+ (None, 'loop'),
+ (None, 'loopcount'),
+ (None, 'loopend'),
+ (None, 'loopstart'),
+ (None, 'low'),
+ (None, 'lowsrc'),
+ (None, 'max'),
+ (None, 'maxlength'),
+ (None, 'media'),
+ (None, 'method'),
+ (None, 'min'),
+ (None, 'multiple'),
+ (None, 'name'),
+ (None, 'nohref'),
+ (None, 'noshade'),
+ (None, 'nowrap'),
+ (None, 'open'),
+ (None, 'optimum'),
+ (None, 'pattern'),
+ (None, 'ping'),
+ (None, 'point-size'),
+ (None, 'poster'),
+ (None, 'pqg'),
+ (None, 'preload'),
+ (None, 'prompt'),
+ (None, 'radiogroup'),
+ (None, 'readonly'),
+ (None, 'rel'),
+ (None, 'repeat-max'),
+ (None, 'repeat-min'),
+ (None, 'replace'),
+ (None, 'required'),
+ (None, 'rev'),
+ (None, 'rightspacing'),
+ (None, 'rows'),
+ (None, 'rowspan'),
+ (None, 'rules'),
+ (None, 'scope'),
+ (None, 'selected'),
+ (None, 'shape'),
+ (None, 'size'),
+ (None, 'span'),
+ (None, 'src'),
+ (None, 'start'),
+ (None, 'step'),
+ (None, 'style'),
+ (None, 'summary'),
+ (None, 'suppress'),
+ (None, 'tabindex'),
+ (None, 'target'),
+ (None, 'template'),
+ (None, 'title'),
+ (None, 'toppadding'),
+ (None, 'type'),
+ (None, 'unselectable'),
+ (None, 'usemap'),
+ (None, 'urn'),
+ (None, 'valign'),
+ (None, 'value'),
+ (None, 'variable'),
+ (None, 'volume'),
+ (None, 'vspace'),
+ (None, 'vrml'),
+ (None, 'width'),
+ (None, 'wrap'),
+ (namespaces['xml'], 'lang'),
+ # MathML attributes
+ (None, 'actiontype'),
+ (None, 'align'),
+ (None, 'columnalign'),
+ (None, 'columnalign'),
+ (None, 'columnalign'),
+ (None, 'columnlines'),
+ (None, 'columnspacing'),
+ (None, 'columnspan'),
+ (None, 'depth'),
+ (None, 'display'),
+ (None, 'displaystyle'),
+ (None, 'equalcolumns'),
+ (None, 'equalrows'),
+ (None, 'fence'),
+ (None, 'fontstyle'),
+ (None, 'fontweight'),
+ (None, 'frame'),
+ (None, 'height'),
+ (None, 'linethickness'),
+ (None, 'lspace'),
+ (None, 'mathbackground'),
+ (None, 'mathcolor'),
+ (None, 'mathvariant'),
+ (None, 'mathvariant'),
+ (None, 'maxsize'),
+ (None, 'minsize'),
+ (None, 'other'),
+ (None, 'rowalign'),
+ (None, 'rowalign'),
+ (None, 'rowalign'),
+ (None, 'rowlines'),
+ (None, 'rowspacing'),
+ (None, 'rowspan'),
+ (None, 'rspace'),
+ (None, 'scriptlevel'),
+ (None, 'selection'),
+ (None, 'separator'),
+ (None, 'stretchy'),
+ (None, 'width'),
+ (None, 'width'),
+ (namespaces['xlink'], 'href'),
+ (namespaces['xlink'], 'show'),
+ (namespaces['xlink'], 'type'),
+ # SVG attributes
+ (None, 'accent-height'),
+ (None, 'accumulate'),
+ (None, 'additive'),
+ (None, 'alphabetic'),
+ (None, 'arabic-form'),
+ (None, 'ascent'),
+ (None, 'attributeName'),
+ (None, 'attributeType'),
+ (None, 'baseProfile'),
+ (None, 'bbox'),
+ (None, 'begin'),
+ (None, 'by'),
+ (None, 'calcMode'),
+ (None, 'cap-height'),
+ (None, 'class'),
+ (None, 'clip-path'),
+ (None, 'color'),
+ (None, 'color-rendering'),
+ (None, 'content'),
+ (None, 'cx'),
+ (None, 'cy'),
+ (None, 'd'),
+ (None, 'dx'),
+ (None, 'dy'),
+ (None, 'descent'),
+ (None, 'display'),
+ (None, 'dur'),
+ (None, 'end'),
+ (None, 'fill'),
+ (None, 'fill-opacity'),
+ (None, 'fill-rule'),
+ (None, 'font-family'),
+ (None, 'font-size'),
+ (None, 'font-stretch'),
+ (None, 'font-style'),
+ (None, 'font-variant'),
+ (None, 'font-weight'),
+ (None, 'from'),
+ (None, 'fx'),
+ (None, 'fy'),
+ (None, 'g1'),
+ (None, 'g2'),
+ (None, 'glyph-name'),
+ (None, 'gradientUnits'),
+ (None, 'hanging'),
+ (None, 'height'),
+ (None, 'horiz-adv-x'),
+ (None, 'horiz-origin-x'),
+ (None, 'id'),
+ (None, 'ideographic'),
+ (None, 'k'),
+ (None, 'keyPoints'),
+ (None, 'keySplines'),
+ (None, 'keyTimes'),
+ (None, 'lang'),
+ (None, 'marker-end'),
+ (None, 'marker-mid'),
+ (None, 'marker-start'),
+ (None, 'markerHeight'),
+ (None, 'markerUnits'),
+ (None, 'markerWidth'),
+ (None, 'mathematical'),
+ (None, 'max'),
+ (None, 'min'),
+ (None, 'name'),
+ (None, 'offset'),
+ (None, 'opacity'),
+ (None, 'orient'),
+ (None, 'origin'),
+ (None, 'overline-position'),
+ (None, 'overline-thickness'),
+ (None, 'panose-1'),
+ (None, 'path'),
+ (None, 'pathLength'),
+ (None, 'points'),
+ (None, 'preserveAspectRatio'),
+ (None, 'r'),
+ (None, 'refX'),
+ (None, 'refY'),
+ (None, 'repeatCount'),
+ (None, 'repeatDur'),
+ (None, 'requiredExtensions'),
+ (None, 'requiredFeatures'),
+ (None, 'restart'),
+ (None, 'rotate'),
+ (None, 'rx'),
+ (None, 'ry'),
+ (None, 'slope'),
+ (None, 'stemh'),
+ (None, 'stemv'),
+ (None, 'stop-color'),
+ (None, 'stop-opacity'),
+ (None, 'strikethrough-position'),
+ (None, 'strikethrough-thickness'),
+ (None, 'stroke'),
+ (None, 'stroke-dasharray'),
+ (None, 'stroke-dashoffset'),
+ (None, 'stroke-linecap'),
+ (None, 'stroke-linejoin'),
+ (None, 'stroke-miterlimit'),
+ (None, 'stroke-opacity'),
+ (None, 'stroke-width'),
+ (None, 'systemLanguage'),
+ (None, 'target'),
+ (None, 'text-anchor'),
+ (None, 'to'),
+ (None, 'transform'),
+ (None, 'type'),
+ (None, 'u1'),
+ (None, 'u2'),
+ (None, 'underline-position'),
+ (None, 'underline-thickness'),
+ (None, 'unicode'),
+ (None, 'unicode-range'),
+ (None, 'units-per-em'),
+ (None, 'values'),
+ (None, 'version'),
+ (None, 'viewBox'),
+ (None, 'visibility'),
+ (None, 'width'),
+ (None, 'widths'),
+ (None, 'x'),
+ (None, 'x-height'),
+ (None, 'x1'),
+ (None, 'x2'),
+ (namespaces['xlink'], 'actuate'),
+ (namespaces['xlink'], 'arcrole'),
+ (namespaces['xlink'], 'href'),
+ (namespaces['xlink'], 'role'),
+ (namespaces['xlink'], 'show'),
+ (namespaces['xlink'], 'title'),
+ (namespaces['xlink'], 'type'),
+ (namespaces['xml'], 'base'),
+ (namespaces['xml'], 'lang'),
+ (namespaces['xml'], 'space'),
+ (None, 'y'),
+ (None, 'y1'),
+ (None, 'y2'),
+ (None, 'zoomAndPan'),
+))
+
+attr_val_is_uri = frozenset((
+ (None, 'href'),
+ (None, 'src'),
+ (None, 'cite'),
+ (None, 'action'),
+ (None, 'longdesc'),
+ (None, 'poster'),
+ (None, 'background'),
+ (None, 'datasrc'),
+ (None, 'dynsrc'),
+ (None, 'lowsrc'),
+ (None, 'ping'),
+ (namespaces['xlink'], 'href'),
+ (namespaces['xml'], 'base'),
+))
+
+svg_attr_val_allows_ref = frozenset((
+ (None, 'clip-path'),
+ (None, 'color-profile'),
+ (None, 'cursor'),
+ (None, 'fill'),
+ (None, 'filter'),
+ (None, 'marker'),
+ (None, 'marker-start'),
+ (None, 'marker-mid'),
+ (None, 'marker-end'),
+ (None, 'mask'),
+ (None, 'stroke'),
+))
+
+svg_allow_local_href = frozenset((
+ (None, 'altGlyph'),
+ (None, 'animate'),
+ (None, 'animateColor'),
+ (None, 'animateMotion'),
+ (None, 'animateTransform'),
+ (None, 'cursor'),
+ (None, 'feImage'),
+ (None, 'filter'),
+ (None, 'linearGradient'),
+ (None, 'pattern'),
+ (None, 'radialGradient'),
+ (None, 'textpath'),
+ (None, 'tref'),
+ (None, 'set'),
+ (None, 'use')
+))
+
+allowed_css_properties = frozenset((
+ 'azimuth',
+ 'background-color',
+ 'border-bottom-color',
+ 'border-collapse',
+ 'border-color',
+ 'border-left-color',
+ 'border-right-color',
+ 'border-top-color',
+ 'clear',
+ 'color',
+ 'cursor',
+ 'direction',
+ 'display',
+ 'elevation',
+ 'float',
+ 'font',
+ 'font-family',
+ 'font-size',
+ 'font-style',
+ 'font-variant',
+ 'font-weight',
+ 'height',
+ 'letter-spacing',
+ 'line-height',
+ 'overflow',
+ 'pause',
+ 'pause-after',
+ 'pause-before',
+ 'pitch',
+ 'pitch-range',
+ 'richness',
+ 'speak',
+ 'speak-header',
+ 'speak-numeral',
+ 'speak-punctuation',
+ 'speech-rate',
+ 'stress',
+ 'text-align',
+ 'text-decoration',
+ 'text-indent',
+ 'unicode-bidi',
+ 'vertical-align',
+ 'voice-family',
+ 'volume',
+ 'white-space',
+ 'width',
+))
+
+allowed_css_keywords = frozenset((
+ 'auto',
+ 'aqua',
+ 'black',
+ 'block',
+ 'blue',
+ 'bold',
+ 'both',
+ 'bottom',
+ 'brown',
+ 'center',
+ 'collapse',
+ 'dashed',
+ 'dotted',
+ 'fuchsia',
+ 'gray',
+ 'green',
+ '!important',
+ 'italic',
+ 'left',
+ 'lime',
+ 'maroon',
+ 'medium',
+ 'none',
+ 'navy',
+ 'normal',
+ 'nowrap',
+ 'olive',
+ 'pointer',
+ 'purple',
+ 'red',
+ 'right',
+ 'solid',
+ 'silver',
+ 'teal',
+ 'top',
+ 'transparent',
+ 'underline',
+ 'white',
+ 'yellow',
+))
+
+allowed_svg_properties = frozenset((
+ 'fill',
+ 'fill-opacity',
+ 'fill-rule',
+ 'stroke',
+ 'stroke-width',
+ 'stroke-linecap',
+ 'stroke-linejoin',
+ 'stroke-opacity',
+))
+
+allowed_protocols = frozenset((
+ 'ed2k',
+ 'ftp',
+ 'http',
+ 'https',
+ 'irc',
+ 'mailto',
+ 'news',
+ 'gopher',
+ 'nntp',
+ 'telnet',
+ 'webcal',
+ 'xmpp',
+ 'callto',
+ 'feed',
+ 'urn',
+ 'aim',
+ 'rsync',
+ 'tag',
+ 'ssh',
+ 'sftp',
+ 'rtsp',
+ 'afs',
+ 'data',
+))
+
+allowed_content_types = frozenset((
+ 'image/png',
+ 'image/jpeg',
+ 'image/gif',
+ 'image/webp',
+ 'image/bmp',
+ 'text/plain',
+))
+
+
+data_content_type = re.compile(r'''
+ ^
+ # Match a content type <application>/<type>
+ (?P<content_type>[-a-zA-Z0-9.]+/[-a-zA-Z0-9.]+)
+ # Match any character set and encoding
+ (?:(?:;charset=(?:[-a-zA-Z0-9]+)(?:;(?:base64))?)
+ |(?:;(?:base64))?(?:;charset=(?:[-a-zA-Z0-9]+))?)
+ # Assume the rest is data
+ ,.*
+ $
+ ''',
+ re.VERBOSE)
+
+
+class Filter(base.Filter):
+ """Sanitizes token stream of XHTML+MathML+SVG and of inline style attributes"""
+ def __init__(self,
+ source,
+ allowed_elements=allowed_elements,
+ allowed_attributes=allowed_attributes,
+ allowed_css_properties=allowed_css_properties,
+ allowed_css_keywords=allowed_css_keywords,
+ allowed_svg_properties=allowed_svg_properties,
+ allowed_protocols=allowed_protocols,
+ allowed_content_types=allowed_content_types,
+ attr_val_is_uri=attr_val_is_uri,
+ svg_attr_val_allows_ref=svg_attr_val_allows_ref,
+ svg_allow_local_href=svg_allow_local_href):
+ """Creates a Filter
+
+ :arg allowed_elements: set of elements to allow--everything else will
+ be escaped
+
+ :arg allowed_attributes: set of attributes to allow in
+ elements--everything else will be stripped
+
+ :arg allowed_css_properties: set of CSS properties to allow--everything
+ else will be stripped
+
+ :arg allowed_css_keywords: set of CSS keywords to allow--everything
+ else will be stripped
+
+ :arg allowed_svg_properties: set of SVG properties to allow--everything
+ else will be removed
+
+ :arg allowed_protocols: set of allowed protocols for URIs
+
+ :arg allowed_content_types: set of allowed content types for ``data`` URIs.
+
+ :arg attr_val_is_uri: set of attributes that have URI values--values
+ that have a scheme not listed in ``allowed_protocols`` are removed
+
+ :arg svg_attr_val_allows_ref: set of SVG attributes that can have
+ references
+
+ :arg svg_allow_local_href: set of SVG elements that can have local
+ hrefs--these are removed
+
+ """
+ super(Filter, self).__init__(source)
+
+ warnings.warn(_deprecation_msg, DeprecationWarning)
+
+ self.allowed_elements = allowed_elements
+ self.allowed_attributes = allowed_attributes
+ self.allowed_css_properties = allowed_css_properties
+ self.allowed_css_keywords = allowed_css_keywords
+ self.allowed_svg_properties = allowed_svg_properties
+ self.allowed_protocols = allowed_protocols
+ self.allowed_content_types = allowed_content_types
+ self.attr_val_is_uri = attr_val_is_uri
+ self.svg_attr_val_allows_ref = svg_attr_val_allows_ref
+ self.svg_allow_local_href = svg_allow_local_href
+
+ def __iter__(self):
+ for token in base.Filter.__iter__(self):
+ token = self.sanitize_token(token)
+ if token:
+ yield token
+
+ # Sanitize the +html+, escaping all elements not in ALLOWED_ELEMENTS, and
+ # stripping out all attributes not in ALLOWED_ATTRIBUTES. Style attributes
+ # are parsed, and a restricted set, specified by ALLOWED_CSS_PROPERTIES and
+ # ALLOWED_CSS_KEYWORDS, are allowed through. attributes in ATTR_VAL_IS_URI
+ # are scanned, and only URI schemes specified in ALLOWED_PROTOCOLS are
+ # allowed.
+ #
+ # sanitize_html('<script> do_nasty_stuff() </script>')
+ # => &lt;script> do_nasty_stuff() &lt;/script>
+ # sanitize_html('<a href="javascript: sucker();">Click here for $100</a>')
+ # => <a>Click here for $100</a>
+ def sanitize_token(self, token):
+
+ # accommodate filters which use token_type differently
+ token_type = token["type"]
+ if token_type in ("StartTag", "EndTag", "EmptyTag"):
+ name = token["name"]
+ namespace = token["namespace"]
+ if ((namespace, name) in self.allowed_elements or
+ (namespace is None and
+ (namespaces["html"], name) in self.allowed_elements)):
+ return self.allowed_token(token)
+ else:
+ return self.disallowed_token(token)
+ elif token_type == "Comment":
+ pass
+ else:
+ return token
+
+ def allowed_token(self, token):
+ if "data" in token:
+ attrs = token["data"]
+ attr_names = set(attrs.keys())
+
+ # Remove forbidden attributes
+ for to_remove in (attr_names - self.allowed_attributes):
+ del token["data"][to_remove]
+ attr_names.remove(to_remove)
+
+ # Remove attributes with disallowed URL values
+ for attr in (attr_names & self.attr_val_is_uri):
+ assert attr in attrs
+ # I don't have a clue where this regexp comes from or why it matches those
+ # characters, nor why we call unescape. I just know it's always been here.
+ # Should you be worried by this comment in a sanitizer? Yes. On the other hand, all
+ # this will do is remove *more* than it otherwise would.
+ val_unescaped = re.sub("[`\x00-\x20\x7f-\xa0\\s]+", '',
+ unescape(attrs[attr])).lower()
+ # remove replacement characters from unescaped characters
+ val_unescaped = val_unescaped.replace("\ufffd", "")
+ try:
+ uri = urlparse.urlparse(val_unescaped)
+ except ValueError:
+ uri = None
+ del attrs[attr]
+ if uri and uri.scheme:
+ if uri.scheme not in self.allowed_protocols:
+ del attrs[attr]
+ if uri.scheme == 'data':
+ m = data_content_type.match(uri.path)
+ if not m:
+ del attrs[attr]
+ elif m.group('content_type') not in self.allowed_content_types:
+ del attrs[attr]
+
+ for attr in self.svg_attr_val_allows_ref:
+ if attr in attrs:
+ attrs[attr] = re.sub(r'url\s*\(\s*[^#\s][^)]+?\)',
+ ' ',
+ unescape(attrs[attr]))
+ if (token["name"] in self.svg_allow_local_href and
+ (namespaces['xlink'], 'href') in attrs and re.search(r'^\s*[^#\s].*',
+ attrs[(namespaces['xlink'], 'href')])):
+ del attrs[(namespaces['xlink'], 'href')]
+ if (None, 'style') in attrs:
+ attrs[(None, 'style')] = self.sanitize_css(attrs[(None, 'style')])
+ token["data"] = attrs
+ return token
+
+ def disallowed_token(self, token):
+ token_type = token["type"]
+ if token_type == "EndTag":
+ token["data"] = "</%s>" % token["name"]
+ elif token["data"]:
+ assert token_type in ("StartTag", "EmptyTag")
+ attrs = []
+ for (ns, name), v in token["data"].items():
+ attrs.append(' %s="%s"' % (name if ns is None else "%s:%s" % (prefixes[ns], name), escape(v)))
+ token["data"] = "<%s%s>" % (token["name"], ''.join(attrs))
+ else:
+ token["data"] = "<%s>" % token["name"]
+ if token.get("selfClosing"):
+ token["data"] = token["data"][:-1] + "/>"
+
+ token["type"] = "Characters"
+
+ del token["name"]
+ return token
+
+ def sanitize_css(self, style):
+ # disallow urls
+ style = re.compile(r'url\s*\(\s*[^\s)]+?\s*\)\s*').sub(' ', style)
+
+ # gauntlet
+ if not re.match(r"""^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$""", style):
+ return ''
+ if not re.match(r"^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$", style):
+ return ''
+
+ clean = []
+ for prop, value in re.findall(r"([-\w]+)\s*:\s*([^:;]*)", style):
+ if not value:
+ continue
+ if prop.lower() in self.allowed_css_properties:
+ clean.append(prop + ': ' + value + ';')
+ elif prop.split('-')[0].lower() in ['background', 'border', 'margin',
+ 'padding']:
+ for keyword in value.split():
+ if keyword not in self.allowed_css_keywords and \
+ not re.match(r"^(#[0-9a-fA-F]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword): # noqa
+ break
+ else:
+ clean.append(prop + ': ' + value + ';')
+ elif prop.lower() in self.allowed_svg_properties:
+ clean.append(prop + ': ' + value + ';')
+
+ return ' '.join(clean)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/whitespace.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/whitespace.py
new file mode 100644
index 0000000000..0d12584b45
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/filters/whitespace.py
@@ -0,0 +1,38 @@
+from __future__ import absolute_import, division, unicode_literals
+
+import re
+
+from . import base
+from ..constants import rcdataElements, spaceCharacters
+spaceCharacters = "".join(spaceCharacters)
+
+SPACES_REGEX = re.compile("[%s]+" % spaceCharacters)
+
+
+class Filter(base.Filter):
+ """Collapses whitespace except in pre, textarea, and script elements"""
+ spacePreserveElements = frozenset(["pre", "textarea"] + list(rcdataElements))
+
+ def __iter__(self):
+ preserve = 0
+ for token in base.Filter.__iter__(self):
+ type = token["type"]
+ if type == "StartTag" \
+ and (preserve or token["name"] in self.spacePreserveElements):
+ preserve += 1
+
+ elif type == "EndTag" and preserve:
+ preserve -= 1
+
+ elif not preserve and type == "SpaceCharacters" and token["data"]:
+ # Test on token["data"] above to not introduce spaces where there were not
+ token["data"] = " "
+
+ elif not preserve and type == "Characters":
+ token["data"] = collapse_spaces(token["data"])
+
+ yield token
+
+
+def collapse_spaces(text):
+ return SPACES_REGEX.sub(' ', text)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/html5parser.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/html5parser.py
new file mode 100644
index 0000000000..74d829d984
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/html5parser.py
@@ -0,0 +1,2795 @@
+from __future__ import absolute_import, division, unicode_literals
+from six import with_metaclass, viewkeys
+
+import types
+
+from . import _inputstream
+from . import _tokenizer
+
+from . import treebuilders
+from .treebuilders.base import Marker
+
+from . import _utils
+from .constants import (
+ spaceCharacters, asciiUpper2Lower,
+ specialElements, headingElements, cdataElements, rcdataElements,
+ tokenTypes, tagTokenTypes,
+ namespaces,
+ htmlIntegrationPointElements, mathmlTextIntegrationPointElements,
+ adjustForeignAttributes as adjustForeignAttributesMap,
+ adjustMathMLAttributes, adjustSVGAttributes,
+ E,
+ _ReparseException
+)
+
+
+def parse(doc, treebuilder="etree", namespaceHTMLElements=True, **kwargs):
+ """Parse an HTML document as a string or file-like object into a tree
+
+ :arg doc: the document to parse as a string or file-like object
+
+ :arg treebuilder: the treebuilder to use when parsing
+
+ :arg namespaceHTMLElements: whether or not to namespace HTML elements
+
+ :returns: parsed tree
+
+ Example:
+
+ >>> from html5lib.html5parser import parse
+ >>> parse('<html><body><p>This is a doc</p></body></html>')
+ <Element u'{http://www.w3.org/1999/xhtml}html' at 0x7feac4909db0>
+
+ """
+ tb = treebuilders.getTreeBuilder(treebuilder)
+ p = HTMLParser(tb, namespaceHTMLElements=namespaceHTMLElements)
+ return p.parse(doc, **kwargs)
+
+
+def parseFragment(doc, container="div", treebuilder="etree", namespaceHTMLElements=True, **kwargs):
+ """Parse an HTML fragment as a string or file-like object into a tree
+
+ :arg doc: the fragment to parse as a string or file-like object
+
+ :arg container: the container context to parse the fragment in
+
+ :arg treebuilder: the treebuilder to use when parsing
+
+ :arg namespaceHTMLElements: whether or not to namespace HTML elements
+
+ :returns: parsed tree
+
+ Example:
+
+ >>> from html5lib.html5libparser import parseFragment
+ >>> parseFragment('<b>this is a fragment</b>')
+ <Element u'DOCUMENT_FRAGMENT' at 0x7feac484b090>
+
+ """
+ tb = treebuilders.getTreeBuilder(treebuilder)
+ p = HTMLParser(tb, namespaceHTMLElements=namespaceHTMLElements)
+ return p.parseFragment(doc, container=container, **kwargs)
+
+
+def method_decorator_metaclass(function):
+ class Decorated(type):
+ def __new__(meta, classname, bases, classDict):
+ for attributeName, attribute in classDict.items():
+ if isinstance(attribute, types.FunctionType):
+ attribute = function(attribute)
+
+ classDict[attributeName] = attribute
+ return type.__new__(meta, classname, bases, classDict)
+ return Decorated
+
+
+class HTMLParser(object):
+ """HTML parser
+
+ Generates a tree structure from a stream of (possibly malformed) HTML.
+
+ """
+
+ def __init__(self, tree=None, strict=False, namespaceHTMLElements=True, debug=False):
+ """
+ :arg tree: a treebuilder class controlling the type of tree that will be
+ returned. Built in treebuilders can be accessed through
+ html5lib.treebuilders.getTreeBuilder(treeType)
+
+ :arg strict: raise an exception when a parse error is encountered
+
+ :arg namespaceHTMLElements: whether or not to namespace HTML elements
+
+ :arg debug: whether or not to enable debug mode which logs things
+
+ Example:
+
+ >>> from html5lib.html5parser import HTMLParser
+ >>> parser = HTMLParser() # generates parser with etree builder
+ >>> parser = HTMLParser('lxml', strict=True) # generates parser with lxml builder which is strict
+
+ """
+
+ # Raise an exception on the first error encountered
+ self.strict = strict
+
+ if tree is None:
+ tree = treebuilders.getTreeBuilder("etree")
+ self.tree = tree(namespaceHTMLElements)
+ self.errors = []
+
+ self.phases = {name: cls(self, self.tree) for name, cls in
+ getPhases(debug).items()}
+
+ def _parse(self, stream, innerHTML=False, container="div", scripting=False, **kwargs):
+
+ self.innerHTMLMode = innerHTML
+ self.container = container
+ self.scripting = scripting
+ self.tokenizer = _tokenizer.HTMLTokenizer(stream, parser=self, **kwargs)
+ self.reset()
+
+ try:
+ self.mainLoop()
+ except _ReparseException:
+ self.reset()
+ self.mainLoop()
+
+ def reset(self):
+ self.tree.reset()
+ self.firstStartTag = False
+ self.errors = []
+ self.log = [] # only used with debug mode
+ # "quirks" / "limited quirks" / "no quirks"
+ self.compatMode = "no quirks"
+
+ if self.innerHTMLMode:
+ self.innerHTML = self.container.lower()
+
+ if self.innerHTML in cdataElements:
+ self.tokenizer.state = self.tokenizer.rcdataState
+ elif self.innerHTML in rcdataElements:
+ self.tokenizer.state = self.tokenizer.rawtextState
+ elif self.innerHTML == 'plaintext':
+ self.tokenizer.state = self.tokenizer.plaintextState
+ else:
+ # state already is data state
+ # self.tokenizer.state = self.tokenizer.dataState
+ pass
+ self.phase = self.phases["beforeHtml"]
+ self.phase.insertHtmlElement()
+ self.resetInsertionMode()
+ else:
+ self.innerHTML = False # pylint:disable=redefined-variable-type
+ self.phase = self.phases["initial"]
+
+ self.lastPhase = None
+
+ self.beforeRCDataPhase = None
+
+ self.framesetOK = True
+
+ @property
+ def documentEncoding(self):
+ """Name of the character encoding that was used to decode the input stream, or
+ :obj:`None` if that is not determined yet
+
+ """
+ if not hasattr(self, 'tokenizer'):
+ return None
+ return self.tokenizer.stream.charEncoding[0].name
+
+ def isHTMLIntegrationPoint(self, element):
+ if (element.name == "annotation-xml" and
+ element.namespace == namespaces["mathml"]):
+ return ("encoding" in element.attributes and
+ element.attributes["encoding"].translate(
+ asciiUpper2Lower) in
+ ("text/html", "application/xhtml+xml"))
+ else:
+ return (element.namespace, element.name) in htmlIntegrationPointElements
+
+ def isMathMLTextIntegrationPoint(self, element):
+ return (element.namespace, element.name) in mathmlTextIntegrationPointElements
+
+ def mainLoop(self):
+ CharactersToken = tokenTypes["Characters"]
+ SpaceCharactersToken = tokenTypes["SpaceCharacters"]
+ StartTagToken = tokenTypes["StartTag"]
+ EndTagToken = tokenTypes["EndTag"]
+ CommentToken = tokenTypes["Comment"]
+ DoctypeToken = tokenTypes["Doctype"]
+ ParseErrorToken = tokenTypes["ParseError"]
+
+ for token in self.tokenizer:
+ prev_token = None
+ new_token = token
+ while new_token is not None:
+ prev_token = new_token
+ currentNode = self.tree.openElements[-1] if self.tree.openElements else None
+ currentNodeNamespace = currentNode.namespace if currentNode else None
+ currentNodeName = currentNode.name if currentNode else None
+
+ type = new_token["type"]
+
+ if type == ParseErrorToken:
+ self.parseError(new_token["data"], new_token.get("datavars", {}))
+ new_token = None
+ else:
+ if (len(self.tree.openElements) == 0 or
+ currentNodeNamespace == self.tree.defaultNamespace or
+ (self.isMathMLTextIntegrationPoint(currentNode) and
+ ((type == StartTagToken and
+ token["name"] not in frozenset(["mglyph", "malignmark"])) or
+ type in (CharactersToken, SpaceCharactersToken))) or
+ (currentNodeNamespace == namespaces["mathml"] and
+ currentNodeName == "annotation-xml" and
+ type == StartTagToken and
+ token["name"] == "svg") or
+ (self.isHTMLIntegrationPoint(currentNode) and
+ type in (StartTagToken, CharactersToken, SpaceCharactersToken))):
+ phase = self.phase
+ else:
+ phase = self.phases["inForeignContent"]
+
+ if type == CharactersToken:
+ new_token = phase.processCharacters(new_token)
+ elif type == SpaceCharactersToken:
+ new_token = phase.processSpaceCharacters(new_token)
+ elif type == StartTagToken:
+ new_token = phase.processStartTag(new_token)
+ elif type == EndTagToken:
+ new_token = phase.processEndTag(new_token)
+ elif type == CommentToken:
+ new_token = phase.processComment(new_token)
+ elif type == DoctypeToken:
+ new_token = phase.processDoctype(new_token)
+
+ if (type == StartTagToken and prev_token["selfClosing"] and
+ not prev_token["selfClosingAcknowledged"]):
+ self.parseError("non-void-element-with-trailing-solidus",
+ {"name": prev_token["name"]})
+
+ # When the loop finishes it's EOF
+ reprocess = True
+ phases = []
+ while reprocess:
+ phases.append(self.phase)
+ reprocess = self.phase.processEOF()
+ if reprocess:
+ assert self.phase not in phases
+
+ def parse(self, stream, *args, **kwargs):
+ """Parse a HTML document into a well-formed tree
+
+ :arg stream: a file-like object or string containing the HTML to be parsed
+
+ The optional encoding parameter must be a string that indicates
+ the encoding. If specified, that encoding will be used,
+ regardless of any BOM or later declaration (such as in a meta
+ element).
+
+ :arg scripting: treat noscript elements as if JavaScript was turned on
+
+ :returns: parsed tree
+
+ Example:
+
+ >>> from html5lib.html5parser import HTMLParser
+ >>> parser = HTMLParser()
+ >>> parser.parse('<html><body><p>This is a doc</p></body></html>')
+ <Element u'{http://www.w3.org/1999/xhtml}html' at 0x7feac4909db0>
+
+ """
+ self._parse(stream, False, None, *args, **kwargs)
+ return self.tree.getDocument()
+
+ def parseFragment(self, stream, *args, **kwargs):
+ """Parse a HTML fragment into a well-formed tree fragment
+
+ :arg container: name of the element we're setting the innerHTML
+ property if set to None, default to 'div'
+
+ :arg stream: a file-like object or string containing the HTML to be parsed
+
+ The optional encoding parameter must be a string that indicates
+ the encoding. If specified, that encoding will be used,
+ regardless of any BOM or later declaration (such as in a meta
+ element)
+
+ :arg scripting: treat noscript elements as if JavaScript was turned on
+
+ :returns: parsed tree
+
+ Example:
+
+ >>> from html5lib.html5libparser import HTMLParser
+ >>> parser = HTMLParser()
+ >>> parser.parseFragment('<b>this is a fragment</b>')
+ <Element u'DOCUMENT_FRAGMENT' at 0x7feac484b090>
+
+ """
+ self._parse(stream, True, *args, **kwargs)
+ return self.tree.getFragment()
+
+ def parseError(self, errorcode="XXX-undefined-error", datavars=None):
+ # XXX The idea is to make errorcode mandatory.
+ if datavars is None:
+ datavars = {}
+ self.errors.append((self.tokenizer.stream.position(), errorcode, datavars))
+ if self.strict:
+ raise ParseError(E[errorcode] % datavars)
+
+ def adjustMathMLAttributes(self, token):
+ adjust_attributes(token, adjustMathMLAttributes)
+
+ def adjustSVGAttributes(self, token):
+ adjust_attributes(token, adjustSVGAttributes)
+
+ def adjustForeignAttributes(self, token):
+ adjust_attributes(token, adjustForeignAttributesMap)
+
+ def reparseTokenNormal(self, token):
+ # pylint:disable=unused-argument
+ self.parser.phase()
+
+ def resetInsertionMode(self):
+ # The name of this method is mostly historical. (It's also used in the
+ # specification.)
+ last = False
+ newModes = {
+ "select": "inSelect",
+ "td": "inCell",
+ "th": "inCell",
+ "tr": "inRow",
+ "tbody": "inTableBody",
+ "thead": "inTableBody",
+ "tfoot": "inTableBody",
+ "caption": "inCaption",
+ "colgroup": "inColumnGroup",
+ "table": "inTable",
+ "head": "inBody",
+ "body": "inBody",
+ "frameset": "inFrameset",
+ "html": "beforeHead"
+ }
+ for node in self.tree.openElements[::-1]:
+ nodeName = node.name
+ new_phase = None
+ if node == self.tree.openElements[0]:
+ assert self.innerHTML
+ last = True
+ nodeName = self.innerHTML
+ # Check for conditions that should only happen in the innerHTML
+ # case
+ if nodeName in ("select", "colgroup", "head", "html"):
+ assert self.innerHTML
+
+ if not last and node.namespace != self.tree.defaultNamespace:
+ continue
+
+ if nodeName in newModes:
+ new_phase = self.phases[newModes[nodeName]]
+ break
+ elif last:
+ new_phase = self.phases["inBody"]
+ break
+
+ self.phase = new_phase
+
+ def parseRCDataRawtext(self, token, contentType):
+ # Generic RCDATA/RAWTEXT Parsing algorithm
+ assert contentType in ("RAWTEXT", "RCDATA")
+
+ self.tree.insertElement(token)
+
+ if contentType == "RAWTEXT":
+ self.tokenizer.state = self.tokenizer.rawtextState
+ else:
+ self.tokenizer.state = self.tokenizer.rcdataState
+
+ self.originalPhase = self.phase
+
+ self.phase = self.phases["text"]
+
+
+@_utils.memoize
+def getPhases(debug):
+ def log(function):
+ """Logger that records which phase processes each token"""
+ type_names = {value: key for key, value in tokenTypes.items()}
+
+ def wrapped(self, *args, **kwargs):
+ if function.__name__.startswith("process") and len(args) > 0:
+ token = args[0]
+ info = {"type": type_names[token['type']]}
+ if token['type'] in tagTokenTypes:
+ info["name"] = token['name']
+
+ self.parser.log.append((self.parser.tokenizer.state.__name__,
+ self.parser.phase.__class__.__name__,
+ self.__class__.__name__,
+ function.__name__,
+ info))
+ return function(self, *args, **kwargs)
+ else:
+ return function(self, *args, **kwargs)
+ return wrapped
+
+ def getMetaclass(use_metaclass, metaclass_func):
+ if use_metaclass:
+ return method_decorator_metaclass(metaclass_func)
+ else:
+ return type
+
+ # pylint:disable=unused-argument
+ class Phase(with_metaclass(getMetaclass(debug, log))):
+ """Base class for helper object that implements each phase of processing
+ """
+ __slots__ = ("parser", "tree", "__startTagCache", "__endTagCache")
+
+ def __init__(self, parser, tree):
+ self.parser = parser
+ self.tree = tree
+ self.__startTagCache = {}
+ self.__endTagCache = {}
+
+ def processEOF(self):
+ raise NotImplementedError
+
+ def processComment(self, token):
+ # For most phases the following is correct. Where it's not it will be
+ # overridden.
+ self.tree.insertComment(token, self.tree.openElements[-1])
+
+ def processDoctype(self, token):
+ self.parser.parseError("unexpected-doctype")
+
+ def processCharacters(self, token):
+ self.tree.insertText(token["data"])
+
+ def processSpaceCharacters(self, token):
+ self.tree.insertText(token["data"])
+
+ def processStartTag(self, token):
+ # Note the caching is done here rather than BoundMethodDispatcher as doing it there
+ # requires a circular reference to the Phase, and this ends up with a significant
+ # (CPython 2.7, 3.8) GC cost when parsing many short inputs
+ name = token["name"]
+ # In Py2, using `in` is quicker in general than try/except KeyError
+ # In Py3, `in` is quicker when there are few cache hits (typically short inputs)
+ if name in self.__startTagCache:
+ func = self.__startTagCache[name]
+ else:
+ func = self.__startTagCache[name] = self.startTagHandler[name]
+ # bound the cache size in case we get loads of unknown tags
+ while len(self.__startTagCache) > len(self.startTagHandler) * 1.1:
+ # this makes the eviction policy random on Py < 3.7 and FIFO >= 3.7
+ self.__startTagCache.pop(next(iter(self.__startTagCache)))
+ return func(token)
+
+ def startTagHtml(self, token):
+ if not self.parser.firstStartTag and token["name"] == "html":
+ self.parser.parseError("non-html-root")
+ # XXX Need a check here to see if the first start tag token emitted is
+ # this token... If it's not, invoke self.parser.parseError().
+ for attr, value in token["data"].items():
+ if attr not in self.tree.openElements[0].attributes:
+ self.tree.openElements[0].attributes[attr] = value
+ self.parser.firstStartTag = False
+
+ def processEndTag(self, token):
+ # Note the caching is done here rather than BoundMethodDispatcher as doing it there
+ # requires a circular reference to the Phase, and this ends up with a significant
+ # (CPython 2.7, 3.8) GC cost when parsing many short inputs
+ name = token["name"]
+ # In Py2, using `in` is quicker in general than try/except KeyError
+ # In Py3, `in` is quicker when there are few cache hits (typically short inputs)
+ if name in self.__endTagCache:
+ func = self.__endTagCache[name]
+ else:
+ func = self.__endTagCache[name] = self.endTagHandler[name]
+ # bound the cache size in case we get loads of unknown tags
+ while len(self.__endTagCache) > len(self.endTagHandler) * 1.1:
+ # this makes the eviction policy random on Py < 3.7 and FIFO >= 3.7
+ self.__endTagCache.pop(next(iter(self.__endTagCache)))
+ return func(token)
+
+ class InitialPhase(Phase):
+ __slots__ = tuple()
+
+ def processSpaceCharacters(self, token):
+ pass
+
+ def processComment(self, token):
+ self.tree.insertComment(token, self.tree.document)
+
+ def processDoctype(self, token):
+ name = token["name"]
+ publicId = token["publicId"]
+ systemId = token["systemId"]
+ correct = token["correct"]
+
+ if (name != "html" or publicId is not None or
+ systemId is not None and systemId != "about:legacy-compat"):
+ self.parser.parseError("unknown-doctype")
+
+ if publicId is None:
+ publicId = ""
+
+ self.tree.insertDoctype(token)
+
+ if publicId != "":
+ publicId = publicId.translate(asciiUpper2Lower)
+
+ if (not correct or token["name"] != "html" or
+ publicId.startswith(
+ ("+//silmaril//dtd html pro v0r11 19970101//",
+ "-//advasoft ltd//dtd html 3.0 aswedit + extensions//",
+ "-//as//dtd html 3.0 aswedit + extensions//",
+ "-//ietf//dtd html 2.0 level 1//",
+ "-//ietf//dtd html 2.0 level 2//",
+ "-//ietf//dtd html 2.0 strict level 1//",
+ "-//ietf//dtd html 2.0 strict level 2//",
+ "-//ietf//dtd html 2.0 strict//",
+ "-//ietf//dtd html 2.0//",
+ "-//ietf//dtd html 2.1e//",
+ "-//ietf//dtd html 3.0//",
+ "-//ietf//dtd html 3.2 final//",
+ "-//ietf//dtd html 3.2//",
+ "-//ietf//dtd html 3//",
+ "-//ietf//dtd html level 0//",
+ "-//ietf//dtd html level 1//",
+ "-//ietf//dtd html level 2//",
+ "-//ietf//dtd html level 3//",
+ "-//ietf//dtd html strict level 0//",
+ "-//ietf//dtd html strict level 1//",
+ "-//ietf//dtd html strict level 2//",
+ "-//ietf//dtd html strict level 3//",
+ "-//ietf//dtd html strict//",
+ "-//ietf//dtd html//",
+ "-//metrius//dtd metrius presentational//",
+ "-//microsoft//dtd internet explorer 2.0 html strict//",
+ "-//microsoft//dtd internet explorer 2.0 html//",
+ "-//microsoft//dtd internet explorer 2.0 tables//",
+ "-//microsoft//dtd internet explorer 3.0 html strict//",
+ "-//microsoft//dtd internet explorer 3.0 html//",
+ "-//microsoft//dtd internet explorer 3.0 tables//",
+ "-//netscape comm. corp.//dtd html//",
+ "-//netscape comm. corp.//dtd strict html//",
+ "-//o'reilly and associates//dtd html 2.0//",
+ "-//o'reilly and associates//dtd html extended 1.0//",
+ "-//o'reilly and associates//dtd html extended relaxed 1.0//",
+ "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//",
+ "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//",
+ "-//spyglass//dtd html 2.0 extended//",
+ "-//sq//dtd html 2.0 hotmetal + extensions//",
+ "-//sun microsystems corp.//dtd hotjava html//",
+ "-//sun microsystems corp.//dtd hotjava strict html//",
+ "-//w3c//dtd html 3 1995-03-24//",
+ "-//w3c//dtd html 3.2 draft//",
+ "-//w3c//dtd html 3.2 final//",
+ "-//w3c//dtd html 3.2//",
+ "-//w3c//dtd html 3.2s draft//",
+ "-//w3c//dtd html 4.0 frameset//",
+ "-//w3c//dtd html 4.0 transitional//",
+ "-//w3c//dtd html experimental 19960712//",
+ "-//w3c//dtd html experimental 970421//",
+ "-//w3c//dtd w3 html//",
+ "-//w3o//dtd w3 html 3.0//",
+ "-//webtechs//dtd mozilla html 2.0//",
+ "-//webtechs//dtd mozilla html//")) or
+ publicId in ("-//w3o//dtd w3 html strict 3.0//en//",
+ "-/w3c/dtd html 4.0 transitional/en",
+ "html") or
+ publicId.startswith(
+ ("-//w3c//dtd html 4.01 frameset//",
+ "-//w3c//dtd html 4.01 transitional//")) and
+ systemId is None or
+ systemId and systemId.lower() == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"):
+ self.parser.compatMode = "quirks"
+ elif (publicId.startswith(
+ ("-//w3c//dtd xhtml 1.0 frameset//",
+ "-//w3c//dtd xhtml 1.0 transitional//")) or
+ publicId.startswith(
+ ("-//w3c//dtd html 4.01 frameset//",
+ "-//w3c//dtd html 4.01 transitional//")) and
+ systemId is not None):
+ self.parser.compatMode = "limited quirks"
+
+ self.parser.phase = self.parser.phases["beforeHtml"]
+
+ def anythingElse(self):
+ self.parser.compatMode = "quirks"
+ self.parser.phase = self.parser.phases["beforeHtml"]
+
+ def processCharacters(self, token):
+ self.parser.parseError("expected-doctype-but-got-chars")
+ self.anythingElse()
+ return token
+
+ def processStartTag(self, token):
+ self.parser.parseError("expected-doctype-but-got-start-tag",
+ {"name": token["name"]})
+ self.anythingElse()
+ return token
+
+ def processEndTag(self, token):
+ self.parser.parseError("expected-doctype-but-got-end-tag",
+ {"name": token["name"]})
+ self.anythingElse()
+ return token
+
+ def processEOF(self):
+ self.parser.parseError("expected-doctype-but-got-eof")
+ self.anythingElse()
+ return True
+
+ class BeforeHtmlPhase(Phase):
+ __slots__ = tuple()
+
+ # helper methods
+ def insertHtmlElement(self):
+ self.tree.insertRoot(impliedTagToken("html", "StartTag"))
+ self.parser.phase = self.parser.phases["beforeHead"]
+
+ # other
+ def processEOF(self):
+ self.insertHtmlElement()
+ return True
+
+ def processComment(self, token):
+ self.tree.insertComment(token, self.tree.document)
+
+ def processSpaceCharacters(self, token):
+ pass
+
+ def processCharacters(self, token):
+ self.insertHtmlElement()
+ return token
+
+ def processStartTag(self, token):
+ if token["name"] == "html":
+ self.parser.firstStartTag = True
+ self.insertHtmlElement()
+ return token
+
+ def processEndTag(self, token):
+ if token["name"] not in ("head", "body", "html", "br"):
+ self.parser.parseError("unexpected-end-tag-before-html",
+ {"name": token["name"]})
+ else:
+ self.insertHtmlElement()
+ return token
+
+ class BeforeHeadPhase(Phase):
+ __slots__ = tuple()
+
+ def processEOF(self):
+ self.startTagHead(impliedTagToken("head", "StartTag"))
+ return True
+
+ def processSpaceCharacters(self, token):
+ pass
+
+ def processCharacters(self, token):
+ self.startTagHead(impliedTagToken("head", "StartTag"))
+ return token
+
+ def startTagHtml(self, token):
+ return self.parser.phases["inBody"].processStartTag(token)
+
+ def startTagHead(self, token):
+ self.tree.insertElement(token)
+ self.tree.headPointer = self.tree.openElements[-1]
+ self.parser.phase = self.parser.phases["inHead"]
+
+ def startTagOther(self, token):
+ self.startTagHead(impliedTagToken("head", "StartTag"))
+ return token
+
+ def endTagImplyHead(self, token):
+ self.startTagHead(impliedTagToken("head", "StartTag"))
+ return token
+
+ def endTagOther(self, token):
+ self.parser.parseError("end-tag-after-implied-root",
+ {"name": token["name"]})
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", startTagHtml),
+ ("head", startTagHead)
+ ])
+ startTagHandler.default = startTagOther
+
+ endTagHandler = _utils.MethodDispatcher([
+ (("head", "body", "html", "br"), endTagImplyHead)
+ ])
+ endTagHandler.default = endTagOther
+
+ class InHeadPhase(Phase):
+ __slots__ = tuple()
+
+ # the real thing
+ def processEOF(self):
+ self.anythingElse()
+ return True
+
+ def processCharacters(self, token):
+ self.anythingElse()
+ return token
+
+ def startTagHtml(self, token):
+ return self.parser.phases["inBody"].processStartTag(token)
+
+ def startTagHead(self, token):
+ self.parser.parseError("two-heads-are-not-better-than-one")
+
+ def startTagBaseLinkCommand(self, token):
+ self.tree.insertElement(token)
+ self.tree.openElements.pop()
+ token["selfClosingAcknowledged"] = True
+
+ def startTagMeta(self, token):
+ self.tree.insertElement(token)
+ self.tree.openElements.pop()
+ token["selfClosingAcknowledged"] = True
+
+ attributes = token["data"]
+ if self.parser.tokenizer.stream.charEncoding[1] == "tentative":
+ if "charset" in attributes:
+ self.parser.tokenizer.stream.changeEncoding(attributes["charset"])
+ elif ("content" in attributes and
+ "http-equiv" in attributes and
+ attributes["http-equiv"].lower() == "content-type"):
+ # Encoding it as UTF-8 here is a hack, as really we should pass
+ # the abstract Unicode string, and just use the
+ # ContentAttrParser on that, but using UTF-8 allows all chars
+ # to be encoded and as a ASCII-superset works.
+ data = _inputstream.EncodingBytes(attributes["content"].encode("utf-8"))
+ parser = _inputstream.ContentAttrParser(data)
+ codec = parser.parse()
+ self.parser.tokenizer.stream.changeEncoding(codec)
+
+ def startTagTitle(self, token):
+ self.parser.parseRCDataRawtext(token, "RCDATA")
+
+ def startTagNoFramesStyle(self, token):
+ # Need to decide whether to implement the scripting-disabled case
+ self.parser.parseRCDataRawtext(token, "RAWTEXT")
+
+ def startTagNoscript(self, token):
+ if self.parser.scripting:
+ self.parser.parseRCDataRawtext(token, "RAWTEXT")
+ else:
+ self.tree.insertElement(token)
+ self.parser.phase = self.parser.phases["inHeadNoscript"]
+
+ def startTagScript(self, token):
+ self.tree.insertElement(token)
+ self.parser.tokenizer.state = self.parser.tokenizer.scriptDataState
+ self.parser.originalPhase = self.parser.phase
+ self.parser.phase = self.parser.phases["text"]
+
+ def startTagOther(self, token):
+ self.anythingElse()
+ return token
+
+ def endTagHead(self, token):
+ node = self.parser.tree.openElements.pop()
+ assert node.name == "head", "Expected head got %s" % node.name
+ self.parser.phase = self.parser.phases["afterHead"]
+
+ def endTagHtmlBodyBr(self, token):
+ self.anythingElse()
+ return token
+
+ def endTagOther(self, token):
+ self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
+
+ def anythingElse(self):
+ self.endTagHead(impliedTagToken("head"))
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", startTagHtml),
+ ("title", startTagTitle),
+ (("noframes", "style"), startTagNoFramesStyle),
+ ("noscript", startTagNoscript),
+ ("script", startTagScript),
+ (("base", "basefont", "bgsound", "command", "link"),
+ startTagBaseLinkCommand),
+ ("meta", startTagMeta),
+ ("head", startTagHead)
+ ])
+ startTagHandler.default = startTagOther
+
+ endTagHandler = _utils.MethodDispatcher([
+ ("head", endTagHead),
+ (("br", "html", "body"), endTagHtmlBodyBr)
+ ])
+ endTagHandler.default = endTagOther
+
+ class InHeadNoscriptPhase(Phase):
+ __slots__ = tuple()
+
+ def processEOF(self):
+ self.parser.parseError("eof-in-head-noscript")
+ self.anythingElse()
+ return True
+
+ def processComment(self, token):
+ return self.parser.phases["inHead"].processComment(token)
+
+ def processCharacters(self, token):
+ self.parser.parseError("char-in-head-noscript")
+ self.anythingElse()
+ return token
+
+ def processSpaceCharacters(self, token):
+ return self.parser.phases["inHead"].processSpaceCharacters(token)
+
+ def startTagHtml(self, token):
+ return self.parser.phases["inBody"].processStartTag(token)
+
+ def startTagBaseLinkCommand(self, token):
+ return self.parser.phases["inHead"].processStartTag(token)
+
+ def startTagHeadNoscript(self, token):
+ self.parser.parseError("unexpected-start-tag", {"name": token["name"]})
+
+ def startTagOther(self, token):
+ self.parser.parseError("unexpected-inhead-noscript-tag", {"name": token["name"]})
+ self.anythingElse()
+ return token
+
+ def endTagNoscript(self, token):
+ node = self.parser.tree.openElements.pop()
+ assert node.name == "noscript", "Expected noscript got %s" % node.name
+ self.parser.phase = self.parser.phases["inHead"]
+
+ def endTagBr(self, token):
+ self.parser.parseError("unexpected-inhead-noscript-tag", {"name": token["name"]})
+ self.anythingElse()
+ return token
+
+ def endTagOther(self, token):
+ self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
+
+ def anythingElse(self):
+ # Caller must raise parse error first!
+ self.endTagNoscript(impliedTagToken("noscript"))
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", startTagHtml),
+ (("basefont", "bgsound", "link", "meta", "noframes", "style"), startTagBaseLinkCommand),
+ (("head", "noscript"), startTagHeadNoscript),
+ ])
+ startTagHandler.default = startTagOther
+
+ endTagHandler = _utils.MethodDispatcher([
+ ("noscript", endTagNoscript),
+ ("br", endTagBr),
+ ])
+ endTagHandler.default = endTagOther
+
+ class AfterHeadPhase(Phase):
+ __slots__ = tuple()
+
+ def processEOF(self):
+ self.anythingElse()
+ return True
+
+ def processCharacters(self, token):
+ self.anythingElse()
+ return token
+
+ def startTagHtml(self, token):
+ return self.parser.phases["inBody"].processStartTag(token)
+
+ def startTagBody(self, token):
+ self.parser.framesetOK = False
+ self.tree.insertElement(token)
+ self.parser.phase = self.parser.phases["inBody"]
+
+ def startTagFrameset(self, token):
+ self.tree.insertElement(token)
+ self.parser.phase = self.parser.phases["inFrameset"]
+
+ def startTagFromHead(self, token):
+ self.parser.parseError("unexpected-start-tag-out-of-my-head",
+ {"name": token["name"]})
+ self.tree.openElements.append(self.tree.headPointer)
+ self.parser.phases["inHead"].processStartTag(token)
+ for node in self.tree.openElements[::-1]:
+ if node.name == "head":
+ self.tree.openElements.remove(node)
+ break
+
+ def startTagHead(self, token):
+ self.parser.parseError("unexpected-start-tag", {"name": token["name"]})
+
+ def startTagOther(self, token):
+ self.anythingElse()
+ return token
+
+ def endTagHtmlBodyBr(self, token):
+ self.anythingElse()
+ return token
+
+ def endTagOther(self, token):
+ self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
+
+ def anythingElse(self):
+ self.tree.insertElement(impliedTagToken("body", "StartTag"))
+ self.parser.phase = self.parser.phases["inBody"]
+ self.parser.framesetOK = True
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", startTagHtml),
+ ("body", startTagBody),
+ ("frameset", startTagFrameset),
+ (("base", "basefont", "bgsound", "link", "meta", "noframes", "script",
+ "style", "title"),
+ startTagFromHead),
+ ("head", startTagHead)
+ ])
+ startTagHandler.default = startTagOther
+ endTagHandler = _utils.MethodDispatcher([(("body", "html", "br"),
+ endTagHtmlBodyBr)])
+ endTagHandler.default = endTagOther
+
+ class InBodyPhase(Phase):
+ # http://www.whatwg.org/specs/web-apps/current-work/#parsing-main-inbody
+ # the really-really-really-very crazy mode
+ __slots__ = ("processSpaceCharacters",)
+
+ def __init__(self, *args, **kwargs):
+ super(InBodyPhase, self).__init__(*args, **kwargs)
+ # Set this to the default handler
+ self.processSpaceCharacters = self.processSpaceCharactersNonPre
+
+ def isMatchingFormattingElement(self, node1, node2):
+ return (node1.name == node2.name and
+ node1.namespace == node2.namespace and
+ node1.attributes == node2.attributes)
+
+ # helper
+ def addFormattingElement(self, token):
+ self.tree.insertElement(token)
+ element = self.tree.openElements[-1]
+
+ matchingElements = []
+ for node in self.tree.activeFormattingElements[::-1]:
+ if node is Marker:
+ break
+ elif self.isMatchingFormattingElement(node, element):
+ matchingElements.append(node)
+
+ assert len(matchingElements) <= 3
+ if len(matchingElements) == 3:
+ self.tree.activeFormattingElements.remove(matchingElements[-1])
+ self.tree.activeFormattingElements.append(element)
+
+ # the real deal
+ def processEOF(self):
+ allowed_elements = frozenset(("dd", "dt", "li", "p", "tbody", "td",
+ "tfoot", "th", "thead", "tr", "body",
+ "html"))
+ for node in self.tree.openElements[::-1]:
+ if node.name not in allowed_elements:
+ self.parser.parseError("expected-closing-tag-but-got-eof")
+ break
+ # Stop parsing
+
+ def processSpaceCharactersDropNewline(self, token):
+ # Sometimes (start of <pre>, <listing>, and <textarea> blocks) we
+ # want to drop leading newlines
+ data = token["data"]
+ self.processSpaceCharacters = self.processSpaceCharactersNonPre
+ if (data.startswith("\n") and
+ self.tree.openElements[-1].name in ("pre", "listing", "textarea") and
+ not self.tree.openElements[-1].hasContent()):
+ data = data[1:]
+ if data:
+ self.tree.reconstructActiveFormattingElements()
+ self.tree.insertText(data)
+
+ def processCharacters(self, token):
+ if token["data"] == "\u0000":
+ # The tokenizer should always emit null on its own
+ return
+ self.tree.reconstructActiveFormattingElements()
+ self.tree.insertText(token["data"])
+ # This must be bad for performance
+ if (self.parser.framesetOK and
+ any([char not in spaceCharacters
+ for char in token["data"]])):
+ self.parser.framesetOK = False
+
+ def processSpaceCharactersNonPre(self, token):
+ self.tree.reconstructActiveFormattingElements()
+ self.tree.insertText(token["data"])
+
+ def startTagProcessInHead(self, token):
+ return self.parser.phases["inHead"].processStartTag(token)
+
+ def startTagBody(self, token):
+ self.parser.parseError("unexpected-start-tag", {"name": "body"})
+ if (len(self.tree.openElements) == 1 or
+ self.tree.openElements[1].name != "body"):
+ assert self.parser.innerHTML
+ else:
+ self.parser.framesetOK = False
+ for attr, value in token["data"].items():
+ if attr not in self.tree.openElements[1].attributes:
+ self.tree.openElements[1].attributes[attr] = value
+
+ def startTagFrameset(self, token):
+ self.parser.parseError("unexpected-start-tag", {"name": "frameset"})
+ if (len(self.tree.openElements) == 1 or self.tree.openElements[1].name != "body"):
+ assert self.parser.innerHTML
+ elif not self.parser.framesetOK:
+ pass
+ else:
+ if self.tree.openElements[1].parent:
+ self.tree.openElements[1].parent.removeChild(self.tree.openElements[1])
+ while self.tree.openElements[-1].name != "html":
+ self.tree.openElements.pop()
+ self.tree.insertElement(token)
+ self.parser.phase = self.parser.phases["inFrameset"]
+
+ def startTagCloseP(self, token):
+ if self.tree.elementInScope("p", variant="button"):
+ self.endTagP(impliedTagToken("p"))
+ self.tree.insertElement(token)
+
+ def startTagPreListing(self, token):
+ if self.tree.elementInScope("p", variant="button"):
+ self.endTagP(impliedTagToken("p"))
+ self.tree.insertElement(token)
+ self.parser.framesetOK = False
+ self.processSpaceCharacters = self.processSpaceCharactersDropNewline
+
+ def startTagForm(self, token):
+ if self.tree.formPointer:
+ self.parser.parseError("unexpected-start-tag", {"name": "form"})
+ else:
+ if self.tree.elementInScope("p", variant="button"):
+ self.endTagP(impliedTagToken("p"))
+ self.tree.insertElement(token)
+ self.tree.formPointer = self.tree.openElements[-1]
+
+ def startTagListItem(self, token):
+ self.parser.framesetOK = False
+
+ stopNamesMap = {"li": ["li"],
+ "dt": ["dt", "dd"],
+ "dd": ["dt", "dd"]}
+ stopNames = stopNamesMap[token["name"]]
+ for node in reversed(self.tree.openElements):
+ if node.name in stopNames:
+ self.parser.phase.processEndTag(
+ impliedTagToken(node.name, "EndTag"))
+ break
+ if (node.nameTuple in specialElements and
+ node.name not in ("address", "div", "p")):
+ break
+
+ if self.tree.elementInScope("p", variant="button"):
+ self.parser.phase.processEndTag(
+ impliedTagToken("p", "EndTag"))
+
+ self.tree.insertElement(token)
+
+ def startTagPlaintext(self, token):
+ if self.tree.elementInScope("p", variant="button"):
+ self.endTagP(impliedTagToken("p"))
+ self.tree.insertElement(token)
+ self.parser.tokenizer.state = self.parser.tokenizer.plaintextState
+
+ def startTagHeading(self, token):
+ if self.tree.elementInScope("p", variant="button"):
+ self.endTagP(impliedTagToken("p"))
+ if self.tree.openElements[-1].name in headingElements:
+ self.parser.parseError("unexpected-start-tag", {"name": token["name"]})
+ self.tree.openElements.pop()
+ self.tree.insertElement(token)
+
+ def startTagA(self, token):
+ afeAElement = self.tree.elementInActiveFormattingElements("a")
+ if afeAElement:
+ self.parser.parseError("unexpected-start-tag-implies-end-tag",
+ {"startName": "a", "endName": "a"})
+ self.endTagFormatting(impliedTagToken("a"))
+ if afeAElement in self.tree.openElements:
+ self.tree.openElements.remove(afeAElement)
+ if afeAElement in self.tree.activeFormattingElements:
+ self.tree.activeFormattingElements.remove(afeAElement)
+ self.tree.reconstructActiveFormattingElements()
+ self.addFormattingElement(token)
+
+ def startTagFormatting(self, token):
+ self.tree.reconstructActiveFormattingElements()
+ self.addFormattingElement(token)
+
+ def startTagNobr(self, token):
+ self.tree.reconstructActiveFormattingElements()
+ if self.tree.elementInScope("nobr"):
+ self.parser.parseError("unexpected-start-tag-implies-end-tag",
+ {"startName": "nobr", "endName": "nobr"})
+ self.processEndTag(impliedTagToken("nobr"))
+ # XXX Need tests that trigger the following
+ self.tree.reconstructActiveFormattingElements()
+ self.addFormattingElement(token)
+
+ def startTagButton(self, token):
+ if self.tree.elementInScope("button"):
+ self.parser.parseError("unexpected-start-tag-implies-end-tag",
+ {"startName": "button", "endName": "button"})
+ self.processEndTag(impliedTagToken("button"))
+ return token
+ else:
+ self.tree.reconstructActiveFormattingElements()
+ self.tree.insertElement(token)
+ self.parser.framesetOK = False
+
+ def startTagAppletMarqueeObject(self, token):
+ self.tree.reconstructActiveFormattingElements()
+ self.tree.insertElement(token)
+ self.tree.activeFormattingElements.append(Marker)
+ self.parser.framesetOK = False
+
+ def startTagXmp(self, token):
+ if self.tree.elementInScope("p", variant="button"):
+ self.endTagP(impliedTagToken("p"))
+ self.tree.reconstructActiveFormattingElements()
+ self.parser.framesetOK = False
+ self.parser.parseRCDataRawtext(token, "RAWTEXT")
+
+ def startTagTable(self, token):
+ if self.parser.compatMode != "quirks":
+ if self.tree.elementInScope("p", variant="button"):
+ self.processEndTag(impliedTagToken("p"))
+ self.tree.insertElement(token)
+ self.parser.framesetOK = False
+ self.parser.phase = self.parser.phases["inTable"]
+
+ def startTagVoidFormatting(self, token):
+ self.tree.reconstructActiveFormattingElements()
+ self.tree.insertElement(token)
+ self.tree.openElements.pop()
+ token["selfClosingAcknowledged"] = True
+ self.parser.framesetOK = False
+
+ def startTagInput(self, token):
+ framesetOK = self.parser.framesetOK
+ self.startTagVoidFormatting(token)
+ if ("type" in token["data"] and
+ token["data"]["type"].translate(asciiUpper2Lower) == "hidden"):
+ # input type=hidden doesn't change framesetOK
+ self.parser.framesetOK = framesetOK
+
+ def startTagParamSource(self, token):
+ self.tree.insertElement(token)
+ self.tree.openElements.pop()
+ token["selfClosingAcknowledged"] = True
+
+ def startTagHr(self, token):
+ if self.tree.elementInScope("p", variant="button"):
+ self.endTagP(impliedTagToken("p"))
+ self.tree.insertElement(token)
+ self.tree.openElements.pop()
+ token["selfClosingAcknowledged"] = True
+ self.parser.framesetOK = False
+
+ def startTagImage(self, token):
+ # No really...
+ self.parser.parseError("unexpected-start-tag-treated-as",
+ {"originalName": "image", "newName": "img"})
+ self.processStartTag(impliedTagToken("img", "StartTag",
+ attributes=token["data"],
+ selfClosing=token["selfClosing"]))
+
+ def startTagIsIndex(self, token):
+ self.parser.parseError("deprecated-tag", {"name": "isindex"})
+ if self.tree.formPointer:
+ return
+ form_attrs = {}
+ if "action" in token["data"]:
+ form_attrs["action"] = token["data"]["action"]
+ self.processStartTag(impliedTagToken("form", "StartTag",
+ attributes=form_attrs))
+ self.processStartTag(impliedTagToken("hr", "StartTag"))
+ self.processStartTag(impliedTagToken("label", "StartTag"))
+ # XXX Localization ...
+ if "prompt" in token["data"]:
+ prompt = token["data"]["prompt"]
+ else:
+ prompt = "This is a searchable index. Enter search keywords: "
+ self.processCharacters(
+ {"type": tokenTypes["Characters"], "data": prompt})
+ attributes = token["data"].copy()
+ if "action" in attributes:
+ del attributes["action"]
+ if "prompt" in attributes:
+ del attributes["prompt"]
+ attributes["name"] = "isindex"
+ self.processStartTag(impliedTagToken("input", "StartTag",
+ attributes=attributes,
+ selfClosing=token["selfClosing"]))
+ self.processEndTag(impliedTagToken("label"))
+ self.processStartTag(impliedTagToken("hr", "StartTag"))
+ self.processEndTag(impliedTagToken("form"))
+
+ def startTagTextarea(self, token):
+ self.tree.insertElement(token)
+ self.parser.tokenizer.state = self.parser.tokenizer.rcdataState
+ self.processSpaceCharacters = self.processSpaceCharactersDropNewline
+ self.parser.framesetOK = False
+
+ def startTagIFrame(self, token):
+ self.parser.framesetOK = False
+ self.startTagRawtext(token)
+
+ def startTagNoscript(self, token):
+ if self.parser.scripting:
+ self.startTagRawtext(token)
+ else:
+ self.startTagOther(token)
+
+ def startTagRawtext(self, token):
+ """iframe, noembed noframes, noscript(if scripting enabled)"""
+ self.parser.parseRCDataRawtext(token, "RAWTEXT")
+
+ def startTagOpt(self, token):
+ if self.tree.openElements[-1].name == "option":
+ self.parser.phase.processEndTag(impliedTagToken("option"))
+ self.tree.reconstructActiveFormattingElements()
+ self.parser.tree.insertElement(token)
+
+ def startTagSelect(self, token):
+ self.tree.reconstructActiveFormattingElements()
+ self.tree.insertElement(token)
+ self.parser.framesetOK = False
+ if self.parser.phase in (self.parser.phases["inTable"],
+ self.parser.phases["inCaption"],
+ self.parser.phases["inColumnGroup"],
+ self.parser.phases["inTableBody"],
+ self.parser.phases["inRow"],
+ self.parser.phases["inCell"]):
+ self.parser.phase = self.parser.phases["inSelectInTable"]
+ else:
+ self.parser.phase = self.parser.phases["inSelect"]
+
+ def startTagRpRt(self, token):
+ if self.tree.elementInScope("ruby"):
+ self.tree.generateImpliedEndTags()
+ if self.tree.openElements[-1].name != "ruby":
+ self.parser.parseError()
+ self.tree.insertElement(token)
+
+ def startTagMath(self, token):
+ self.tree.reconstructActiveFormattingElements()
+ self.parser.adjustMathMLAttributes(token)
+ self.parser.adjustForeignAttributes(token)
+ token["namespace"] = namespaces["mathml"]
+ self.tree.insertElement(token)
+ # Need to get the parse error right for the case where the token
+ # has a namespace not equal to the xmlns attribute
+ if token["selfClosing"]:
+ self.tree.openElements.pop()
+ token["selfClosingAcknowledged"] = True
+
+ def startTagSvg(self, token):
+ self.tree.reconstructActiveFormattingElements()
+ self.parser.adjustSVGAttributes(token)
+ self.parser.adjustForeignAttributes(token)
+ token["namespace"] = namespaces["svg"]
+ self.tree.insertElement(token)
+ # Need to get the parse error right for the case where the token
+ # has a namespace not equal to the xmlns attribute
+ if token["selfClosing"]:
+ self.tree.openElements.pop()
+ token["selfClosingAcknowledged"] = True
+
+ def startTagMisplaced(self, token):
+ """ Elements that should be children of other elements that have a
+ different insertion mode; here they are ignored
+ "caption", "col", "colgroup", "frame", "frameset", "head",
+ "option", "optgroup", "tbody", "td", "tfoot", "th", "thead",
+ "tr", "noscript"
+ """
+ self.parser.parseError("unexpected-start-tag-ignored", {"name": token["name"]})
+
+ def startTagOther(self, token):
+ self.tree.reconstructActiveFormattingElements()
+ self.tree.insertElement(token)
+
+ def endTagP(self, token):
+ if not self.tree.elementInScope("p", variant="button"):
+ self.startTagCloseP(impliedTagToken("p", "StartTag"))
+ self.parser.parseError("unexpected-end-tag", {"name": "p"})
+ self.endTagP(impliedTagToken("p", "EndTag"))
+ else:
+ self.tree.generateImpliedEndTags("p")
+ if self.tree.openElements[-1].name != "p":
+ self.parser.parseError("unexpected-end-tag", {"name": "p"})
+ node = self.tree.openElements.pop()
+ while node.name != "p":
+ node = self.tree.openElements.pop()
+
+ def endTagBody(self, token):
+ if not self.tree.elementInScope("body"):
+ self.parser.parseError()
+ return
+ elif self.tree.openElements[-1].name != "body":
+ for node in self.tree.openElements[2:]:
+ if node.name not in frozenset(("dd", "dt", "li", "optgroup",
+ "option", "p", "rp", "rt",
+ "tbody", "td", "tfoot",
+ "th", "thead", "tr", "body",
+ "html")):
+ # Not sure this is the correct name for the parse error
+ self.parser.parseError(
+ "expected-one-end-tag-but-got-another",
+ {"gotName": "body", "expectedName": node.name})
+ break
+ self.parser.phase = self.parser.phases["afterBody"]
+
+ def endTagHtml(self, token):
+ # We repeat the test for the body end tag token being ignored here
+ if self.tree.elementInScope("body"):
+ self.endTagBody(impliedTagToken("body"))
+ return token
+
+ def endTagBlock(self, token):
+ # Put us back in the right whitespace handling mode
+ if token["name"] == "pre":
+ self.processSpaceCharacters = self.processSpaceCharactersNonPre
+ inScope = self.tree.elementInScope(token["name"])
+ if inScope:
+ self.tree.generateImpliedEndTags()
+ if self.tree.openElements[-1].name != token["name"]:
+ self.parser.parseError("end-tag-too-early", {"name": token["name"]})
+ if inScope:
+ node = self.tree.openElements.pop()
+ while node.name != token["name"]:
+ node = self.tree.openElements.pop()
+
+ def endTagForm(self, token):
+ node = self.tree.formPointer
+ self.tree.formPointer = None
+ if node is None or not self.tree.elementInScope(node):
+ self.parser.parseError("unexpected-end-tag",
+ {"name": "form"})
+ else:
+ self.tree.generateImpliedEndTags()
+ if self.tree.openElements[-1] != node:
+ self.parser.parseError("end-tag-too-early-ignored",
+ {"name": "form"})
+ self.tree.openElements.remove(node)
+
+ def endTagListItem(self, token):
+ if token["name"] == "li":
+ variant = "list"
+ else:
+ variant = None
+ if not self.tree.elementInScope(token["name"], variant=variant):
+ self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
+ else:
+ self.tree.generateImpliedEndTags(exclude=token["name"])
+ if self.tree.openElements[-1].name != token["name"]:
+ self.parser.parseError(
+ "end-tag-too-early",
+ {"name": token["name"]})
+ node = self.tree.openElements.pop()
+ while node.name != token["name"]:
+ node = self.tree.openElements.pop()
+
+ def endTagHeading(self, token):
+ for item in headingElements:
+ if self.tree.elementInScope(item):
+ self.tree.generateImpliedEndTags()
+ break
+ if self.tree.openElements[-1].name != token["name"]:
+ self.parser.parseError("end-tag-too-early", {"name": token["name"]})
+
+ for item in headingElements:
+ if self.tree.elementInScope(item):
+ item = self.tree.openElements.pop()
+ while item.name not in headingElements:
+ item = self.tree.openElements.pop()
+ break
+
+ def endTagFormatting(self, token):
+ """The much-feared adoption agency algorithm"""
+ # http://svn.whatwg.org/webapps/complete.html#adoptionAgency revision 7867
+ # XXX Better parseError messages appreciated.
+
+ # Step 1
+ outerLoopCounter = 0
+
+ # Step 2
+ while outerLoopCounter < 8:
+
+ # Step 3
+ outerLoopCounter += 1
+
+ # Step 4:
+
+ # Let the formatting element be the last element in
+ # the list of active formatting elements that:
+ # - is between the end of the list and the last scope
+ # marker in the list, if any, or the start of the list
+ # otherwise, and
+ # - has the same tag name as the token.
+ formattingElement = self.tree.elementInActiveFormattingElements(
+ token["name"])
+ if (not formattingElement or
+ (formattingElement in self.tree.openElements and
+ not self.tree.elementInScope(formattingElement.name))):
+ # If there is no such node, then abort these steps
+ # and instead act as described in the "any other
+ # end tag" entry below.
+ self.endTagOther(token)
+ return
+
+ # Otherwise, if there is such a node, but that node is
+ # not in the stack of open elements, then this is a
+ # parse error; remove the element from the list, and
+ # abort these steps.
+ elif formattingElement not in self.tree.openElements:
+ self.parser.parseError("adoption-agency-1.2", {"name": token["name"]})
+ self.tree.activeFormattingElements.remove(formattingElement)
+ return
+
+ # Otherwise, if there is such a node, and that node is
+ # also in the stack of open elements, but the element
+ # is not in scope, then this is a parse error; ignore
+ # the token, and abort these steps.
+ elif not self.tree.elementInScope(formattingElement.name):
+ self.parser.parseError("adoption-agency-4.4", {"name": token["name"]})
+ return
+
+ # Otherwise, there is a formatting element and that
+ # element is in the stack and is in scope. If the
+ # element is not the current node, this is a parse
+ # error. In any case, proceed with the algorithm as
+ # written in the following steps.
+ else:
+ if formattingElement != self.tree.openElements[-1]:
+ self.parser.parseError("adoption-agency-1.3", {"name": token["name"]})
+
+ # Step 5:
+
+ # Let the furthest block be the topmost node in the
+ # stack of open elements that is lower in the stack
+ # than the formatting element, and is an element in
+ # the special category. There might not be one.
+ afeIndex = self.tree.openElements.index(formattingElement)
+ furthestBlock = None
+ for element in self.tree.openElements[afeIndex:]:
+ if element.nameTuple in specialElements:
+ furthestBlock = element
+ break
+
+ # Step 6:
+
+ # If there is no furthest block, then the UA must
+ # first pop all the nodes from the bottom of the stack
+ # of open elements, from the current node up to and
+ # including the formatting element, then remove the
+ # formatting element from the list of active
+ # formatting elements, and finally abort these steps.
+ if furthestBlock is None:
+ element = self.tree.openElements.pop()
+ while element != formattingElement:
+ element = self.tree.openElements.pop()
+ self.tree.activeFormattingElements.remove(element)
+ return
+
+ # Step 7
+ commonAncestor = self.tree.openElements[afeIndex - 1]
+
+ # Step 8:
+ # The bookmark is supposed to help us identify where to reinsert
+ # nodes in step 15. We have to ensure that we reinsert nodes after
+ # the node before the active formatting element. Note the bookmark
+ # can move in step 9.7
+ bookmark = self.tree.activeFormattingElements.index(formattingElement)
+
+ # Step 9
+ lastNode = node = furthestBlock
+ innerLoopCounter = 0
+
+ index = self.tree.openElements.index(node)
+ while innerLoopCounter < 3:
+ innerLoopCounter += 1
+ # Node is element before node in open elements
+ index -= 1
+ node = self.tree.openElements[index]
+ if node not in self.tree.activeFormattingElements:
+ self.tree.openElements.remove(node)
+ continue
+ # Step 9.6
+ if node == formattingElement:
+ break
+ # Step 9.7
+ if lastNode == furthestBlock:
+ bookmark = self.tree.activeFormattingElements.index(node) + 1
+ # Step 9.8
+ clone = node.cloneNode()
+ # Replace node with clone
+ self.tree.activeFormattingElements[
+ self.tree.activeFormattingElements.index(node)] = clone
+ self.tree.openElements[
+ self.tree.openElements.index(node)] = clone
+ node = clone
+ # Step 9.9
+ # Remove lastNode from its parents, if any
+ if lastNode.parent:
+ lastNode.parent.removeChild(lastNode)
+ node.appendChild(lastNode)
+ # Step 9.10
+ lastNode = node
+
+ # Step 10
+ # Foster parent lastNode if commonAncestor is a
+ # table, tbody, tfoot, thead, or tr we need to foster
+ # parent the lastNode
+ if lastNode.parent:
+ lastNode.parent.removeChild(lastNode)
+
+ if commonAncestor.name in frozenset(("table", "tbody", "tfoot", "thead", "tr")):
+ parent, insertBefore = self.tree.getTableMisnestedNodePosition()
+ parent.insertBefore(lastNode, insertBefore)
+ else:
+ commonAncestor.appendChild(lastNode)
+
+ # Step 11
+ clone = formattingElement.cloneNode()
+
+ # Step 12
+ furthestBlock.reparentChildren(clone)
+
+ # Step 13
+ furthestBlock.appendChild(clone)
+
+ # Step 14
+ self.tree.activeFormattingElements.remove(formattingElement)
+ self.tree.activeFormattingElements.insert(bookmark, clone)
+
+ # Step 15
+ self.tree.openElements.remove(formattingElement)
+ self.tree.openElements.insert(
+ self.tree.openElements.index(furthestBlock) + 1, clone)
+
+ def endTagAppletMarqueeObject(self, token):
+ if self.tree.elementInScope(token["name"]):
+ self.tree.generateImpliedEndTags()
+ if self.tree.openElements[-1].name != token["name"]:
+ self.parser.parseError("end-tag-too-early", {"name": token["name"]})
+
+ if self.tree.elementInScope(token["name"]):
+ element = self.tree.openElements.pop()
+ while element.name != token["name"]:
+ element = self.tree.openElements.pop()
+ self.tree.clearActiveFormattingElements()
+
+ def endTagBr(self, token):
+ self.parser.parseError("unexpected-end-tag-treated-as",
+ {"originalName": "br", "newName": "br element"})
+ self.tree.reconstructActiveFormattingElements()
+ self.tree.insertElement(impliedTagToken("br", "StartTag"))
+ self.tree.openElements.pop()
+
+ def endTagOther(self, token):
+ for node in self.tree.openElements[::-1]:
+ if node.name == token["name"]:
+ self.tree.generateImpliedEndTags(exclude=token["name"])
+ if self.tree.openElements[-1].name != token["name"]:
+ self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
+ while self.tree.openElements.pop() != node:
+ pass
+ break
+ else:
+ if node.nameTuple in specialElements:
+ self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
+ break
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", Phase.startTagHtml),
+ (("base", "basefont", "bgsound", "command", "link", "meta",
+ "script", "style", "title"),
+ startTagProcessInHead),
+ ("body", startTagBody),
+ ("frameset", startTagFrameset),
+ (("address", "article", "aside", "blockquote", "center", "details",
+ "dir", "div", "dl", "fieldset", "figcaption", "figure",
+ "footer", "header", "hgroup", "main", "menu", "nav", "ol", "p",
+ "section", "summary", "ul"),
+ startTagCloseP),
+ (headingElements, startTagHeading),
+ (("pre", "listing"), startTagPreListing),
+ ("form", startTagForm),
+ (("li", "dd", "dt"), startTagListItem),
+ ("plaintext", startTagPlaintext),
+ ("a", startTagA),
+ (("b", "big", "code", "em", "font", "i", "s", "small", "strike",
+ "strong", "tt", "u"), startTagFormatting),
+ ("nobr", startTagNobr),
+ ("button", startTagButton),
+ (("applet", "marquee", "object"), startTagAppletMarqueeObject),
+ ("xmp", startTagXmp),
+ ("table", startTagTable),
+ (("area", "br", "embed", "img", "keygen", "wbr"),
+ startTagVoidFormatting),
+ (("param", "source", "track"), startTagParamSource),
+ ("input", startTagInput),
+ ("hr", startTagHr),
+ ("image", startTagImage),
+ ("isindex", startTagIsIndex),
+ ("textarea", startTagTextarea),
+ ("iframe", startTagIFrame),
+ ("noscript", startTagNoscript),
+ (("noembed", "noframes"), startTagRawtext),
+ ("select", startTagSelect),
+ (("rp", "rt"), startTagRpRt),
+ (("option", "optgroup"), startTagOpt),
+ (("math"), startTagMath),
+ (("svg"), startTagSvg),
+ (("caption", "col", "colgroup", "frame", "head",
+ "tbody", "td", "tfoot", "th", "thead",
+ "tr"), startTagMisplaced)
+ ])
+ startTagHandler.default = startTagOther
+
+ endTagHandler = _utils.MethodDispatcher([
+ ("body", endTagBody),
+ ("html", endTagHtml),
+ (("address", "article", "aside", "blockquote", "button", "center",
+ "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure",
+ "footer", "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre",
+ "section", "summary", "ul"), endTagBlock),
+ ("form", endTagForm),
+ ("p", endTagP),
+ (("dd", "dt", "li"), endTagListItem),
+ (headingElements, endTagHeading),
+ (("a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small",
+ "strike", "strong", "tt", "u"), endTagFormatting),
+ (("applet", "marquee", "object"), endTagAppletMarqueeObject),
+ ("br", endTagBr),
+ ])
+ endTagHandler.default = endTagOther
+
+ class TextPhase(Phase):
+ __slots__ = tuple()
+
+ def processCharacters(self, token):
+ self.tree.insertText(token["data"])
+
+ def processEOF(self):
+ self.parser.parseError("expected-named-closing-tag-but-got-eof",
+ {"name": self.tree.openElements[-1].name})
+ self.tree.openElements.pop()
+ self.parser.phase = self.parser.originalPhase
+ return True
+
+ def startTagOther(self, token):
+ assert False, "Tried to process start tag %s in RCDATA/RAWTEXT mode" % token['name']
+
+ def endTagScript(self, token):
+ node = self.tree.openElements.pop()
+ assert node.name == "script"
+ self.parser.phase = self.parser.originalPhase
+ # The rest of this method is all stuff that only happens if
+ # document.write works
+
+ def endTagOther(self, token):
+ self.tree.openElements.pop()
+ self.parser.phase = self.parser.originalPhase
+
+ startTagHandler = _utils.MethodDispatcher([])
+ startTagHandler.default = startTagOther
+ endTagHandler = _utils.MethodDispatcher([
+ ("script", endTagScript)])
+ endTagHandler.default = endTagOther
+
+ class InTablePhase(Phase):
+ # http://www.whatwg.org/specs/web-apps/current-work/#in-table
+ __slots__ = tuple()
+
+ # helper methods
+ def clearStackToTableContext(self):
+ # "clear the stack back to a table context"
+ while self.tree.openElements[-1].name not in ("table", "html"):
+ # self.parser.parseError("unexpected-implied-end-tag-in-table",
+ # {"name": self.tree.openElements[-1].name})
+ self.tree.openElements.pop()
+ # When the current node is <html> it's an innerHTML case
+
+ # processing methods
+ def processEOF(self):
+ if self.tree.openElements[-1].name != "html":
+ self.parser.parseError("eof-in-table")
+ else:
+ assert self.parser.innerHTML
+ # Stop parsing
+
+ def processSpaceCharacters(self, token):
+ originalPhase = self.parser.phase
+ self.parser.phase = self.parser.phases["inTableText"]
+ self.parser.phase.originalPhase = originalPhase
+ self.parser.phase.processSpaceCharacters(token)
+
+ def processCharacters(self, token):
+ originalPhase = self.parser.phase
+ self.parser.phase = self.parser.phases["inTableText"]
+ self.parser.phase.originalPhase = originalPhase
+ self.parser.phase.processCharacters(token)
+
+ def insertText(self, token):
+ # If we get here there must be at least one non-whitespace character
+ # Do the table magic!
+ self.tree.insertFromTable = True
+ self.parser.phases["inBody"].processCharacters(token)
+ self.tree.insertFromTable = False
+
+ def startTagCaption(self, token):
+ self.clearStackToTableContext()
+ self.tree.activeFormattingElements.append(Marker)
+ self.tree.insertElement(token)
+ self.parser.phase = self.parser.phases["inCaption"]
+
+ def startTagColgroup(self, token):
+ self.clearStackToTableContext()
+ self.tree.insertElement(token)
+ self.parser.phase = self.parser.phases["inColumnGroup"]
+
+ def startTagCol(self, token):
+ self.startTagColgroup(impliedTagToken("colgroup", "StartTag"))
+ return token
+
+ def startTagRowGroup(self, token):
+ self.clearStackToTableContext()
+ self.tree.insertElement(token)
+ self.parser.phase = self.parser.phases["inTableBody"]
+
+ def startTagImplyTbody(self, token):
+ self.startTagRowGroup(impliedTagToken("tbody", "StartTag"))
+ return token
+
+ def startTagTable(self, token):
+ self.parser.parseError("unexpected-start-tag-implies-end-tag",
+ {"startName": "table", "endName": "table"})
+ self.parser.phase.processEndTag(impliedTagToken("table"))
+ if not self.parser.innerHTML:
+ return token
+
+ def startTagStyleScript(self, token):
+ return self.parser.phases["inHead"].processStartTag(token)
+
+ def startTagInput(self, token):
+ if ("type" in token["data"] and
+ token["data"]["type"].translate(asciiUpper2Lower) == "hidden"):
+ self.parser.parseError("unexpected-hidden-input-in-table")
+ self.tree.insertElement(token)
+ # XXX associate with form
+ self.tree.openElements.pop()
+ else:
+ self.startTagOther(token)
+
+ def startTagForm(self, token):
+ self.parser.parseError("unexpected-form-in-table")
+ if self.tree.formPointer is None:
+ self.tree.insertElement(token)
+ self.tree.formPointer = self.tree.openElements[-1]
+ self.tree.openElements.pop()
+
+ def startTagOther(self, token):
+ self.parser.parseError("unexpected-start-tag-implies-table-voodoo", {"name": token["name"]})
+ # Do the table magic!
+ self.tree.insertFromTable = True
+ self.parser.phases["inBody"].processStartTag(token)
+ self.tree.insertFromTable = False
+
+ def endTagTable(self, token):
+ if self.tree.elementInScope("table", variant="table"):
+ self.tree.generateImpliedEndTags()
+ if self.tree.openElements[-1].name != "table":
+ self.parser.parseError("end-tag-too-early-named",
+ {"gotName": "table",
+ "expectedName": self.tree.openElements[-1].name})
+ while self.tree.openElements[-1].name != "table":
+ self.tree.openElements.pop()
+ self.tree.openElements.pop()
+ self.parser.resetInsertionMode()
+ else:
+ # innerHTML case
+ assert self.parser.innerHTML
+ self.parser.parseError()
+
+ def endTagIgnore(self, token):
+ self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
+
+ def endTagOther(self, token):
+ self.parser.parseError("unexpected-end-tag-implies-table-voodoo", {"name": token["name"]})
+ # Do the table magic!
+ self.tree.insertFromTable = True
+ self.parser.phases["inBody"].processEndTag(token)
+ self.tree.insertFromTable = False
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", Phase.startTagHtml),
+ ("caption", startTagCaption),
+ ("colgroup", startTagColgroup),
+ ("col", startTagCol),
+ (("tbody", "tfoot", "thead"), startTagRowGroup),
+ (("td", "th", "tr"), startTagImplyTbody),
+ ("table", startTagTable),
+ (("style", "script"), startTagStyleScript),
+ ("input", startTagInput),
+ ("form", startTagForm)
+ ])
+ startTagHandler.default = startTagOther
+
+ endTagHandler = _utils.MethodDispatcher([
+ ("table", endTagTable),
+ (("body", "caption", "col", "colgroup", "html", "tbody", "td",
+ "tfoot", "th", "thead", "tr"), endTagIgnore)
+ ])
+ endTagHandler.default = endTagOther
+
+ class InTableTextPhase(Phase):
+ __slots__ = ("originalPhase", "characterTokens")
+
+ def __init__(self, *args, **kwargs):
+ super(InTableTextPhase, self).__init__(*args, **kwargs)
+ self.originalPhase = None
+ self.characterTokens = []
+
+ def flushCharacters(self):
+ data = "".join([item["data"] for item in self.characterTokens])
+ if any([item not in spaceCharacters for item in data]):
+ token = {"type": tokenTypes["Characters"], "data": data}
+ self.parser.phases["inTable"].insertText(token)
+ elif data:
+ self.tree.insertText(data)
+ self.characterTokens = []
+
+ def processComment(self, token):
+ self.flushCharacters()
+ self.parser.phase = self.originalPhase
+ return token
+
+ def processEOF(self):
+ self.flushCharacters()
+ self.parser.phase = self.originalPhase
+ return True
+
+ def processCharacters(self, token):
+ if token["data"] == "\u0000":
+ return
+ self.characterTokens.append(token)
+
+ def processSpaceCharacters(self, token):
+ # pretty sure we should never reach here
+ self.characterTokens.append(token)
+ # assert False
+
+ def processStartTag(self, token):
+ self.flushCharacters()
+ self.parser.phase = self.originalPhase
+ return token
+
+ def processEndTag(self, token):
+ self.flushCharacters()
+ self.parser.phase = self.originalPhase
+ return token
+
+ class InCaptionPhase(Phase):
+ # http://www.whatwg.org/specs/web-apps/current-work/#in-caption
+ __slots__ = tuple()
+
+ def ignoreEndTagCaption(self):
+ return not self.tree.elementInScope("caption", variant="table")
+
+ def processEOF(self):
+ self.parser.phases["inBody"].processEOF()
+
+ def processCharacters(self, token):
+ return self.parser.phases["inBody"].processCharacters(token)
+
+ def startTagTableElement(self, token):
+ self.parser.parseError()
+ # XXX Have to duplicate logic here to find out if the tag is ignored
+ ignoreEndTag = self.ignoreEndTagCaption()
+ self.parser.phase.processEndTag(impliedTagToken("caption"))
+ if not ignoreEndTag:
+ return token
+
+ def startTagOther(self, token):
+ return self.parser.phases["inBody"].processStartTag(token)
+
+ def endTagCaption(self, token):
+ if not self.ignoreEndTagCaption():
+ # AT this code is quite similar to endTagTable in "InTable"
+ self.tree.generateImpliedEndTags()
+ if self.tree.openElements[-1].name != "caption":
+ self.parser.parseError("expected-one-end-tag-but-got-another",
+ {"gotName": "caption",
+ "expectedName": self.tree.openElements[-1].name})
+ while self.tree.openElements[-1].name != "caption":
+ self.tree.openElements.pop()
+ self.tree.openElements.pop()
+ self.tree.clearActiveFormattingElements()
+ self.parser.phase = self.parser.phases["inTable"]
+ else:
+ # innerHTML case
+ assert self.parser.innerHTML
+ self.parser.parseError()
+
+ def endTagTable(self, token):
+ self.parser.parseError()
+ ignoreEndTag = self.ignoreEndTagCaption()
+ self.parser.phase.processEndTag(impliedTagToken("caption"))
+ if not ignoreEndTag:
+ return token
+
+ def endTagIgnore(self, token):
+ self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
+
+ def endTagOther(self, token):
+ return self.parser.phases["inBody"].processEndTag(token)
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", Phase.startTagHtml),
+ (("caption", "col", "colgroup", "tbody", "td", "tfoot", "th",
+ "thead", "tr"), startTagTableElement)
+ ])
+ startTagHandler.default = startTagOther
+
+ endTagHandler = _utils.MethodDispatcher([
+ ("caption", endTagCaption),
+ ("table", endTagTable),
+ (("body", "col", "colgroup", "html", "tbody", "td", "tfoot", "th",
+ "thead", "tr"), endTagIgnore)
+ ])
+ endTagHandler.default = endTagOther
+
+ class InColumnGroupPhase(Phase):
+ # http://www.whatwg.org/specs/web-apps/current-work/#in-column
+ __slots__ = tuple()
+
+ def ignoreEndTagColgroup(self):
+ return self.tree.openElements[-1].name == "html"
+
+ def processEOF(self):
+ if self.tree.openElements[-1].name == "html":
+ assert self.parser.innerHTML
+ return
+ else:
+ ignoreEndTag = self.ignoreEndTagColgroup()
+ self.endTagColgroup(impliedTagToken("colgroup"))
+ if not ignoreEndTag:
+ return True
+
+ def processCharacters(self, token):
+ ignoreEndTag = self.ignoreEndTagColgroup()
+ self.endTagColgroup(impliedTagToken("colgroup"))
+ if not ignoreEndTag:
+ return token
+
+ def startTagCol(self, token):
+ self.tree.insertElement(token)
+ self.tree.openElements.pop()
+ token["selfClosingAcknowledged"] = True
+
+ def startTagOther(self, token):
+ ignoreEndTag = self.ignoreEndTagColgroup()
+ self.endTagColgroup(impliedTagToken("colgroup"))
+ if not ignoreEndTag:
+ return token
+
+ def endTagColgroup(self, token):
+ if self.ignoreEndTagColgroup():
+ # innerHTML case
+ assert self.parser.innerHTML
+ self.parser.parseError()
+ else:
+ self.tree.openElements.pop()
+ self.parser.phase = self.parser.phases["inTable"]
+
+ def endTagCol(self, token):
+ self.parser.parseError("no-end-tag", {"name": "col"})
+
+ def endTagOther(self, token):
+ ignoreEndTag = self.ignoreEndTagColgroup()
+ self.endTagColgroup(impliedTagToken("colgroup"))
+ if not ignoreEndTag:
+ return token
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", Phase.startTagHtml),
+ ("col", startTagCol)
+ ])
+ startTagHandler.default = startTagOther
+
+ endTagHandler = _utils.MethodDispatcher([
+ ("colgroup", endTagColgroup),
+ ("col", endTagCol)
+ ])
+ endTagHandler.default = endTagOther
+
+ class InTableBodyPhase(Phase):
+ # http://www.whatwg.org/specs/web-apps/current-work/#in-table0
+ __slots__ = tuple()
+
+ # helper methods
+ def clearStackToTableBodyContext(self):
+ while self.tree.openElements[-1].name not in ("tbody", "tfoot",
+ "thead", "html"):
+ # self.parser.parseError("unexpected-implied-end-tag-in-table",
+ # {"name": self.tree.openElements[-1].name})
+ self.tree.openElements.pop()
+ if self.tree.openElements[-1].name == "html":
+ assert self.parser.innerHTML
+
+ # the rest
+ def processEOF(self):
+ self.parser.phases["inTable"].processEOF()
+
+ def processSpaceCharacters(self, token):
+ return self.parser.phases["inTable"].processSpaceCharacters(token)
+
+ def processCharacters(self, token):
+ return self.parser.phases["inTable"].processCharacters(token)
+
+ def startTagTr(self, token):
+ self.clearStackToTableBodyContext()
+ self.tree.insertElement(token)
+ self.parser.phase = self.parser.phases["inRow"]
+
+ def startTagTableCell(self, token):
+ self.parser.parseError("unexpected-cell-in-table-body",
+ {"name": token["name"]})
+ self.startTagTr(impliedTagToken("tr", "StartTag"))
+ return token
+
+ def startTagTableOther(self, token):
+ # XXX AT Any ideas on how to share this with endTagTable?
+ if (self.tree.elementInScope("tbody", variant="table") or
+ self.tree.elementInScope("thead", variant="table") or
+ self.tree.elementInScope("tfoot", variant="table")):
+ self.clearStackToTableBodyContext()
+ self.endTagTableRowGroup(
+ impliedTagToken(self.tree.openElements[-1].name))
+ return token
+ else:
+ # innerHTML case
+ assert self.parser.innerHTML
+ self.parser.parseError()
+
+ def startTagOther(self, token):
+ return self.parser.phases["inTable"].processStartTag(token)
+
+ def endTagTableRowGroup(self, token):
+ if self.tree.elementInScope(token["name"], variant="table"):
+ self.clearStackToTableBodyContext()
+ self.tree.openElements.pop()
+ self.parser.phase = self.parser.phases["inTable"]
+ else:
+ self.parser.parseError("unexpected-end-tag-in-table-body",
+ {"name": token["name"]})
+
+ def endTagTable(self, token):
+ if (self.tree.elementInScope("tbody", variant="table") or
+ self.tree.elementInScope("thead", variant="table") or
+ self.tree.elementInScope("tfoot", variant="table")):
+ self.clearStackToTableBodyContext()
+ self.endTagTableRowGroup(
+ impliedTagToken(self.tree.openElements[-1].name))
+ return token
+ else:
+ # innerHTML case
+ assert self.parser.innerHTML
+ self.parser.parseError()
+
+ def endTagIgnore(self, token):
+ self.parser.parseError("unexpected-end-tag-in-table-body",
+ {"name": token["name"]})
+
+ def endTagOther(self, token):
+ return self.parser.phases["inTable"].processEndTag(token)
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", Phase.startTagHtml),
+ ("tr", startTagTr),
+ (("td", "th"), startTagTableCell),
+ (("caption", "col", "colgroup", "tbody", "tfoot", "thead"),
+ startTagTableOther)
+ ])
+ startTagHandler.default = startTagOther
+
+ endTagHandler = _utils.MethodDispatcher([
+ (("tbody", "tfoot", "thead"), endTagTableRowGroup),
+ ("table", endTagTable),
+ (("body", "caption", "col", "colgroup", "html", "td", "th",
+ "tr"), endTagIgnore)
+ ])
+ endTagHandler.default = endTagOther
+
+ class InRowPhase(Phase):
+ # http://www.whatwg.org/specs/web-apps/current-work/#in-row
+ __slots__ = tuple()
+
+ # helper methods (XXX unify this with other table helper methods)
+ def clearStackToTableRowContext(self):
+ while self.tree.openElements[-1].name not in ("tr", "html"):
+ self.parser.parseError("unexpected-implied-end-tag-in-table-row",
+ {"name": self.tree.openElements[-1].name})
+ self.tree.openElements.pop()
+
+ def ignoreEndTagTr(self):
+ return not self.tree.elementInScope("tr", variant="table")
+
+ # the rest
+ def processEOF(self):
+ self.parser.phases["inTable"].processEOF()
+
+ def processSpaceCharacters(self, token):
+ return self.parser.phases["inTable"].processSpaceCharacters(token)
+
+ def processCharacters(self, token):
+ return self.parser.phases["inTable"].processCharacters(token)
+
+ def startTagTableCell(self, token):
+ self.clearStackToTableRowContext()
+ self.tree.insertElement(token)
+ self.parser.phase = self.parser.phases["inCell"]
+ self.tree.activeFormattingElements.append(Marker)
+
+ def startTagTableOther(self, token):
+ ignoreEndTag = self.ignoreEndTagTr()
+ self.endTagTr(impliedTagToken("tr"))
+ # XXX how are we sure it's always ignored in the innerHTML case?
+ if not ignoreEndTag:
+ return token
+
+ def startTagOther(self, token):
+ return self.parser.phases["inTable"].processStartTag(token)
+
+ def endTagTr(self, token):
+ if not self.ignoreEndTagTr():
+ self.clearStackToTableRowContext()
+ self.tree.openElements.pop()
+ self.parser.phase = self.parser.phases["inTableBody"]
+ else:
+ # innerHTML case
+ assert self.parser.innerHTML
+ self.parser.parseError()
+
+ def endTagTable(self, token):
+ ignoreEndTag = self.ignoreEndTagTr()
+ self.endTagTr(impliedTagToken("tr"))
+ # Reprocess the current tag if the tr end tag was not ignored
+ # XXX how are we sure it's always ignored in the innerHTML case?
+ if not ignoreEndTag:
+ return token
+
+ def endTagTableRowGroup(self, token):
+ if self.tree.elementInScope(token["name"], variant="table"):
+ self.endTagTr(impliedTagToken("tr"))
+ return token
+ else:
+ self.parser.parseError()
+
+ def endTagIgnore(self, token):
+ self.parser.parseError("unexpected-end-tag-in-table-row",
+ {"name": token["name"]})
+
+ def endTagOther(self, token):
+ return self.parser.phases["inTable"].processEndTag(token)
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", Phase.startTagHtml),
+ (("td", "th"), startTagTableCell),
+ (("caption", "col", "colgroup", "tbody", "tfoot", "thead",
+ "tr"), startTagTableOther)
+ ])
+ startTagHandler.default = startTagOther
+
+ endTagHandler = _utils.MethodDispatcher([
+ ("tr", endTagTr),
+ ("table", endTagTable),
+ (("tbody", "tfoot", "thead"), endTagTableRowGroup),
+ (("body", "caption", "col", "colgroup", "html", "td", "th"),
+ endTagIgnore)
+ ])
+ endTagHandler.default = endTagOther
+
+ class InCellPhase(Phase):
+ # http://www.whatwg.org/specs/web-apps/current-work/#in-cell
+ __slots__ = tuple()
+
+ # helper
+ def closeCell(self):
+ if self.tree.elementInScope("td", variant="table"):
+ self.endTagTableCell(impliedTagToken("td"))
+ elif self.tree.elementInScope("th", variant="table"):
+ self.endTagTableCell(impliedTagToken("th"))
+
+ # the rest
+ def processEOF(self):
+ self.parser.phases["inBody"].processEOF()
+
+ def processCharacters(self, token):
+ return self.parser.phases["inBody"].processCharacters(token)
+
+ def startTagTableOther(self, token):
+ if (self.tree.elementInScope("td", variant="table") or
+ self.tree.elementInScope("th", variant="table")):
+ self.closeCell()
+ return token
+ else:
+ # innerHTML case
+ assert self.parser.innerHTML
+ self.parser.parseError()
+
+ def startTagOther(self, token):
+ return self.parser.phases["inBody"].processStartTag(token)
+
+ def endTagTableCell(self, token):
+ if self.tree.elementInScope(token["name"], variant="table"):
+ self.tree.generateImpliedEndTags(token["name"])
+ if self.tree.openElements[-1].name != token["name"]:
+ self.parser.parseError("unexpected-cell-end-tag",
+ {"name": token["name"]})
+ while True:
+ node = self.tree.openElements.pop()
+ if node.name == token["name"]:
+ break
+ else:
+ self.tree.openElements.pop()
+ self.tree.clearActiveFormattingElements()
+ self.parser.phase = self.parser.phases["inRow"]
+ else:
+ self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
+
+ def endTagIgnore(self, token):
+ self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
+
+ def endTagImply(self, token):
+ if self.tree.elementInScope(token["name"], variant="table"):
+ self.closeCell()
+ return token
+ else:
+ # sometimes innerHTML case
+ self.parser.parseError()
+
+ def endTagOther(self, token):
+ return self.parser.phases["inBody"].processEndTag(token)
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", Phase.startTagHtml),
+ (("caption", "col", "colgroup", "tbody", "td", "tfoot", "th",
+ "thead", "tr"), startTagTableOther)
+ ])
+ startTagHandler.default = startTagOther
+
+ endTagHandler = _utils.MethodDispatcher([
+ (("td", "th"), endTagTableCell),
+ (("body", "caption", "col", "colgroup", "html"), endTagIgnore),
+ (("table", "tbody", "tfoot", "thead", "tr"), endTagImply)
+ ])
+ endTagHandler.default = endTagOther
+
+ class InSelectPhase(Phase):
+ __slots__ = tuple()
+
+ # http://www.whatwg.org/specs/web-apps/current-work/#in-select
+ def processEOF(self):
+ if self.tree.openElements[-1].name != "html":
+ self.parser.parseError("eof-in-select")
+ else:
+ assert self.parser.innerHTML
+
+ def processCharacters(self, token):
+ if token["data"] == "\u0000":
+ return
+ self.tree.insertText(token["data"])
+
+ def startTagOption(self, token):
+ # We need to imply </option> if <option> is the current node.
+ if self.tree.openElements[-1].name == "option":
+ self.tree.openElements.pop()
+ self.tree.insertElement(token)
+
+ def startTagOptgroup(self, token):
+ if self.tree.openElements[-1].name == "option":
+ self.tree.openElements.pop()
+ if self.tree.openElements[-1].name == "optgroup":
+ self.tree.openElements.pop()
+ self.tree.insertElement(token)
+
+ def startTagSelect(self, token):
+ self.parser.parseError("unexpected-select-in-select")
+ self.endTagSelect(impliedTagToken("select"))
+
+ def startTagInput(self, token):
+ self.parser.parseError("unexpected-input-in-select")
+ if self.tree.elementInScope("select", variant="select"):
+ self.endTagSelect(impliedTagToken("select"))
+ return token
+ else:
+ assert self.parser.innerHTML
+
+ def startTagScript(self, token):
+ return self.parser.phases["inHead"].processStartTag(token)
+
+ def startTagOther(self, token):
+ self.parser.parseError("unexpected-start-tag-in-select",
+ {"name": token["name"]})
+
+ def endTagOption(self, token):
+ if self.tree.openElements[-1].name == "option":
+ self.tree.openElements.pop()
+ else:
+ self.parser.parseError("unexpected-end-tag-in-select",
+ {"name": "option"})
+
+ def endTagOptgroup(self, token):
+ # </optgroup> implicitly closes <option>
+ if (self.tree.openElements[-1].name == "option" and
+ self.tree.openElements[-2].name == "optgroup"):
+ self.tree.openElements.pop()
+ # It also closes </optgroup>
+ if self.tree.openElements[-1].name == "optgroup":
+ self.tree.openElements.pop()
+ # But nothing else
+ else:
+ self.parser.parseError("unexpected-end-tag-in-select",
+ {"name": "optgroup"})
+
+ def endTagSelect(self, token):
+ if self.tree.elementInScope("select", variant="select"):
+ node = self.tree.openElements.pop()
+ while node.name != "select":
+ node = self.tree.openElements.pop()
+ self.parser.resetInsertionMode()
+ else:
+ # innerHTML case
+ assert self.parser.innerHTML
+ self.parser.parseError()
+
+ def endTagOther(self, token):
+ self.parser.parseError("unexpected-end-tag-in-select",
+ {"name": token["name"]})
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", Phase.startTagHtml),
+ ("option", startTagOption),
+ ("optgroup", startTagOptgroup),
+ ("select", startTagSelect),
+ (("input", "keygen", "textarea"), startTagInput),
+ ("script", startTagScript)
+ ])
+ startTagHandler.default = startTagOther
+
+ endTagHandler = _utils.MethodDispatcher([
+ ("option", endTagOption),
+ ("optgroup", endTagOptgroup),
+ ("select", endTagSelect)
+ ])
+ endTagHandler.default = endTagOther
+
+ class InSelectInTablePhase(Phase):
+ __slots__ = tuple()
+
+ def processEOF(self):
+ self.parser.phases["inSelect"].processEOF()
+
+ def processCharacters(self, token):
+ return self.parser.phases["inSelect"].processCharacters(token)
+
+ def startTagTable(self, token):
+ self.parser.parseError("unexpected-table-element-start-tag-in-select-in-table", {"name": token["name"]})
+ self.endTagOther(impliedTagToken("select"))
+ return token
+
+ def startTagOther(self, token):
+ return self.parser.phases["inSelect"].processStartTag(token)
+
+ def endTagTable(self, token):
+ self.parser.parseError("unexpected-table-element-end-tag-in-select-in-table", {"name": token["name"]})
+ if self.tree.elementInScope(token["name"], variant="table"):
+ self.endTagOther(impliedTagToken("select"))
+ return token
+
+ def endTagOther(self, token):
+ return self.parser.phases["inSelect"].processEndTag(token)
+
+ startTagHandler = _utils.MethodDispatcher([
+ (("caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th"),
+ startTagTable)
+ ])
+ startTagHandler.default = startTagOther
+
+ endTagHandler = _utils.MethodDispatcher([
+ (("caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th"),
+ endTagTable)
+ ])
+ endTagHandler.default = endTagOther
+
+ class InForeignContentPhase(Phase):
+ __slots__ = tuple()
+
+ breakoutElements = frozenset(["b", "big", "blockquote", "body", "br",
+ "center", "code", "dd", "div", "dl", "dt",
+ "em", "embed", "h1", "h2", "h3",
+ "h4", "h5", "h6", "head", "hr", "i", "img",
+ "li", "listing", "menu", "meta", "nobr",
+ "ol", "p", "pre", "ruby", "s", "small",
+ "span", "strong", "strike", "sub", "sup",
+ "table", "tt", "u", "ul", "var"])
+
+ def adjustSVGTagNames(self, token):
+ replacements = {"altglyph": "altGlyph",
+ "altglyphdef": "altGlyphDef",
+ "altglyphitem": "altGlyphItem",
+ "animatecolor": "animateColor",
+ "animatemotion": "animateMotion",
+ "animatetransform": "animateTransform",
+ "clippath": "clipPath",
+ "feblend": "feBlend",
+ "fecolormatrix": "feColorMatrix",
+ "fecomponenttransfer": "feComponentTransfer",
+ "fecomposite": "feComposite",
+ "feconvolvematrix": "feConvolveMatrix",
+ "fediffuselighting": "feDiffuseLighting",
+ "fedisplacementmap": "feDisplacementMap",
+ "fedistantlight": "feDistantLight",
+ "feflood": "feFlood",
+ "fefunca": "feFuncA",
+ "fefuncb": "feFuncB",
+ "fefuncg": "feFuncG",
+ "fefuncr": "feFuncR",
+ "fegaussianblur": "feGaussianBlur",
+ "feimage": "feImage",
+ "femerge": "feMerge",
+ "femergenode": "feMergeNode",
+ "femorphology": "feMorphology",
+ "feoffset": "feOffset",
+ "fepointlight": "fePointLight",
+ "fespecularlighting": "feSpecularLighting",
+ "fespotlight": "feSpotLight",
+ "fetile": "feTile",
+ "feturbulence": "feTurbulence",
+ "foreignobject": "foreignObject",
+ "glyphref": "glyphRef",
+ "lineargradient": "linearGradient",
+ "radialgradient": "radialGradient",
+ "textpath": "textPath"}
+
+ if token["name"] in replacements:
+ token["name"] = replacements[token["name"]]
+
+ def processCharacters(self, token):
+ if token["data"] == "\u0000":
+ token["data"] = "\uFFFD"
+ elif (self.parser.framesetOK and
+ any(char not in spaceCharacters for char in token["data"])):
+ self.parser.framesetOK = False
+ Phase.processCharacters(self, token)
+
+ def processStartTag(self, token):
+ currentNode = self.tree.openElements[-1]
+ if (token["name"] in self.breakoutElements or
+ (token["name"] == "font" and
+ set(token["data"].keys()) & {"color", "face", "size"})):
+ self.parser.parseError("unexpected-html-element-in-foreign-content",
+ {"name": token["name"]})
+ while (self.tree.openElements[-1].namespace !=
+ self.tree.defaultNamespace and
+ not self.parser.isHTMLIntegrationPoint(self.tree.openElements[-1]) and
+ not self.parser.isMathMLTextIntegrationPoint(self.tree.openElements[-1])):
+ self.tree.openElements.pop()
+ return token
+
+ else:
+ if currentNode.namespace == namespaces["mathml"]:
+ self.parser.adjustMathMLAttributes(token)
+ elif currentNode.namespace == namespaces["svg"]:
+ self.adjustSVGTagNames(token)
+ self.parser.adjustSVGAttributes(token)
+ self.parser.adjustForeignAttributes(token)
+ token["namespace"] = currentNode.namespace
+ self.tree.insertElement(token)
+ if token["selfClosing"]:
+ self.tree.openElements.pop()
+ token["selfClosingAcknowledged"] = True
+
+ def processEndTag(self, token):
+ nodeIndex = len(self.tree.openElements) - 1
+ node = self.tree.openElements[-1]
+ if node.name.translate(asciiUpper2Lower) != token["name"]:
+ self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
+
+ while True:
+ if node.name.translate(asciiUpper2Lower) == token["name"]:
+ # XXX this isn't in the spec but it seems necessary
+ if self.parser.phase == self.parser.phases["inTableText"]:
+ self.parser.phase.flushCharacters()
+ self.parser.phase = self.parser.phase.originalPhase
+ while self.tree.openElements.pop() != node:
+ assert self.tree.openElements
+ new_token = None
+ break
+ nodeIndex -= 1
+
+ node = self.tree.openElements[nodeIndex]
+ if node.namespace != self.tree.defaultNamespace:
+ continue
+ else:
+ new_token = self.parser.phase.processEndTag(token)
+ break
+ return new_token
+
+ class AfterBodyPhase(Phase):
+ __slots__ = tuple()
+
+ def processEOF(self):
+ # Stop parsing
+ pass
+
+ def processComment(self, token):
+ # This is needed because data is to be appended to the <html> element
+ # here and not to whatever is currently open.
+ self.tree.insertComment(token, self.tree.openElements[0])
+
+ def processCharacters(self, token):
+ self.parser.parseError("unexpected-char-after-body")
+ self.parser.phase = self.parser.phases["inBody"]
+ return token
+
+ def startTagHtml(self, token):
+ return self.parser.phases["inBody"].processStartTag(token)
+
+ def startTagOther(self, token):
+ self.parser.parseError("unexpected-start-tag-after-body",
+ {"name": token["name"]})
+ self.parser.phase = self.parser.phases["inBody"]
+ return token
+
+ def endTagHtml(self, name):
+ if self.parser.innerHTML:
+ self.parser.parseError("unexpected-end-tag-after-body-innerhtml")
+ else:
+ self.parser.phase = self.parser.phases["afterAfterBody"]
+
+ def endTagOther(self, token):
+ self.parser.parseError("unexpected-end-tag-after-body",
+ {"name": token["name"]})
+ self.parser.phase = self.parser.phases["inBody"]
+ return token
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", startTagHtml)
+ ])
+ startTagHandler.default = startTagOther
+
+ endTagHandler = _utils.MethodDispatcher([("html", endTagHtml)])
+ endTagHandler.default = endTagOther
+
+ class InFramesetPhase(Phase):
+ # http://www.whatwg.org/specs/web-apps/current-work/#in-frameset
+ __slots__ = tuple()
+
+ def processEOF(self):
+ if self.tree.openElements[-1].name != "html":
+ self.parser.parseError("eof-in-frameset")
+ else:
+ assert self.parser.innerHTML
+
+ def processCharacters(self, token):
+ self.parser.parseError("unexpected-char-in-frameset")
+
+ def startTagFrameset(self, token):
+ self.tree.insertElement(token)
+
+ def startTagFrame(self, token):
+ self.tree.insertElement(token)
+ self.tree.openElements.pop()
+
+ def startTagNoframes(self, token):
+ return self.parser.phases["inBody"].processStartTag(token)
+
+ def startTagOther(self, token):
+ self.parser.parseError("unexpected-start-tag-in-frameset",
+ {"name": token["name"]})
+
+ def endTagFrameset(self, token):
+ if self.tree.openElements[-1].name == "html":
+ # innerHTML case
+ self.parser.parseError("unexpected-frameset-in-frameset-innerhtml")
+ else:
+ self.tree.openElements.pop()
+ if (not self.parser.innerHTML and
+ self.tree.openElements[-1].name != "frameset"):
+ # If we're not in innerHTML mode and the current node is not a
+ # "frameset" element (anymore) then switch.
+ self.parser.phase = self.parser.phases["afterFrameset"]
+
+ def endTagOther(self, token):
+ self.parser.parseError("unexpected-end-tag-in-frameset",
+ {"name": token["name"]})
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", Phase.startTagHtml),
+ ("frameset", startTagFrameset),
+ ("frame", startTagFrame),
+ ("noframes", startTagNoframes)
+ ])
+ startTagHandler.default = startTagOther
+
+ endTagHandler = _utils.MethodDispatcher([
+ ("frameset", endTagFrameset)
+ ])
+ endTagHandler.default = endTagOther
+
+ class AfterFramesetPhase(Phase):
+ # http://www.whatwg.org/specs/web-apps/current-work/#after3
+ __slots__ = tuple()
+
+ def processEOF(self):
+ # Stop parsing
+ pass
+
+ def processCharacters(self, token):
+ self.parser.parseError("unexpected-char-after-frameset")
+
+ def startTagNoframes(self, token):
+ return self.parser.phases["inHead"].processStartTag(token)
+
+ def startTagOther(self, token):
+ self.parser.parseError("unexpected-start-tag-after-frameset",
+ {"name": token["name"]})
+
+ def endTagHtml(self, token):
+ self.parser.phase = self.parser.phases["afterAfterFrameset"]
+
+ def endTagOther(self, token):
+ self.parser.parseError("unexpected-end-tag-after-frameset",
+ {"name": token["name"]})
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", Phase.startTagHtml),
+ ("noframes", startTagNoframes)
+ ])
+ startTagHandler.default = startTagOther
+
+ endTagHandler = _utils.MethodDispatcher([
+ ("html", endTagHtml)
+ ])
+ endTagHandler.default = endTagOther
+
+ class AfterAfterBodyPhase(Phase):
+ __slots__ = tuple()
+
+ def processEOF(self):
+ pass
+
+ def processComment(self, token):
+ self.tree.insertComment(token, self.tree.document)
+
+ def processSpaceCharacters(self, token):
+ return self.parser.phases["inBody"].processSpaceCharacters(token)
+
+ def processCharacters(self, token):
+ self.parser.parseError("expected-eof-but-got-char")
+ self.parser.phase = self.parser.phases["inBody"]
+ return token
+
+ def startTagHtml(self, token):
+ return self.parser.phases["inBody"].processStartTag(token)
+
+ def startTagOther(self, token):
+ self.parser.parseError("expected-eof-but-got-start-tag",
+ {"name": token["name"]})
+ self.parser.phase = self.parser.phases["inBody"]
+ return token
+
+ def processEndTag(self, token):
+ self.parser.parseError("expected-eof-but-got-end-tag",
+ {"name": token["name"]})
+ self.parser.phase = self.parser.phases["inBody"]
+ return token
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", startTagHtml)
+ ])
+ startTagHandler.default = startTagOther
+
+ class AfterAfterFramesetPhase(Phase):
+ __slots__ = tuple()
+
+ def processEOF(self):
+ pass
+
+ def processComment(self, token):
+ self.tree.insertComment(token, self.tree.document)
+
+ def processSpaceCharacters(self, token):
+ return self.parser.phases["inBody"].processSpaceCharacters(token)
+
+ def processCharacters(self, token):
+ self.parser.parseError("expected-eof-but-got-char")
+
+ def startTagHtml(self, token):
+ return self.parser.phases["inBody"].processStartTag(token)
+
+ def startTagNoFrames(self, token):
+ return self.parser.phases["inHead"].processStartTag(token)
+
+ def startTagOther(self, token):
+ self.parser.parseError("expected-eof-but-got-start-tag",
+ {"name": token["name"]})
+
+ def processEndTag(self, token):
+ self.parser.parseError("expected-eof-but-got-end-tag",
+ {"name": token["name"]})
+
+ startTagHandler = _utils.MethodDispatcher([
+ ("html", startTagHtml),
+ ("noframes", startTagNoFrames)
+ ])
+ startTagHandler.default = startTagOther
+
+ # pylint:enable=unused-argument
+
+ return {
+ "initial": InitialPhase,
+ "beforeHtml": BeforeHtmlPhase,
+ "beforeHead": BeforeHeadPhase,
+ "inHead": InHeadPhase,
+ "inHeadNoscript": InHeadNoscriptPhase,
+ "afterHead": AfterHeadPhase,
+ "inBody": InBodyPhase,
+ "text": TextPhase,
+ "inTable": InTablePhase,
+ "inTableText": InTableTextPhase,
+ "inCaption": InCaptionPhase,
+ "inColumnGroup": InColumnGroupPhase,
+ "inTableBody": InTableBodyPhase,
+ "inRow": InRowPhase,
+ "inCell": InCellPhase,
+ "inSelect": InSelectPhase,
+ "inSelectInTable": InSelectInTablePhase,
+ "inForeignContent": InForeignContentPhase,
+ "afterBody": AfterBodyPhase,
+ "inFrameset": InFramesetPhase,
+ "afterFrameset": AfterFramesetPhase,
+ "afterAfterBody": AfterAfterBodyPhase,
+ "afterAfterFrameset": AfterAfterFramesetPhase,
+ # XXX after after frameset
+ }
+
+
+def adjust_attributes(token, replacements):
+ needs_adjustment = viewkeys(token['data']) & viewkeys(replacements)
+ if needs_adjustment:
+ token['data'] = type(token['data'])((replacements.get(k, k), v)
+ for k, v in token['data'].items())
+
+
+def impliedTagToken(name, type="EndTag", attributes=None,
+ selfClosing=False):
+ if attributes is None:
+ attributes = {}
+ return {"type": tokenTypes[type], "name": name, "data": attributes,
+ "selfClosing": selfClosing}
+
+
+class ParseError(Exception):
+ """Error in parsed document"""
+ pass
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/serializer.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/serializer.py
new file mode 100644
index 0000000000..c66df68392
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/serializer.py
@@ -0,0 +1,409 @@
+from __future__ import absolute_import, division, unicode_literals
+from six import text_type
+
+import re
+
+from codecs import register_error, xmlcharrefreplace_errors
+
+from .constants import voidElements, booleanAttributes, spaceCharacters
+from .constants import rcdataElements, entities, xmlEntities
+from . import treewalkers, _utils
+from xml.sax.saxutils import escape
+
+_quoteAttributeSpecChars = "".join(spaceCharacters) + "\"'=<>`"
+_quoteAttributeSpec = re.compile("[" + _quoteAttributeSpecChars + "]")
+_quoteAttributeLegacy = re.compile("[" + _quoteAttributeSpecChars +
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n"
+ "\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15"
+ "\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+ "\x20\x2f\x60\xa0\u1680\u180e\u180f\u2000"
+ "\u2001\u2002\u2003\u2004\u2005\u2006\u2007"
+ "\u2008\u2009\u200a\u2028\u2029\u202f\u205f"
+ "\u3000]")
+
+
+_encode_entity_map = {}
+_is_ucs4 = len("\U0010FFFF") == 1
+for k, v in list(entities.items()):
+ # skip multi-character entities
+ if ((_is_ucs4 and len(v) > 1) or
+ (not _is_ucs4 and len(v) > 2)):
+ continue
+ if v != "&":
+ if len(v) == 2:
+ v = _utils.surrogatePairToCodepoint(v)
+ else:
+ v = ord(v)
+ if v not in _encode_entity_map or k.islower():
+ # prefer &lt; over &LT; and similarly for &amp;, &gt;, etc.
+ _encode_entity_map[v] = k
+
+
+def htmlentityreplace_errors(exc):
+ if isinstance(exc, (UnicodeEncodeError, UnicodeTranslateError)):
+ res = []
+ codepoints = []
+ skip = False
+ for i, c in enumerate(exc.object[exc.start:exc.end]):
+ if skip:
+ skip = False
+ continue
+ index = i + exc.start
+ if _utils.isSurrogatePair(exc.object[index:min([exc.end, index + 2])]):
+ codepoint = _utils.surrogatePairToCodepoint(exc.object[index:index + 2])
+ skip = True
+ else:
+ codepoint = ord(c)
+ codepoints.append(codepoint)
+ for cp in codepoints:
+ e = _encode_entity_map.get(cp)
+ if e:
+ res.append("&")
+ res.append(e)
+ if not e.endswith(";"):
+ res.append(";")
+ else:
+ res.append("&#x%s;" % (hex(cp)[2:]))
+ return ("".join(res), exc.end)
+ else:
+ return xmlcharrefreplace_errors(exc)
+
+
+register_error("htmlentityreplace", htmlentityreplace_errors)
+
+
+def serialize(input, tree="etree", encoding=None, **serializer_opts):
+ """Serializes the input token stream using the specified treewalker
+
+ :arg input: the token stream to serialize
+
+ :arg tree: the treewalker to use
+
+ :arg encoding: the encoding to use
+
+ :arg serializer_opts: any options to pass to the
+ :py:class:`html5lib.serializer.HTMLSerializer` that gets created
+
+ :returns: the tree serialized as a string
+
+ Example:
+
+ >>> from html5lib.html5parser import parse
+ >>> from html5lib.serializer import serialize
+ >>> token_stream = parse('<html><body><p>Hi!</p></body></html>')
+ >>> serialize(token_stream, omit_optional_tags=False)
+ '<html><head></head><body><p>Hi!</p></body></html>'
+
+ """
+ # XXX: Should we cache this?
+ walker = treewalkers.getTreeWalker(tree)
+ s = HTMLSerializer(**serializer_opts)
+ return s.render(walker(input), encoding)
+
+
+class HTMLSerializer(object):
+
+ # attribute quoting options
+ quote_attr_values = "legacy" # be secure by default
+ quote_char = '"'
+ use_best_quote_char = True
+
+ # tag syntax options
+ omit_optional_tags = True
+ minimize_boolean_attributes = True
+ use_trailing_solidus = False
+ space_before_trailing_solidus = True
+
+ # escaping options
+ escape_lt_in_attrs = False
+ escape_rcdata = False
+ resolve_entities = True
+
+ # miscellaneous options
+ alphabetical_attributes = False
+ inject_meta_charset = True
+ strip_whitespace = False
+ sanitize = False
+
+ options = ("quote_attr_values", "quote_char", "use_best_quote_char",
+ "omit_optional_tags", "minimize_boolean_attributes",
+ "use_trailing_solidus", "space_before_trailing_solidus",
+ "escape_lt_in_attrs", "escape_rcdata", "resolve_entities",
+ "alphabetical_attributes", "inject_meta_charset",
+ "strip_whitespace", "sanitize")
+
+ def __init__(self, **kwargs):
+ """Initialize HTMLSerializer
+
+ :arg inject_meta_charset: Whether or not to inject the meta charset.
+
+ Defaults to ``True``.
+
+ :arg quote_attr_values: Whether to quote attribute values that don't
+ require quoting per legacy browser behavior (``"legacy"``), when
+ required by the standard (``"spec"``), or always (``"always"``).
+
+ Defaults to ``"legacy"``.
+
+ :arg quote_char: Use given quote character for attribute quoting.
+
+ Defaults to ``"`` which will use double quotes unless attribute
+ value contains a double quote, in which case single quotes are
+ used.
+
+ :arg escape_lt_in_attrs: Whether or not to escape ``<`` in attribute
+ values.
+
+ Defaults to ``False``.
+
+ :arg escape_rcdata: Whether to escape characters that need to be
+ escaped within normal elements within rcdata elements such as
+ style.
+
+ Defaults to ``False``.
+
+ :arg resolve_entities: Whether to resolve named character entities that
+ appear in the source tree. The XML predefined entities &lt; &gt;
+ &amp; &quot; &apos; are unaffected by this setting.
+
+ Defaults to ``True``.
+
+ :arg strip_whitespace: Whether to remove semantically meaningless
+ whitespace. (This compresses all whitespace to a single space
+ except within ``pre``.)
+
+ Defaults to ``False``.
+
+ :arg minimize_boolean_attributes: Shortens boolean attributes to give
+ just the attribute value, for example::
+
+ <input disabled="disabled">
+
+ becomes::
+
+ <input disabled>
+
+ Defaults to ``True``.
+
+ :arg use_trailing_solidus: Includes a close-tag slash at the end of the
+ start tag of void elements (empty elements whose end tag is
+ forbidden). E.g. ``<hr/>``.
+
+ Defaults to ``False``.
+
+ :arg space_before_trailing_solidus: Places a space immediately before
+ the closing slash in a tag using a trailing solidus. E.g.
+ ``<hr />``. Requires ``use_trailing_solidus=True``.
+
+ Defaults to ``True``.
+
+ :arg sanitize: Strip all unsafe or unknown constructs from output.
+ See :py:class:`html5lib.filters.sanitizer.Filter`.
+
+ Defaults to ``False``.
+
+ :arg omit_optional_tags: Omit start/end tags that are optional.
+
+ Defaults to ``True``.
+
+ :arg alphabetical_attributes: Reorder attributes to be in alphabetical order.
+
+ Defaults to ``False``.
+
+ """
+ unexpected_args = frozenset(kwargs) - frozenset(self.options)
+ if len(unexpected_args) > 0:
+ raise TypeError("__init__() got an unexpected keyword argument '%s'" % next(iter(unexpected_args)))
+ if 'quote_char' in kwargs:
+ self.use_best_quote_char = False
+ for attr in self.options:
+ setattr(self, attr, kwargs.get(attr, getattr(self, attr)))
+ self.errors = []
+ self.strict = False
+
+ def encode(self, string):
+ assert(isinstance(string, text_type))
+ if self.encoding:
+ return string.encode(self.encoding, "htmlentityreplace")
+ else:
+ return string
+
+ def encodeStrict(self, string):
+ assert(isinstance(string, text_type))
+ if self.encoding:
+ return string.encode(self.encoding, "strict")
+ else:
+ return string
+
+ def serialize(self, treewalker, encoding=None):
+ # pylint:disable=too-many-nested-blocks
+ self.encoding = encoding
+ in_cdata = False
+ self.errors = []
+
+ if encoding and self.inject_meta_charset:
+ from .filters.inject_meta_charset import Filter
+ treewalker = Filter(treewalker, encoding)
+ # Alphabetical attributes is here under the assumption that none of
+ # the later filters add or change order of attributes; it needs to be
+ # before the sanitizer so escaped elements come out correctly
+ if self.alphabetical_attributes:
+ from .filters.alphabeticalattributes import Filter
+ treewalker = Filter(treewalker)
+ # WhitespaceFilter should be used before OptionalTagFilter
+ # for maximum efficiently of this latter filter
+ if self.strip_whitespace:
+ from .filters.whitespace import Filter
+ treewalker = Filter(treewalker)
+ if self.sanitize:
+ from .filters.sanitizer import Filter
+ treewalker = Filter(treewalker)
+ if self.omit_optional_tags:
+ from .filters.optionaltags import Filter
+ treewalker = Filter(treewalker)
+
+ for token in treewalker:
+ type = token["type"]
+ if type == "Doctype":
+ doctype = "<!DOCTYPE %s" % token["name"]
+
+ if token["publicId"]:
+ doctype += ' PUBLIC "%s"' % token["publicId"]
+ elif token["systemId"]:
+ doctype += " SYSTEM"
+ if token["systemId"]:
+ if token["systemId"].find('"') >= 0:
+ if token["systemId"].find("'") >= 0:
+ self.serializeError("System identifier contains both single and double quote characters")
+ quote_char = "'"
+ else:
+ quote_char = '"'
+ doctype += " %s%s%s" % (quote_char, token["systemId"], quote_char)
+
+ doctype += ">"
+ yield self.encodeStrict(doctype)
+
+ elif type in ("Characters", "SpaceCharacters"):
+ if type == "SpaceCharacters" or in_cdata:
+ if in_cdata and token["data"].find("</") >= 0:
+ self.serializeError("Unexpected </ in CDATA")
+ yield self.encode(token["data"])
+ else:
+ yield self.encode(escape(token["data"]))
+
+ elif type in ("StartTag", "EmptyTag"):
+ name = token["name"]
+ yield self.encodeStrict("<%s" % name)
+ if name in rcdataElements and not self.escape_rcdata:
+ in_cdata = True
+ elif in_cdata:
+ self.serializeError("Unexpected child element of a CDATA element")
+ for (_, attr_name), attr_value in token["data"].items():
+ # TODO: Add namespace support here
+ k = attr_name
+ v = attr_value
+ yield self.encodeStrict(' ')
+
+ yield self.encodeStrict(k)
+ if not self.minimize_boolean_attributes or \
+ (k not in booleanAttributes.get(name, tuple()) and
+ k not in booleanAttributes.get("", tuple())):
+ yield self.encodeStrict("=")
+ if self.quote_attr_values == "always" or len(v) == 0:
+ quote_attr = True
+ elif self.quote_attr_values == "spec":
+ quote_attr = _quoteAttributeSpec.search(v) is not None
+ elif self.quote_attr_values == "legacy":
+ quote_attr = _quoteAttributeLegacy.search(v) is not None
+ else:
+ raise ValueError("quote_attr_values must be one of: "
+ "'always', 'spec', or 'legacy'")
+ v = v.replace("&", "&amp;")
+ if self.escape_lt_in_attrs:
+ v = v.replace("<", "&lt;")
+ if quote_attr:
+ quote_char = self.quote_char
+ if self.use_best_quote_char:
+ if "'" in v and '"' not in v:
+ quote_char = '"'
+ elif '"' in v and "'" not in v:
+ quote_char = "'"
+ if quote_char == "'":
+ v = v.replace("'", "&#39;")
+ else:
+ v = v.replace('"', "&quot;")
+ yield self.encodeStrict(quote_char)
+ yield self.encode(v)
+ yield self.encodeStrict(quote_char)
+ else:
+ yield self.encode(v)
+ if name in voidElements and self.use_trailing_solidus:
+ if self.space_before_trailing_solidus:
+ yield self.encodeStrict(" /")
+ else:
+ yield self.encodeStrict("/")
+ yield self.encode(">")
+
+ elif type == "EndTag":
+ name = token["name"]
+ if name in rcdataElements:
+ in_cdata = False
+ elif in_cdata:
+ self.serializeError("Unexpected child element of a CDATA element")
+ yield self.encodeStrict("</%s>" % name)
+
+ elif type == "Comment":
+ data = token["data"]
+ if data.find("--") >= 0:
+ self.serializeError("Comment contains --")
+ yield self.encodeStrict("<!--%s-->" % token["data"])
+
+ elif type == "Entity":
+ name = token["name"]
+ key = name + ";"
+ if key not in entities:
+ self.serializeError("Entity %s not recognized" % name)
+ if self.resolve_entities and key not in xmlEntities:
+ data = entities[key]
+ else:
+ data = "&%s;" % name
+ yield self.encodeStrict(data)
+
+ else:
+ self.serializeError(token["data"])
+
+ def render(self, treewalker, encoding=None):
+ """Serializes the stream from the treewalker into a string
+
+ :arg treewalker: the treewalker to serialize
+
+ :arg encoding: the string encoding to use
+
+ :returns: the serialized tree
+
+ Example:
+
+ >>> from html5lib import parse, getTreeWalker
+ >>> from html5lib.serializer import HTMLSerializer
+ >>> token_stream = parse('<html><body>Hi!</body></html>')
+ >>> walker = getTreeWalker('etree')
+ >>> serializer = HTMLSerializer(omit_optional_tags=False)
+ >>> serializer.render(walker(token_stream))
+ '<html><head></head><body>Hi!</body></html>'
+
+ """
+ if encoding:
+ return b"".join(list(self.serialize(treewalker, encoding)))
+ else:
+ return "".join(list(self.serialize(treewalker)))
+
+ def serializeError(self, data="XXX ERROR MESSAGE NEEDED"):
+ # XXX The idea is to make data mandatory.
+ self.errors.append(data)
+ if self.strict:
+ raise SerializeError
+
+
+class SerializeError(Exception):
+ """Error in serialized tree"""
+ pass
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/__init__.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/__init__.py
new file mode 100644
index 0000000000..b8ce2de32e
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/__init__.py
@@ -0,0 +1 @@
+from __future__ import absolute_import, division, unicode_literals
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/conftest.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/conftest.py
new file mode 100644
index 0000000000..dad167c583
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/conftest.py
@@ -0,0 +1,108 @@
+from __future__ import print_function
+import os.path
+import sys
+
+import pkg_resources
+import pytest
+
+from .tree_construction import TreeConstructionFile
+from .tokenizer import TokenizerFile
+from .sanitizer import SanitizerFile
+
+_dir = os.path.abspath(os.path.dirname(__file__))
+_root = os.path.join(_dir, "..", "..")
+_testdata = os.path.join(_dir, "testdata")
+_tree_construction = os.path.join(_testdata, "tree-construction")
+_tokenizer = os.path.join(_testdata, "tokenizer")
+_sanitizer_testdata = os.path.join(_dir, "sanitizer-testdata")
+
+
+def fail_if_missing_pytest_expect():
+ """Throws an exception halting pytest if pytest-expect isn't working"""
+ try:
+ from pytest_expect import expect # noqa
+ except ImportError:
+ header = '*' * 78
+ print(
+ '\n' +
+ header + '\n' +
+ 'ERROR: Either pytest-expect or its dependency u-msgpack-python is not\n' +
+ 'installed. Please install them both before running pytest.\n' +
+ header + '\n',
+ file=sys.stderr
+ )
+ raise
+
+
+fail_if_missing_pytest_expect()
+
+
+def pytest_configure(config):
+ msgs = []
+
+ if not os.path.exists(_testdata):
+ msg = "testdata not available! "
+ if os.path.exists(os.path.join(_root, ".git")):
+ msg += ("Please run git submodule update --init --recursive " +
+ "and then run tests again.")
+ else:
+ msg += ("The testdata doesn't appear to be included with this package, " +
+ "so finding the right version will be hard. :(")
+ msgs.append(msg)
+
+ if config.option.update_xfail:
+ # Check for optional requirements
+ req_file = os.path.join(_root, "requirements-optional.txt")
+ if os.path.exists(req_file):
+ with open(req_file, "r") as fp:
+ for line in fp:
+ if (line.strip() and
+ not (line.startswith("-r") or
+ line.startswith("#"))):
+ if ";" in line:
+ spec, marker = line.strip().split(";", 1)
+ else:
+ spec, marker = line.strip(), None
+ req = pkg_resources.Requirement.parse(spec)
+ if marker and not pkg_resources.evaluate_marker(marker):
+ msgs.append("%s not available in this environment" % spec)
+ else:
+ try:
+ installed = pkg_resources.working_set.find(req)
+ except pkg_resources.VersionConflict:
+ msgs.append("Outdated version of %s installed, need %s" % (req.name, spec))
+ else:
+ if not installed:
+ msgs.append("Need %s" % spec)
+
+ # Check cElementTree
+ import xml.etree.ElementTree as ElementTree
+
+ try:
+ import xml.etree.cElementTree as cElementTree
+ except ImportError:
+ msgs.append("cElementTree unable to be imported")
+ else:
+ if cElementTree.Element is ElementTree.Element:
+ msgs.append("cElementTree is just an alias for ElementTree")
+
+ if msgs:
+ pytest.exit("\n".join(msgs))
+
+
+def pytest_collect_file(path, parent):
+ dir = os.path.abspath(path.dirname)
+ dir_and_parents = set()
+ while dir not in dir_and_parents:
+ dir_and_parents.add(dir)
+ dir = os.path.dirname(dir)
+
+ if _tree_construction in dir_and_parents:
+ if path.ext == ".dat":
+ return TreeConstructionFile(path, parent)
+ elif _tokenizer in dir_and_parents:
+ if path.ext == ".test":
+ return TokenizerFile(path, parent)
+ elif _sanitizer_testdata in dir_and_parents:
+ if path.ext == ".dat":
+ return SanitizerFile(path, parent)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/sanitizer-testdata/tests1.dat b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/sanitizer-testdata/tests1.dat
new file mode 100644
index 0000000000..74e8833686
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/sanitizer-testdata/tests1.dat
@@ -0,0 +1,433 @@
+[
+ {
+ "name": "IE_Comments",
+ "input": "<!--[if gte IE 4]><script>alert('XSS');</script><![endif]-->",
+ "output": ""
+ },
+
+ {
+ "name": "IE_Comments_2",
+ "input": "<![if !IE 5]><script>alert('XSS');</script><![endif]>",
+ "output": "&lt;script&gt;alert('XSS');&lt;/script&gt;"
+ },
+
+ {
+ "name": "allow_colons_in_path_component",
+ "input": "<a href=\"./this:that\">foo</a>",
+ "output": "<a href='./this:that'>foo</a>"
+ },
+
+ {
+ "name": "background_attribute",
+ "input": "<div background=\"javascript:alert('XSS')\"></div>",
+ "output": "<div></div>"
+ },
+
+ {
+ "name": "bgsound",
+ "input": "<bgsound src=\"javascript:alert('XSS');\" />",
+ "output": "&lt;bgsound src=\"javascript:alert('XSS');\"&gt;&lt;/bgsound&gt;"
+ },
+
+ {
+ "name": "div_background_image_unicode_encoded",
+ "input": "<div style=\"background-image:\u00a5\u00a2\u006C\u0028'\u006a\u0061\u00a6\u0061\u00a3\u0063\u00a2\u0069\u00a0\u00a4\u003a\u0061\u006c\u0065\u00a2\u00a4\u0028.1027\u0058.1053\u0053\u0027\u0029'\u0029\">foo</div>",
+ "output": "<div style=''>foo</div>"
+ },
+
+ {
+ "name": "div_expression",
+ "input": "<div style=\"width: expression(alert('XSS'));\">foo</div>",
+ "output": "<div style=''>foo</div>"
+ },
+
+ {
+ "name": "double_open_angle_brackets",
+ "input": "<img src=http://ha.ckers.org/scriptlet.html <",
+ "output": ""
+ },
+
+ {
+ "name": "double_open_angle_brackets_2",
+ "input": "<script src=http://ha.ckers.org/scriptlet.html <",
+ "output": ""
+ },
+
+ {
+ "name": "grave_accents",
+ "input": "<img src=`javascript:alert('XSS')` />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "img_dynsrc_lowsrc",
+ "input": "<img dynsrc=\"javascript:alert('XSS')\" />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "img_vbscript",
+ "input": "<img src='vbscript:msgbox(\"XSS\")' />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "input_image",
+ "input": "<input type=\"image\" src=\"javascript:alert('XSS');\" />",
+ "output": "<input type='image'/>"
+ },
+
+ {
+ "name": "link_stylesheets",
+ "input": "<link rel=\"stylesheet\" href=\"javascript:alert('XSS');\" />",
+ "output": "&lt;link href=\"javascript:alert('XSS');\" rel=\"stylesheet\"&gt;"
+ },
+
+ {
+ "name": "link_stylesheets_2",
+ "input": "<link rel=\"stylesheet\" href=\"http://ha.ckers.org/xss.css\" />",
+ "output": "&lt;link href=\"http://ha.ckers.org/xss.css\" rel=\"stylesheet\"&gt;"
+ },
+
+ {
+ "name": "list_style_image",
+ "input": "<li style=\"list-style-image: url(javascript:alert('XSS'))\">foo</li>",
+ "output": "<li style=''>foo</li>"
+ },
+
+ {
+ "name": "no_closing_script_tags",
+ "input": "<script src=http://ha.ckers.org/xss.js?<b>",
+ "output": "&lt;script src=\"http://ha.ckers.org/xss.js?&amp;lt;b\"&gt;&lt;/script&gt;"
+ },
+
+ {
+ "name": "non_alpha_non_digit",
+ "input": "<script/XSS src=\"http://ha.ckers.org/xss.js\"></script>",
+ "output": "&lt;script src=\"http://ha.ckers.org/xss.js\" xss=\"\"&gt;&lt;/script&gt;"
+ },
+
+ {
+ "name": "non_alpha_non_digit_2",
+ "input": "<a onclick!\\#$%&()*~+-_.,:;?@[/|\\]^`=alert(\"XSS\")>foo</a>",
+ "output": "<a>foo</a>"
+ },
+
+ {
+ "name": "non_alpha_non_digit_3",
+ "input": "<img/src=\"http://ha.ckers.org/xss.js\"/>",
+ "output": "<img src='http://ha.ckers.org/xss.js'/>"
+ },
+
+ {
+ "name": "non_alpha_non_digit_II",
+ "input": "<a href!\\#$%&()*~+-_.,:;?@[/|]^`=alert('XSS')>foo</a>",
+ "output": "<a>foo</a>"
+ },
+
+ {
+ "name": "non_alpha_non_digit_III",
+ "input": "<a/href=\"javascript:alert('XSS');\">foo</a>",
+ "output": "<a>foo</a>"
+ },
+
+ {
+ "name": "platypus",
+ "input": "<a href=\"http://www.ragingplatypus.com/\" style=\"display:block; position:absolute; left:0; top:0; width:100%; height:100%; z-index:1; background-color:black; background-image:url(http://www.ragingplatypus.com/i/cam-full.jpg); background-x:center; background-y:center; background-repeat:repeat;\">never trust your upstream platypus</a>",
+ "output": "<a href='http://www.ragingplatypus.com/' style='display: block; width: 100%; height: 100%; background-color: black; background-x: center; background-y: center;'>never trust your upstream platypus</a>"
+ },
+
+ {
+ "name": "protocol_resolution_in_script_tag",
+ "input": "<script src=//ha.ckers.org/.j></script>",
+ "output": "&lt;script src=\"//ha.ckers.org/.j\"&gt;&lt;/script&gt;"
+ },
+
+ {
+ "name": "should_allow_anchors",
+ "input": "<a href='foo' onclick='bar'><script>baz</script></a>",
+ "output": "<a href='foo'>&lt;script&gt;baz&lt;/script&gt;</a>"
+ },
+
+ {
+ "name": "should_allow_image_alt_attribute",
+ "input": "<img alt='foo' onclick='bar' />",
+ "output": "<img alt='foo'/>"
+ },
+
+ {
+ "name": "should_allow_image_height_attribute",
+ "input": "<img height='foo' onclick='bar' />",
+ "output": "<img height='foo'/>"
+ },
+
+ {
+ "name": "should_allow_image_src_attribute",
+ "input": "<img src='foo' onclick='bar' />",
+ "output": "<img src='foo'/>"
+ },
+
+ {
+ "name": "should_allow_image_width_attribute",
+ "input": "<img width='foo' onclick='bar' />",
+ "output": "<img width='foo'/>"
+ },
+
+ {
+ "name": "should_handle_blank_text",
+ "input": "",
+ "output": ""
+ },
+
+ {
+ "name": "should_handle_malformed_image_tags",
+ "input": "<img \"\"\"><script>alert(\"XSS\")</script>\">",
+ "output": "<img/>&lt;script&gt;alert(\"XSS\")&lt;/script&gt;\"&gt;"
+ },
+
+ {
+ "name": "should_handle_non_html",
+ "input": "abc",
+ "output": "abc"
+ },
+
+ {
+ "name": "should_not_fall_for_ridiculous_hack",
+ "input": "<img\nsrc\n=\n\"\nj\na\nv\na\ns\nc\nr\ni\np\nt\n:\na\nl\ne\nr\nt\n(\n'\nX\nS\nS\n'\n)\n\"\n />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_not_fall_for_xss_image_hack_0",
+ "input": "<img src=\"javascript:alert('XSS');\" />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_not_fall_for_xss_image_hack_1",
+ "input": "<img src=javascript:alert('XSS') />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_not_fall_for_xss_image_hack_10",
+ "input": "<img src=\"jav&#x0A;ascript:alert('XSS');\" />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_not_fall_for_xss_image_hack_11",
+ "input": "<img src=\"jav&#x0D;ascript:alert('XSS');\" />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_not_fall_for_xss_image_hack_12",
+ "input": "<img src=\" &#14; javascript:alert('XSS');\" />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_not_fall_for_xss_image_hack_13",
+ "input": "<img src=\"&#x20;javascript:alert('XSS');\" />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_not_fall_for_xss_image_hack_14",
+ "input": "<img src=\"&#xA0;javascript:alert('XSS');\" />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_not_fall_for_xss_image_hack_2",
+ "input": "<img src=\"JaVaScRiPt:alert('XSS')\" />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_not_fall_for_xss_image_hack_3",
+ "input": "<img src='javascript:alert(&quot;XSS&quot;)' />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_not_fall_for_xss_image_hack_4",
+ "input": "<img src='javascript:alert(String.fromCharCode(88,83,83))' />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_not_fall_for_xss_image_hack_5",
+ "input": "<img src='&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58;&#97;&#108;&#101;&#114;&#116;&#40;&#39;&#88;&#83;&#83;&#39;&#41;' />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_not_fall_for_xss_image_hack_6",
+ "input": "<img src='&#0000106;&#0000097;&#0000118;&#0000097;&#0000115;&#0000099;&#0000114;&#0000105;&#0000112;&#0000116;&#0000058;&#0000097;&#0000108;&#0000101;&#0000114;&#0000116;&#0000040;&#0000039;&#0000088;&#0000083;&#0000083;&#0000039;&#0000041' />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_not_fall_for_xss_image_hack_7",
+ "input": "<img src='&#x6A;&#x61;&#x76;&#x61;&#x73;&#x63;&#x72;&#x69;&#x70;&#x74;&#x3A;&#x61;&#x6C;&#x65;&#x72;&#x74;&#x28;&#x27;&#x58;&#x53;&#x53;&#x27;&#x29' />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_not_fall_for_xss_image_hack_8",
+ "input": "<img src=\"jav\tascript:alert('XSS');\" />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_not_fall_for_xss_image_hack_9",
+ "input": "<img src=\"jav&#x09;ascript:alert('XSS');\" />",
+ "output": "<img/>"
+ },
+
+ {
+ "name": "should_sanitize_half_open_scripts",
+ "input": "<img src=\"javascript:alert('XSS')\"",
+ "output": ""
+ },
+
+ {
+ "name": "should_sanitize_invalid_script_tag",
+ "input": "<script/XSS SRC=\"http://ha.ckers.org/xss.js\"></script>",
+ "output": "&lt;script src=\"http://ha.ckers.org/xss.js\" xss=\"\"&gt;&lt;/script&gt;"
+ },
+
+ {
+ "name": "should_sanitize_script_tag_with_multiple_open_brackets",
+ "input": "<<script>alert(\"XSS\");//<</script>",
+ "output": "&lt;&lt;script&gt;alert(\"XSS\");//&lt;&lt;/script&gt;"
+ },
+
+ {
+ "name": "should_sanitize_script_tag_with_multiple_open_brackets_2",
+ "input": "<iframe src=http://ha.ckers.org/scriptlet.html\n<",
+ "output": ""
+ },
+
+ {
+ "name": "should_sanitize_tag_broken_up_by_null",
+ "input": "<scr\u0000ipt>alert(\"XSS\")</scr\u0000ipt>",
+ "output": "&lt;scr\ufffdipt&gt;alert(\"XSS\")&lt;/scr\ufffdipt&gt;"
+ },
+
+ {
+ "name": "should_sanitize_unclosed_script",
+ "input": "<script src=http://ha.ckers.org/xss.js?<b>",
+ "output": "&lt;script src=\"http://ha.ckers.org/xss.js?&amp;lt;b\"&gt;&lt;/script&gt;"
+ },
+
+ {
+ "name": "should_strip_href_attribute_in_a_with_bad_protocols",
+ "input": "<a href=\"javascript:XSS\" title=\"1\">boo</a>",
+ "output": "<a title='1'>boo</a>"
+ },
+
+ {
+ "name": "should_strip_href_attribute_in_a_with_bad_protocols_and_whitespace",
+ "input": "<a href=\" javascript:XSS\" title=\"1\">boo</a>",
+ "output": "<a title='1'>boo</a>"
+ },
+
+ {
+ "name": "should_strip_src_attribute_in_img_with_bad_protocols",
+ "input": "<img src=\"javascript:XSS\" title=\"1\">boo</img>",
+ "output": "<img title='1'/>boo"
+ },
+
+ {
+ "name": "should_strip_src_attribute_in_img_with_bad_protocols_and_whitespace",
+ "input": "<img src=\" javascript:XSS\" title=\"1\">boo</img>",
+ "output": "<img title='1'/>boo"
+ },
+
+ {
+ "name": "xml_base",
+ "input": "<div xml:base=\"javascript:alert('XSS');//\">foo</div>",
+ "output": "<div>foo</div>"
+ },
+
+ {
+ "name": "xul",
+ "input": "<p style=\"-moz-binding:url('http://ha.ckers.org/xssmoz.xml#xss')\">fubar</p>",
+ "output": "<p style=''>fubar</p>"
+ },
+
+ {
+ "name": "quotes_in_attributes",
+ "input": "<img src='foo' title='\"foo\" bar' />",
+ "output": "<img src='foo' title='\"foo\" bar'/>"
+ },
+
+ {
+ "name": "uri_refs_in_svg_attributes",
+ "input": "<svg><rect fill='url(#foo)' />",
+ "output": "<svg><rect fill='url(#foo)'></rect></svg>"
+ },
+
+ {
+ "name": "absolute_uri_refs_in_svg_attributes",
+ "input": "<svg><rect fill='url(http://bad.com/) #fff' />",
+ "output": "<svg><rect fill=' #fff'></rect></svg>"
+ },
+
+ {
+ "name": "uri_ref_with_space_in svg_attribute",
+ "input": "<svg><rect fill='url(\n#foo)' />",
+ "output": "<svg><rect fill='url(\n#foo)'></rect></svg>"
+ },
+
+ {
+ "name": "absolute_uri_ref_with_space_in svg_attribute",
+ "input": "<svg><rect fill=\"url(\nhttp://bad.com/)\" />",
+ "output": "<svg><rect fill=' '></rect></svg>"
+ },
+
+ {
+ "name": "allow_html5_image_tag",
+ "input": "<image src='foo' />",
+ "output": "<img src='foo'/>"
+ },
+
+ {
+ "name": "style_attr_end_with_nothing",
+ "input": "<div style=\"color: blue\" />",
+ "output": "<div style='color: blue;'></div>"
+ },
+
+ {
+ "name": "style_attr_end_with_space",
+ "input": "<div style=\"color: blue \" />",
+ "output": "<div style='color: blue ;'></div>"
+ },
+
+ {
+ "name": "style_attr_end_with_semicolon",
+ "input": "<div style=\"color: blue;\" />",
+ "output": "<div style='color: blue;'></div>"
+ },
+
+ {
+ "name": "style_attr_end_with_semicolon_space",
+ "input": "<div style=\"color: blue; \" />",
+ "output": "<div style='color: blue;'></div>"
+ },
+
+ {
+ "name": "attributes_with_embedded_quotes",
+ "input": "<img src=doesntexist.jpg\"'onerror=\"alert(1) />",
+ "output": "<img src='doesntexist.jpg\"&#39;onerror=\"alert(1)'/>"
+ },
+
+ {
+ "name": "attributes_with_embedded_quotes_II",
+ "input": "<img src=notthere.jpg\"\"onerror=\"alert(2) />",
+ "output": "<img src='notthere.jpg\"\"onerror=\"alert(2)'/>"
+ }
+]
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/sanitizer.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/sanitizer.py
new file mode 100644
index 0000000000..bb4834214f
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/sanitizer.py
@@ -0,0 +1,51 @@
+from __future__ import absolute_import, division, unicode_literals
+
+import codecs
+import json
+
+import pytest
+
+from html5lib import parseFragment, serialize
+
+
+class SanitizerFile(pytest.File):
+ def collect(self):
+ with codecs.open(str(self.fspath), "r", encoding="utf-8") as fp:
+ tests = json.load(fp)
+ for i, test in enumerate(tests):
+ yield SanitizerTest(str(i), self, test=test)
+
+
+class SanitizerTest(pytest.Item):
+ def __init__(self, name, parent, test):
+ super(SanitizerTest, self).__init__(name, parent)
+ self.obj = lambda: 1 # this is to hack around skipif needing a function!
+ self.test = test
+
+ def runtest(self):
+ input = self.test["input"]
+ expected = self.test["output"]
+
+ parsed = parseFragment(input)
+ with pytest.deprecated_call():
+ serialized = serialize(parsed,
+ sanitize=True,
+ omit_optional_tags=False,
+ use_trailing_solidus=True,
+ space_before_trailing_solidus=False,
+ quote_attr_values="always",
+ quote_char="'",
+ alphabetical_attributes=True)
+ errorMsg = "\n".join(["\n\nInput:", input,
+ "\nExpected:", expected,
+ "\nReceived:", serialized])
+ assert expected == serialized, errorMsg
+
+ def repr_failure(self, excinfo):
+ traceback = excinfo.traceback
+ ntraceback = traceback.cut(path=__file__)
+ excinfo.traceback = ntraceback.filter()
+
+ return excinfo.getrepr(funcargs=True,
+ showlocals=False,
+ style="short", tbfilter=False)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/core.test b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/core.test
new file mode 100644
index 0000000000..55294b6831
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/core.test
@@ -0,0 +1,395 @@
+{
+ "tests": [
+ {
+ "expected": [
+ "<span title='test \"with\" &amp;quot;'>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "test \"with\" &quot;"
+ }
+ ]
+ ]
+ ],
+ "description": "proper attribute value escaping"
+ },
+ {
+ "expected": [
+ "<span title=foo>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "foo"
+ }
+ ]
+ ]
+ ],
+ "description": "proper attribute value non-quoting"
+ },
+ {
+ "expected": [
+ "<span title=\"foo<bar\">"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "foo<bar"
+ }
+ ]
+ ]
+ ],
+ "description": "proper attribute value non-quoting (with <)"
+ },
+ {
+ "expected": [
+ "<span title=\"foo=bar\">"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "foo=bar"
+ }
+ ]
+ ]
+ ],
+ "description": "proper attribute value quoting (with =)"
+ },
+ {
+ "expected": [
+ "<span title=\"foo>bar\">"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "foo>bar"
+ }
+ ]
+ ]
+ ],
+ "description": "proper attribute value quoting (with >)"
+ },
+ {
+ "expected": [
+ "<span title='foo\"bar'>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "foo\"bar"
+ }
+ ]
+ ]
+ ],
+ "description": "proper attribute value quoting (with \")"
+ },
+ {
+ "expected": [
+ "<span title=\"foo'bar\">"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "foo'bar"
+ }
+ ]
+ ]
+ ],
+ "description": "proper attribute value quoting (with ')"
+ },
+ {
+ "expected": [
+ "<span title=\"foo'bar&quot;baz\">"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "foo'bar\"baz"
+ }
+ ]
+ ]
+ ],
+ "description": "proper attribute value quoting (with both \" and ')"
+ },
+ {
+ "expected": [
+ "<span title=\"foo bar\">"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "foo bar"
+ }
+ ]
+ ]
+ ],
+ "description": "proper attribute value quoting (with space)"
+ },
+ {
+ "expected": [
+ "<span title=\"foo\tbar\">"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "foo\tbar"
+ }
+ ]
+ ]
+ ],
+ "description": "proper attribute value quoting (with tab)"
+ },
+ {
+ "expected": [
+ "<span title=\"foo\nbar\">"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "foo\nbar"
+ }
+ ]
+ ]
+ ],
+ "description": "proper attribute value quoting (with LF)"
+ },
+ {
+ "expected": [
+ "<span title=\"foo\rbar\">"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "foo\rbar"
+ }
+ ]
+ ]
+ ],
+ "description": "proper attribute value quoting (with CR)"
+ },
+ {
+ "expected": [
+ "<span title=\"foo\u000bbar\">"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "foo\u000bbar"
+ }
+ ]
+ ]
+ ],
+ "description": "proper attribute value non-quoting (with linetab)"
+ },
+ {
+ "expected": [
+ "<span title=\"foo\fbar\">"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "foo\fbar"
+ }
+ ]
+ ]
+ ],
+ "description": "proper attribute value quoting (with form feed)"
+ },
+ {
+ "expected": [
+ "<img>"
+ ],
+ "input": [
+ [
+ "EmptyTag",
+ "img",
+ {}
+ ]
+ ],
+ "description": "void element (as EmptyTag token)"
+ },
+ {
+ "expected": [
+ "<!DOCTYPE foo>"
+ ],
+ "input": [
+ [
+ "Doctype",
+ "foo"
+ ]
+ ],
+ "description": "doctype in error"
+ },
+ {
+ "expected": [
+ "a&lt;b&gt;c&amp;d"
+ ],
+ "input": [
+ [
+ "Characters",
+ "a<b>c&d"
+ ]
+ ],
+ "description": "character data",
+ "options": {
+ "encoding": "utf-8"
+ }
+ },
+ {
+ "expected": [
+ "<script>a<b>c&d"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "script",
+ {}
+ ],
+ [
+ "Characters",
+ "a<b>c&d"
+ ]
+ ],
+ "description": "rcdata"
+ },
+ {
+ "expected": [
+ "<!DOCTYPE HTML>"
+ ],
+ "input": [
+ [
+ "Doctype",
+ "HTML"
+ ]
+ ],
+ "description": "doctype"
+ },
+ {
+ "expected": [
+ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">"
+ ],
+ "input": [
+ [
+ "Doctype",
+ "HTML",
+ "-//W3C//DTD HTML 4.01//EN",
+ "http://www.w3.org/TR/html4/strict.dtd"
+ ]
+ ],
+ "description": "HTML 4.01 DOCTYPE"
+ },
+ {
+ "expected": [
+ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">"
+ ],
+ "input": [
+ [
+ "Doctype",
+ "HTML",
+ "-//W3C//DTD HTML 4.01//EN"
+ ]
+ ],
+ "description": "HTML 4.01 DOCTYPE without system identifier"
+ },
+ {
+ "expected": [
+ "<!DOCTYPE html SYSTEM \"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd\">"
+ ],
+ "input": [
+ [
+ "Doctype",
+ "html",
+ "",
+ "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"
+ ]
+ ],
+ "description": "IBM DOCTYPE without public identifier"
+ }
+ ]
+}
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/injectmeta.test b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/injectmeta.test
new file mode 100644
index 0000000000..399590c3f3
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/injectmeta.test
@@ -0,0 +1,350 @@
+{
+ "tests": [
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ]
+ ],
+ "description": "no encoding",
+ "options": {
+ "inject_meta_charset": true
+ }
+ },
+ {
+ "expected": [
+ "<meta charset=utf-8>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ]
+ ],
+ "description": "empytag head",
+ "options": {
+ "encoding": "utf-8",
+ "inject_meta_charset": true
+ }
+ },
+ {
+ "expected": [
+ "<meta charset=utf-8><title>foo</title>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "title",
+ {}
+ ],
+ [
+ "Characters",
+ "foo"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "title"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ]
+ ],
+ "description": "head w/title",
+ "options": {
+ "encoding": "utf-8",
+ "inject_meta_charset": true
+ }
+ },
+ {
+ "expected": [
+ "<meta charset=utf-8>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "EmptyTag",
+ "meta",
+ [
+ {
+ "namespace": null,
+ "name": "charset",
+ "value": "ascii"
+ }
+ ]
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ]
+ ],
+ "description": "head w/meta-charset",
+ "options": {
+ "encoding": "utf-8",
+ "inject_meta_charset": true
+ }
+ },
+ {
+ "expected": [
+ "<meta charset=utf-8><meta charset=utf-8>",
+ "<head><meta charset=utf-8><meta charset=ascii>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "EmptyTag",
+ "meta",
+ [
+ {
+ "namespace": null,
+ "name": "charset",
+ "value": "ascii"
+ }
+ ]
+ ],
+ [
+ "EmptyTag",
+ "meta",
+ [
+ {
+ "namespace": null,
+ "name": "charset",
+ "value": "ascii"
+ }
+ ]
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ]
+ ],
+ "description": "head w/ two meta-charset",
+ "options": {
+ "encoding": "utf-8",
+ "inject_meta_charset": true
+ }
+ },
+ {
+ "expected": [
+ "<meta charset=utf-8><meta content=noindex name=robots>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "EmptyTag",
+ "meta",
+ [
+ {
+ "namespace": null,
+ "name": "name",
+ "value": "robots"
+ },
+ {
+ "namespace": null,
+ "name": "content",
+ "value": "noindex"
+ }
+ ]
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ]
+ ],
+ "description": "head w/robots",
+ "options": {
+ "encoding": "utf-8",
+ "inject_meta_charset": true
+ }
+ },
+ {
+ "expected": [
+ "<meta content=noindex name=robots><meta charset=utf-8>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "EmptyTag",
+ "meta",
+ [
+ {
+ "namespace": null,
+ "name": "name",
+ "value": "robots"
+ },
+ {
+ "namespace": null,
+ "name": "content",
+ "value": "noindex"
+ }
+ ]
+ ],
+ [
+ "EmptyTag",
+ "meta",
+ [
+ {
+ "namespace": null,
+ "name": "charset",
+ "value": "ascii"
+ }
+ ]
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ]
+ ],
+ "description": "head w/robots & charset",
+ "options": {
+ "encoding": "utf-8",
+ "inject_meta_charset": true
+ }
+ },
+ {
+ "expected": [
+ "<meta content=\"text/html; charset=utf-8\" http-equiv=content-type>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "EmptyTag",
+ "meta",
+ [
+ {
+ "namespace": null,
+ "name": "http-equiv",
+ "value": "content-type"
+ },
+ {
+ "namespace": null,
+ "name": "content",
+ "value": "text/html; charset=ascii"
+ }
+ ]
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ]
+ ],
+ "description": "head w/ charset in http-equiv content-type",
+ "options": {
+ "encoding": "utf-8",
+ "inject_meta_charset": true
+ }
+ },
+ {
+ "expected": [
+ "<meta content=noindex name=robots><meta content=\"text/html; charset=utf-8\" http-equiv=content-type>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "EmptyTag",
+ "meta",
+ [
+ {
+ "namespace": null,
+ "name": "name",
+ "value": "robots"
+ },
+ {
+ "namespace": null,
+ "name": "content",
+ "value": "noindex"
+ }
+ ]
+ ],
+ [
+ "EmptyTag",
+ "meta",
+ [
+ {
+ "namespace": null,
+ "name": "http-equiv",
+ "value": "content-type"
+ },
+ {
+ "namespace": null,
+ "name": "content",
+ "value": "text/html; charset=ascii"
+ }
+ ]
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ]
+ ],
+ "description": "head w/robots & charset in http-equiv content-type",
+ "options": {
+ "encoding": "utf-8",
+ "inject_meta_charset": true
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/optionaltags.test b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/optionaltags.test
new file mode 100644
index 0000000000..e67725ca26
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/optionaltags.test
@@ -0,0 +1,3254 @@
+{
+ "tests": [
+ {
+ "expected": [
+ "<html lang=en>foo"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "html",
+ [
+ {
+ "namespace": null,
+ "name": "lang",
+ "value": "en"
+ }
+ ]
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "html start-tag followed by text, with attributes"
+ },
+ {
+ "expected": [
+ "<html><!--foo-->"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "html",
+ {}
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "html start-tag followed by comment"
+ },
+ {
+ "expected": [
+ "<html> foo"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "html",
+ {}
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "html start-tag followed by space character"
+ },
+ {
+ "expected": [
+ "foo"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "html",
+ {}
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "html start-tag followed by text"
+ },
+ {
+ "expected": [
+ "<foo>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "html",
+ {}
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "html start-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "html",
+ {}
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "html start-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "html",
+ {}
+ ]
+ ],
+ "description": "html start-tag at EOF (shouldn't ever happen?!)"
+ },
+ {
+ "expected": [
+ "</html><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "html"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "html end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</html> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "html"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "html end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "html"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "html end-tag followed by text"
+ },
+ {
+ "expected": [
+ "<foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "html"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "html end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "html"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "html end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "html"
+ ]
+ ],
+ "description": "html end-tag at EOF"
+ },
+ {
+ "expected": [
+ "<head><!--foo-->"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "head start-tag followed by comment"
+ },
+ {
+ "expected": [
+ "<head> foo"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "head start-tag followed by space character"
+ },
+ {
+ "expected": [
+ "<head>foo"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "head start-tag followed by text"
+ },
+ {
+ "expected": [
+ "<foo>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "head start-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "<head></foo>",
+ "</foo>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "head start-tag followed by end-tag (shouldn't ever happen?!)"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ]
+ ],
+ "description": "empty head element"
+ },
+ {
+ "expected": [
+ "<meta>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ],
+ [
+ "EmptyTag",
+ "meta",
+ {}
+ ]
+ ],
+ "description": "head start-tag followed by empty-tag"
+ },
+ {
+ "expected": [
+ "<head>",
+ ""
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "head",
+ {}
+ ]
+ ],
+ "description": "head start-tag at EOF (shouldn't ever happen?!)"
+ },
+ {
+ "expected": [
+ "</head><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "head end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</head> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "head end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "head end-tag followed by text"
+ },
+ {
+ "expected": [
+ "<foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "head end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "head end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "head"
+ ]
+ ],
+ "description": "head end-tag at EOF"
+ },
+ {
+ "expected": [
+ "<body><!--foo-->"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "body",
+ {}
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "body start-tag followed by comment"
+ },
+ {
+ "expected": [
+ "<body> foo"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "body",
+ {}
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "body start-tag followed by space character"
+ },
+ {
+ "expected": [
+ "foo"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "body",
+ {}
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "body start-tag followed by text"
+ },
+ {
+ "expected": [
+ "<foo>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "body",
+ {}
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "body start-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "body",
+ {}
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "body start-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "body",
+ {}
+ ]
+ ],
+ "description": "body start-tag at EOF (shouldn't ever happen?!)"
+ },
+ {
+ "expected": [
+ "</body><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "body"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "body end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</body> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "body"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "body end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "body"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "body end-tag followed by text"
+ },
+ {
+ "expected": [
+ "<foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "body"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "body end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "body"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "body end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "body"
+ ]
+ ],
+ "description": "body end-tag at EOF"
+ },
+ {
+ "expected": [
+ "</li><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "li"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "li end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</li> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "li"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "li end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "</li>foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "li"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "li end-tag followed by text"
+ },
+ {
+ "expected": [
+ "</li><foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "li"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "li end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "<li>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "li"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "li",
+ {}
+ ]
+ ],
+ "description": "li end-tag followed by li start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "li"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "li end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "li"
+ ]
+ ],
+ "description": "li end-tag at EOF"
+ },
+ {
+ "expected": [
+ "</dt><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dt"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "dt end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</dt> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dt"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "dt end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "</dt>foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dt"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "dt end-tag followed by text"
+ },
+ {
+ "expected": [
+ "</dt><foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dt"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "dt end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "<dt>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dt"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "dt",
+ {}
+ ]
+ ],
+ "description": "dt end-tag followed by dt start-tag"
+ },
+ {
+ "expected": [
+ "<dd>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dt"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "dd",
+ {}
+ ]
+ ],
+ "description": "dt end-tag followed by dd start-tag"
+ },
+ {
+ "expected": [
+ "</dt></foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dt"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "dt end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ "</dt>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dt"
+ ]
+ ],
+ "description": "dt end-tag at EOF"
+ },
+ {
+ "expected": [
+ "</dd><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dd"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "dd end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</dd> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dd"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "dd end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "</dd>foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dd"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "dd end-tag followed by text"
+ },
+ {
+ "expected": [
+ "</dd><foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dd"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "dd end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "<dd>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dd"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "dd",
+ {}
+ ]
+ ],
+ "description": "dd end-tag followed by dd start-tag"
+ },
+ {
+ "expected": [
+ "<dt>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dd"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "dt",
+ {}
+ ]
+ ],
+ "description": "dd end-tag followed by dt start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dd"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "dd end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "dd"
+ ]
+ ],
+ "description": "dd end-tag at EOF"
+ },
+ {
+ "expected": [
+ "</p><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "p end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</p> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "p end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "</p>foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "p end-tag followed by text"
+ },
+ {
+ "expected": [
+ "</p><foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "<address>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "address",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by address start-tag"
+ },
+ {
+ "expected": [
+ "<article>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "article",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by article start-tag"
+ },
+ {
+ "expected": [
+ "<aside>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "aside",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by aside start-tag"
+ },
+ {
+ "expected": [
+ "<blockquote>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "blockquote",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by blockquote start-tag"
+ },
+ {
+ "expected": [
+ "<datagrid>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "datagrid",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by datagrid start-tag"
+ },
+ {
+ "expected": [
+ "<dialog>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "dialog",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by dialog start-tag"
+ },
+ {
+ "expected": [
+ "<dir>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "dir",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by dir start-tag"
+ },
+ {
+ "expected": [
+ "<div>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "div",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by div start-tag"
+ },
+ {
+ "expected": [
+ "<dl>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "dl",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by dl start-tag"
+ },
+ {
+ "expected": [
+ "<fieldset>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "fieldset",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by fieldset start-tag"
+ },
+ {
+ "expected": [
+ "<footer>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "footer",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by footer start-tag"
+ },
+ {
+ "expected": [
+ "<form>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "form",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by form start-tag"
+ },
+ {
+ "expected": [
+ "<h1>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "h1",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by h1 start-tag"
+ },
+ {
+ "expected": [
+ "<h2>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "h2",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by h2 start-tag"
+ },
+ {
+ "expected": [
+ "<h3>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "h3",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by h3 start-tag"
+ },
+ {
+ "expected": [
+ "<h4>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "h4",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by h4 start-tag"
+ },
+ {
+ "expected": [
+ "<h5>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "h5",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by h5 start-tag"
+ },
+ {
+ "expected": [
+ "<h6>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "h6",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by h6 start-tag"
+ },
+ {
+ "expected": [
+ "<header>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "header",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by header start-tag"
+ },
+ {
+ "expected": [
+ "<hr>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "EmptyTag",
+ "hr",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by hr empty-tag"
+ },
+ {
+ "expected": [
+ "<menu>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "menu",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by menu start-tag"
+ },
+ {
+ "expected": [
+ "<nav>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "nav",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by nav start-tag"
+ },
+ {
+ "expected": [
+ "<ol>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "ol",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by ol start-tag"
+ },
+ {
+ "expected": [
+ "<p>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "p",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by p start-tag"
+ },
+ {
+ "expected": [
+ "<pre>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "pre",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by pre start-tag"
+ },
+ {
+ "expected": [
+ "<section>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "section",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by section start-tag"
+ },
+ {
+ "expected": [
+ "<table>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "table",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by table start-tag"
+ },
+ {
+ "expected": [
+ "<ul>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "ul",
+ {}
+ ]
+ ],
+ "description": "p end-tag followed by ul start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "p end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "p"
+ ]
+ ],
+ "description": "p end-tag at EOF"
+ },
+ {
+ "expected": [
+ "</optgroup><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "optgroup"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "optgroup end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</optgroup> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "optgroup"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "optgroup end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "</optgroup>foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "optgroup"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "optgroup end-tag followed by text"
+ },
+ {
+ "expected": [
+ "</optgroup><foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "optgroup"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "optgroup end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "<optgroup>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "optgroup"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "optgroup",
+ {}
+ ]
+ ],
+ "description": "optgroup end-tag followed by optgroup start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "optgroup"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "optgroup end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "optgroup"
+ ]
+ ],
+ "description": "optgroup end-tag at EOF"
+ },
+ {
+ "expected": [
+ "</option><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "option"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "option end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</option> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "option"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "option end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "</option>foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "option"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "option end-tag followed by text"
+ },
+ {
+ "expected": [
+ "<optgroup>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "option"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "optgroup",
+ {}
+ ]
+ ],
+ "description": "option end-tag followed by optgroup start-tag"
+ },
+ {
+ "expected": [
+ "</option><foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "option"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "option end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "<option>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "option"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "option",
+ {}
+ ]
+ ],
+ "description": "option end-tag followed by option start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "option"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "option end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "option"
+ ]
+ ],
+ "description": "option end-tag at EOF"
+ },
+ {
+ "expected": [
+ "<colgroup><!--foo-->"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "colgroup",
+ {}
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "colgroup start-tag followed by comment"
+ },
+ {
+ "expected": [
+ "<colgroup> foo"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "colgroup",
+ {}
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "colgroup start-tag followed by space character"
+ },
+ {
+ "expected": [
+ "<colgroup>foo"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "colgroup",
+ {}
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "colgroup start-tag followed by text"
+ },
+ {
+ "expected": [
+ "<colgroup><foo>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "colgroup",
+ {}
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "colgroup start-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "<table><col>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "table",
+ {}
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "colgroup",
+ {}
+ ],
+ [
+ "EmptyTag",
+ "col",
+ {}
+ ]
+ ],
+ "description": "first colgroup in a table with a col child"
+ },
+ {
+ "expected": [
+ "</colgroup><col>",
+ "<colgroup><col>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "colgroup"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "colgroup",
+ {}
+ ],
+ [
+ "EmptyTag",
+ "http://www.w3.org/1999/xhtml",
+ "col",
+ {}
+ ]
+ ],
+ "description": "colgroup with a col child, following another colgroup"
+ },
+ {
+ "expected": [
+ "<colgroup></foo>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "colgroup",
+ {}
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "colgroup start-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ "<colgroup>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "colgroup",
+ {}
+ ]
+ ],
+ "description": "colgroup start-tag at EOF"
+ },
+ {
+ "expected": [
+ "</colgroup><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "colgroup"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "colgroup end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</colgroup> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "colgroup"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "colgroup end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "colgroup"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "colgroup end-tag followed by text"
+ },
+ {
+ "expected": [
+ "<foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "colgroup"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "colgroup end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "colgroup"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "colgroup end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "colgroup"
+ ]
+ ],
+ "description": "colgroup end-tag at EOF"
+ },
+ {
+ "expected": [
+ "</thead><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "thead"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "thead end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</thead> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "thead"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "thead end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "</thead>foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "thead"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "thead end-tag followed by text"
+ },
+ {
+ "expected": [
+ "</thead><foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "thead"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "thead end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "<tbody>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "thead"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody",
+ {}
+ ]
+ ],
+ "description": "thead end-tag followed by tbody start-tag"
+ },
+ {
+ "expected": [
+ "<tfoot>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "thead"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tfoot",
+ {}
+ ]
+ ],
+ "description": "thead end-tag followed by tfoot start-tag"
+ },
+ {
+ "expected": [
+ "</thead></foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "thead"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "thead end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ "</thead>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "thead"
+ ]
+ ],
+ "description": "thead end-tag at EOF"
+ },
+ {
+ "expected": [
+ "<tbody><!--foo-->"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody",
+ {}
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "tbody start-tag followed by comment"
+ },
+ {
+ "expected": [
+ "<tbody> foo"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody",
+ {}
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "tbody start-tag followed by space character"
+ },
+ {
+ "expected": [
+ "<tbody>foo"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody",
+ {}
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "tbody start-tag followed by text"
+ },
+ {
+ "expected": [
+ "<tbody><foo>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody",
+ {}
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "tbody start-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "<table><tr>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "table",
+ {}
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody",
+ {}
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tr",
+ {}
+ ]
+ ],
+ "description": "first tbody in a table with a tr child"
+ },
+ {
+ "expected": [
+ "<tbody><tr>",
+ "</tbody><tr>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody",
+ {}
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tr",
+ {}
+ ]
+ ],
+ "description": "tbody with a tr child, following another tbody"
+ },
+ {
+ "expected": [
+ "<tbody><tr>",
+ "</thead><tr>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "thead"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody",
+ {}
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tr",
+ {}
+ ]
+ ],
+ "description": "tbody with a tr child, following a thead"
+ },
+ {
+ "expected": [
+ "<tbody><tr>",
+ "</tfoot><tr>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tfoot"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody",
+ {}
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tr",
+ {}
+ ]
+ ],
+ "description": "tbody with a tr child, following a tfoot"
+ },
+ {
+ "expected": [
+ "<tbody></foo>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody",
+ {}
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "tbody start-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ "<tbody>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody",
+ {}
+ ]
+ ],
+ "description": "tbody start-tag at EOF"
+ },
+ {
+ "expected": [
+ "</tbody><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "tbody end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</tbody> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "tbody end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "</tbody>foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "tbody end-tag followed by text"
+ },
+ {
+ "expected": [
+ "</tbody><foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "tbody end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "<tbody>",
+ "</tbody>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody",
+ {}
+ ]
+ ],
+ "description": "tbody end-tag followed by tbody start-tag"
+ },
+ {
+ "expected": [
+ "<tfoot>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tfoot",
+ {}
+ ]
+ ],
+ "description": "tbody end-tag followed by tfoot start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "tbody end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody"
+ ]
+ ],
+ "description": "tbody end-tag at EOF"
+ },
+ {
+ "expected": [
+ "</tfoot><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tfoot"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "tfoot end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</tfoot> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tfoot"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "tfoot end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "</tfoot>foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tfoot"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "tfoot end-tag followed by text"
+ },
+ {
+ "expected": [
+ "</tfoot><foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tfoot"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "tfoot end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "<tbody>",
+ "</tfoot>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tfoot"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tbody",
+ {}
+ ]
+ ],
+ "description": "tfoot end-tag followed by tbody start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tfoot"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "tfoot end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tfoot"
+ ]
+ ],
+ "description": "tfoot end-tag at EOF"
+ },
+ {
+ "expected": [
+ "</tr><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tr"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "tr end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</tr> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tr"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "tr end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "</tr>foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tr"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "tr end-tag followed by text"
+ },
+ {
+ "expected": [
+ "</tr><foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tr"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "tr end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "<tr>",
+ "</tr>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tr"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "tr",
+ {}
+ ]
+ ],
+ "description": "tr end-tag followed by tr start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tr"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "tr end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "tr"
+ ]
+ ],
+ "description": "tr end-tag at EOF"
+ },
+ {
+ "expected": [
+ "</td><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "td"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "td end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</td> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "td"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "td end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "</td>foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "td"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "td end-tag followed by text"
+ },
+ {
+ "expected": [
+ "</td><foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "td"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "td end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "<td>",
+ "</td>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "td"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "td",
+ {}
+ ]
+ ],
+ "description": "td end-tag followed by td start-tag"
+ },
+ {
+ "expected": [
+ "<th>",
+ "</td>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "td"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "th",
+ {}
+ ]
+ ],
+ "description": "td end-tag followed by th start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "td"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "td end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "td"
+ ]
+ ],
+ "description": "td end-tag at EOF"
+ },
+ {
+ "expected": [
+ "</th><!--foo-->"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "th"
+ ],
+ [
+ "Comment",
+ "foo"
+ ]
+ ],
+ "description": "th end-tag followed by comment"
+ },
+ {
+ "expected": [
+ "</th> foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "th"
+ ],
+ [
+ "Characters",
+ " foo"
+ ]
+ ],
+ "description": "th end-tag followed by space character"
+ },
+ {
+ "expected": [
+ "</th>foo"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "th"
+ ],
+ [
+ "Characters",
+ "foo"
+ ]
+ ],
+ "description": "th end-tag followed by text"
+ },
+ {
+ "expected": [
+ "</th><foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "th"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo",
+ {}
+ ]
+ ],
+ "description": "th end-tag followed by start-tag"
+ },
+ {
+ "expected": [
+ "<th>",
+ "</th>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "th"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "th",
+ {}
+ ]
+ ],
+ "description": "th end-tag followed by th start-tag"
+ },
+ {
+ "expected": [
+ "<td>",
+ "</th>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "th"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "td",
+ {}
+ ]
+ ],
+ "description": "th end-tag followed by td start-tag"
+ },
+ {
+ "expected": [
+ "</foo>"
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "th"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "foo"
+ ]
+ ],
+ "description": "th end-tag followed by end-tag"
+ },
+ {
+ "expected": [
+ ""
+ ],
+ "input": [
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "th"
+ ]
+ ],
+ "description": "th end-tag at EOF"
+ }
+ ]
+} \ No newline at end of file
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/options.test b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/options.test
new file mode 100644
index 0000000000..a22eebfcf3
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/options.test
@@ -0,0 +1,334 @@
+{
+ "tests": [
+ {
+ "expected": [
+ "<span title='test &#39;with&#39; quote_char'>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "test 'with' quote_char"
+ }
+ ]
+ ]
+ ],
+ "description": "quote_char=\"'\"",
+ "options": {
+ "quote_char": "'"
+ }
+ },
+ {
+ "expected": [
+ "<button disabled>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "button",
+ [
+ {
+ "namespace": null,
+ "name": "disabled",
+ "value": "disabled"
+ }
+ ]
+ ]
+ ],
+ "description": "quote_attr_values='always'",
+ "options": {
+ "quote_attr_values": "always"
+ }
+ },
+ {
+ "expected": [
+ "<div itemscope>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "div",
+ [
+ {
+ "namespace": null,
+ "name": "itemscope",
+ "value": "itemscope"
+ }
+ ]
+ ]
+ ],
+ "description": "quote_attr_values='always' with itemscope",
+ "options": {
+ "quote_attr_values": "always"
+ }
+ },
+ {
+ "expected": [
+ "<div irrelevant>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "div",
+ [
+ {
+ "namespace": null,
+ "name": "irrelevant",
+ "value": "irrelevant"
+ }
+ ]
+ ]
+ ],
+ "description": "quote_attr_values='always' with irrelevant",
+ "options": {
+ "quote_attr_values": "always"
+ }
+ },
+ {
+ "expected": [
+ "<div class=\"foo\">"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "div",
+ [
+ {
+ "namespace": null,
+ "name": "class",
+ "value": "foo"
+ }
+ ]
+ ]
+ ],
+ "description": "non-minimized quote_attr_values='always'",
+ "options": {
+ "quote_attr_values": "always"
+ }
+ },
+ {
+ "expected": [
+ "<div class=foo>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "div",
+ [
+ {
+ "namespace": null,
+ "name": "class",
+ "value": "foo"
+ }
+ ]
+ ]
+ ],
+ "description": "non-minimized quote_attr_values='legacy'",
+ "options": {
+ "quote_attr_values": "legacy"
+ }
+ },
+ {
+ "expected": [
+ "<div class=foo>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "div",
+ [
+ {
+ "namespace": null,
+ "name": "class",
+ "value": "foo"
+ }
+ ]
+ ]
+ ],
+ "description": "non-minimized quote_attr_values='spec'",
+ "options": {
+ "quote_attr_values": "spec"
+ }
+ },
+ {
+ "expected": [
+ "<img />"
+ ],
+ "input": [
+ [
+ "EmptyTag",
+ "img",
+ {}
+ ]
+ ],
+ "description": "use_trailing_solidus=true with void element",
+ "options": {
+ "use_trailing_solidus": true
+ }
+ },
+ {
+ "expected": [
+ "<div>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "div",
+ {}
+ ]
+ ],
+ "description": "use_trailing_solidus=true with non-void element",
+ "options": {
+ "use_trailing_solidus": true
+ }
+ },
+ {
+ "expected": [
+ "<div itemscope=itemscope>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "div",
+ [
+ {
+ "namespace": null,
+ "name": "itemscope",
+ "value": "itemscope"
+ }
+ ]
+ ]
+ ],
+ "description": "minimize_boolean_attributes=false",
+ "options": {
+ "minimize_boolean_attributes": false
+ }
+ },
+ {
+ "expected": [
+ "<div irrelevant=irrelevant>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "div",
+ [
+ {
+ "namespace": null,
+ "name": "irrelevant",
+ "value": "irrelevant"
+ }
+ ]
+ ]
+ ],
+ "description": "minimize_boolean_attributes=false",
+ "options": {
+ "minimize_boolean_attributes": false
+ }
+ },
+ {
+ "expected": [
+ "<div itemscope=\"\">"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "div",
+ [
+ {
+ "namespace": null,
+ "name": "itemscope",
+ "value": ""
+ }
+ ]
+ ]
+ ],
+ "description": "minimize_boolean_attributes=false with empty value",
+ "options": {
+ "minimize_boolean_attributes": false
+ }
+ },
+ {
+ "expected": [
+ "<div irrelevant=\"\">"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "div",
+ [
+ {
+ "namespace": null,
+ "name": "irrelevant",
+ "value": ""
+ }
+ ]
+ ]
+ ],
+ "description": "minimize_boolean_attributes=false with empty value",
+ "options": {
+ "minimize_boolean_attributes": false
+ }
+ },
+ {
+ "expected": [
+ "<a title=\"a&lt;b>c&amp;d\">"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "a",
+ [
+ {
+ "namespace": null,
+ "name": "title",
+ "value": "a<b>c&d"
+ }
+ ]
+ ]
+ ],
+ "description": "escape less than signs in attribute values",
+ "options": {
+ "escape_lt_in_attrs": true
+ }
+ },
+ {
+ "expected": [
+ "<script>a&lt;b&gt;c&amp;d"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "script",
+ {}
+ ],
+ [
+ "Characters",
+ "a<b>c&d"
+ ]
+ ],
+ "description": "rcdata",
+ "options": {
+ "escape_rcdata": true
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/whitespace.test b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/whitespace.test
new file mode 100644
index 0000000000..dac3a69e27
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/serializer-testdata/whitespace.test
@@ -0,0 +1,198 @@
+{
+ "tests": [
+ {
+ "expected": [
+ " foo"
+ ],
+ "input": [
+ [
+ "Characters",
+ "\t\r\n\f foo"
+ ]
+ ],
+ "description": "bare text with leading spaces",
+ "options": {
+ "strip_whitespace": true
+ }
+ },
+ {
+ "expected": [
+ "foo "
+ ],
+ "input": [
+ [
+ "Characters",
+ "foo \t\r\n\f"
+ ]
+ ],
+ "description": "bare text with trailing spaces",
+ "options": {
+ "strip_whitespace": true
+ }
+ },
+ {
+ "expected": [
+ "foo bar"
+ ],
+ "input": [
+ [
+ "Characters",
+ "foo \t\r\n\f bar"
+ ]
+ ],
+ "description": "bare text with inner spaces",
+ "options": {
+ "strip_whitespace": true
+ }
+ },
+ {
+ "expected": [
+ "<pre>\t\r\n\f foo \t\r\n\f bar \t\r\n\f</pre>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "pre",
+ {}
+ ],
+ [
+ "Characters",
+ "\t\r\n\f foo \t\r\n\f bar \t\r\n\f"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "pre"
+ ]
+ ],
+ "description": "text within <pre>",
+ "options": {
+ "strip_whitespace": true
+ }
+ },
+ {
+ "expected": [
+ "<pre>\t\r\n\f fo<span>o \t\r\n\f b</span>ar \t\r\n\f</pre>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "pre",
+ {}
+ ],
+ [
+ "Characters",
+ "\t\r\n\f fo"
+ ],
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "span",
+ {}
+ ],
+ [
+ "Characters",
+ "o \t\r\n\f b"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "span"
+ ],
+ [
+ "Characters",
+ "ar \t\r\n\f"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "pre"
+ ]
+ ],
+ "description": "text within <pre>, with inner markup",
+ "options": {
+ "strip_whitespace": true
+ }
+ },
+ {
+ "expected": [
+ "<textarea>\t\r\n\f foo \t\r\n\f bar \t\r\n\f</textarea>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "textarea",
+ {}
+ ],
+ [
+ "Characters",
+ "\t\r\n\f foo \t\r\n\f bar \t\r\n\f"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "textarea"
+ ]
+ ],
+ "description": "text within <textarea>",
+ "options": {
+ "strip_whitespace": true
+ }
+ },
+ {
+ "expected": [
+ "<script>\t\r\n\f foo \t\r\n\f bar \t\r\n\f</script>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "script",
+ {}
+ ],
+ [
+ "Characters",
+ "\t\r\n\f foo \t\r\n\f bar \t\r\n\f"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "script"
+ ]
+ ],
+ "description": "text within <script>",
+ "options": {
+ "strip_whitespace": true
+ }
+ },
+ {
+ "expected": [
+ "<style>\t\r\n\f foo \t\r\n\f bar \t\r\n\f</style>"
+ ],
+ "input": [
+ [
+ "StartTag",
+ "http://www.w3.org/1999/xhtml",
+ "style",
+ {}
+ ],
+ [
+ "Characters",
+ "\t\r\n\f foo \t\r\n\f bar \t\r\n\f"
+ ],
+ [
+ "EndTag",
+ "http://www.w3.org/1999/xhtml",
+ "style"
+ ]
+ ],
+ "description": "text within <style>",
+ "options": {
+ "strip_whitespace": true
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/support.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/support.py
new file mode 100644
index 0000000000..9cd5afbe69
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/support.py
@@ -0,0 +1,199 @@
+from __future__ import absolute_import, division, unicode_literals
+
+# pylint:disable=wrong-import-position
+
+import os
+import sys
+import codecs
+import glob
+import xml.sax.handler
+
+base_path = os.path.split(__file__)[0]
+
+test_dir = os.path.join(base_path, 'testdata')
+sys.path.insert(0, os.path.abspath(os.path.join(base_path,
+ os.path.pardir,
+ os.path.pardir)))
+
+from html5lib import treebuilders, treewalkers, treeadapters # noqa
+del base_path
+
+# Build a dict of available trees
+treeTypes = {}
+
+# DOM impls
+treeTypes["DOM"] = {
+ "builder": treebuilders.getTreeBuilder("dom"),
+ "walker": treewalkers.getTreeWalker("dom")
+}
+
+# ElementTree impls
+import xml.etree.ElementTree as ElementTree # noqa
+treeTypes['ElementTree'] = {
+ "builder": treebuilders.getTreeBuilder("etree", ElementTree, fullTree=True),
+ "walker": treewalkers.getTreeWalker("etree", ElementTree)
+}
+
+try:
+ import xml.etree.cElementTree as cElementTree # noqa
+except ImportError:
+ treeTypes['cElementTree'] = None
+else:
+ # On Python 3.3 and above cElementTree is an alias, don't run them twice.
+ if cElementTree.Element is ElementTree.Element:
+ treeTypes['cElementTree'] = None
+ else:
+ treeTypes['cElementTree'] = {
+ "builder": treebuilders.getTreeBuilder("etree", cElementTree, fullTree=True),
+ "walker": treewalkers.getTreeWalker("etree", cElementTree)
+ }
+
+try:
+ import lxml.etree as lxml # noqa
+except ImportError:
+ treeTypes['lxml'] = None
+else:
+ treeTypes['lxml'] = {
+ "builder": treebuilders.getTreeBuilder("lxml"),
+ "walker": treewalkers.getTreeWalker("lxml")
+ }
+
+# Genshi impls
+try:
+ import genshi # noqa
+except ImportError:
+ treeTypes["genshi"] = None
+else:
+ treeTypes["genshi"] = {
+ "builder": treebuilders.getTreeBuilder("dom"),
+ "adapter": lambda tree: treeadapters.genshi.to_genshi(treewalkers.getTreeWalker("dom")(tree)),
+ "walker": treewalkers.getTreeWalker("genshi")
+ }
+
+# pylint:enable=wrong-import-position
+
+
+def get_data_files(subdirectory, files='*.dat', search_dir=test_dir):
+ return sorted(glob.glob(os.path.join(search_dir, subdirectory, files)))
+
+
+class DefaultDict(dict):
+ def __init__(self, default, *args, **kwargs):
+ self.default = default
+ dict.__init__(self, *args, **kwargs)
+
+ def __getitem__(self, key):
+ return dict.get(self, key, self.default)
+
+
+class TestData(object):
+ def __init__(self, filename, newTestHeading="data", encoding="utf8"):
+ if encoding is None:
+ self.f = open(filename, mode="rb")
+ else:
+ self.f = codecs.open(filename, encoding=encoding)
+ self.encoding = encoding
+ self.newTestHeading = newTestHeading
+
+ def __iter__(self):
+ data = DefaultDict(None)
+ key = None
+ for line in self.f:
+ heading = self.isSectionHeading(line)
+ if heading:
+ if data and heading == self.newTestHeading:
+ # Remove trailing newline
+ data[key] = data[key][:-1]
+ yield self.normaliseOutput(data)
+ data = DefaultDict(None)
+ key = heading
+ data[key] = "" if self.encoding else b""
+ elif key is not None:
+ data[key] += line
+ if data:
+ yield self.normaliseOutput(data)
+
+ def isSectionHeading(self, line):
+ """If the current heading is a test section heading return the heading,
+ otherwise return False"""
+ # print(line)
+ if line.startswith("#" if self.encoding else b"#"):
+ return line[1:].strip()
+ else:
+ return False
+
+ def normaliseOutput(self, data):
+ # Remove trailing newlines
+ for key, value in data.items():
+ if value.endswith("\n" if self.encoding else b"\n"):
+ data[key] = value[:-1]
+ return data
+
+
+def convert(stripChars):
+ def convertData(data):
+ """convert the output of str(document) to the format used in the testcases"""
+ data = data.split("\n")
+ rv = []
+ for line in data:
+ if line.startswith("|"):
+ rv.append(line[stripChars:])
+ else:
+ rv.append(line)
+ return "\n".join(rv)
+ return convertData
+
+
+convertExpected = convert(2)
+
+
+def errorMessage(input, expected, actual):
+ msg = ("Input:\n%s\nExpected:\n%s\nReceived\n%s\n" %
+ (repr(input), repr(expected), repr(actual)))
+ if sys.version_info[0] == 2:
+ msg = msg.encode("ascii", "backslashreplace")
+ return msg
+
+
+class TracingSaxHandler(xml.sax.handler.ContentHandler):
+ def __init__(self):
+ xml.sax.handler.ContentHandler.__init__(self)
+ self.visited = []
+
+ def startDocument(self):
+ self.visited.append('startDocument')
+
+ def endDocument(self):
+ self.visited.append('endDocument')
+
+ def startPrefixMapping(self, prefix, uri):
+ # These are ignored as their order is not guaranteed
+ pass
+
+ def endPrefixMapping(self, prefix):
+ # These are ignored as their order is not guaranteed
+ pass
+
+ def startElement(self, name, attrs):
+ self.visited.append(('startElement', name, attrs))
+
+ def endElement(self, name):
+ self.visited.append(('endElement', name))
+
+ def startElementNS(self, name, qname, attrs):
+ self.visited.append(('startElementNS', name, qname, dict(attrs)))
+
+ def endElementNS(self, name, qname):
+ self.visited.append(('endElementNS', name, qname))
+
+ def characters(self, content):
+ self.visited.append(('characters', content))
+
+ def ignorableWhitespace(self, whitespace):
+ self.visited.append(('ignorableWhitespace', whitespace))
+
+ def processingInstruction(self, target, data):
+ self.visited.append(('processingInstruction', target, data))
+
+ def skippedEntity(self, name):
+ self.visited.append(('skippedEntity', name))
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_alphabeticalattributes.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_alphabeticalattributes.py
new file mode 100644
index 0000000000..7d5b8e0f65
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_alphabeticalattributes.py
@@ -0,0 +1,78 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from collections import OrderedDict
+
+import pytest
+
+import html5lib
+from html5lib.filters.alphabeticalattributes import Filter
+from html5lib.serializer import HTMLSerializer
+
+
+@pytest.mark.parametrize('msg, attrs, expected_attrs', [
+ (
+ 'no attrs',
+ {},
+ {}
+ ),
+ (
+ 'one attr',
+ {(None, 'alt'): 'image'},
+ OrderedDict([((None, 'alt'), 'image')])
+ ),
+ (
+ 'multiple attrs',
+ {
+ (None, 'src'): 'foo',
+ (None, 'alt'): 'image',
+ (None, 'style'): 'border: 1px solid black;'
+ },
+ OrderedDict([
+ ((None, 'alt'), 'image'),
+ ((None, 'src'), 'foo'),
+ ((None, 'style'), 'border: 1px solid black;')
+ ])
+ ),
+])
+def test_alphabetizing(msg, attrs, expected_attrs):
+ tokens = [{'type': 'StartTag', 'name': 'img', 'data': attrs}]
+ output_tokens = list(Filter(tokens))
+
+ attrs = output_tokens[0]['data']
+ assert attrs == expected_attrs
+
+
+def test_with_different_namespaces():
+ tokens = [{
+ 'type': 'StartTag',
+ 'name': 'pattern',
+ 'data': {
+ (None, 'id'): 'patt1',
+ ('http://www.w3.org/1999/xlink', 'href'): '#patt2'
+ }
+ }]
+ output_tokens = list(Filter(tokens))
+
+ attrs = output_tokens[0]['data']
+ assert attrs == OrderedDict([
+ ((None, 'id'), 'patt1'),
+ (('http://www.w3.org/1999/xlink', 'href'), '#patt2')
+ ])
+
+
+def test_with_serializer():
+ """Verify filter works in the context of everything else"""
+ parser = html5lib.HTMLParser()
+ dom = parser.parseFragment('<svg><pattern xlink:href="#patt2" id="patt1"></svg>')
+ walker = html5lib.getTreeWalker('etree')
+ ser = HTMLSerializer(
+ alphabetical_attributes=True,
+ quote_attr_values='always'
+ )
+
+ # FIXME(willkg): The "xlink" namespace gets dropped by the serializer. When
+ # that gets fixed, we can fix this expected result.
+ assert (
+ ser.render(walker(dom)) ==
+ '<svg><pattern id="patt1" href="#patt2"></pattern></svg>'
+ )
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_encoding.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_encoding.py
new file mode 100644
index 0000000000..47c4814a47
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_encoding.py
@@ -0,0 +1,117 @@
+from __future__ import absolute_import, division, unicode_literals
+
+import os
+
+import pytest
+
+from .support import get_data_files, test_dir, errorMessage, TestData as _TestData
+from html5lib import HTMLParser, _inputstream
+
+
+def test_basic_prescan_length():
+ data = "<title>Caf\u00E9</title><!--a--><meta charset='utf-8'>".encode('utf-8')
+ pad = 1024 - len(data) + 1
+ data = data.replace(b"-a-", b"-" + (b"a" * pad) + b"-")
+ assert len(data) == 1024 # Sanity
+ stream = _inputstream.HTMLBinaryInputStream(data, useChardet=False)
+ assert 'utf-8' == stream.charEncoding[0].name
+
+
+def test_parser_reparse():
+ data = "<title>Caf\u00E9</title><!--a--><meta charset='utf-8'>".encode('utf-8')
+ pad = 10240 - len(data) + 1
+ data = data.replace(b"-a-", b"-" + (b"a" * pad) + b"-")
+ assert len(data) == 10240 # Sanity
+ stream = _inputstream.HTMLBinaryInputStream(data, useChardet=False)
+ assert 'windows-1252' == stream.charEncoding[0].name
+ p = HTMLParser(namespaceHTMLElements=False)
+ doc = p.parse(data, useChardet=False)
+ assert 'utf-8' == p.documentEncoding
+ assert doc.find(".//title").text == "Caf\u00E9"
+
+
+@pytest.mark.parametrize("expected,data,kwargs", [
+ ("utf-16le", b"\xFF\xFE", {"override_encoding": "iso-8859-2"}),
+ ("utf-16be", b"\xFE\xFF", {"override_encoding": "iso-8859-2"}),
+ ("utf-8", b"\xEF\xBB\xBF", {"override_encoding": "iso-8859-2"}),
+ ("iso-8859-2", b"", {"override_encoding": "iso-8859-2", "transport_encoding": "iso-8859-3"}),
+ ("iso-8859-2", b"<meta charset=iso-8859-3>", {"transport_encoding": "iso-8859-2"}),
+ ("iso-8859-2", b"<meta charset=iso-8859-2>", {"same_origin_parent_encoding": "iso-8859-3"}),
+ ("iso-8859-2", b"", {"same_origin_parent_encoding": "iso-8859-2", "likely_encoding": "iso-8859-3"}),
+ ("iso-8859-2", b"", {"same_origin_parent_encoding": "utf-16", "likely_encoding": "iso-8859-2"}),
+ ("iso-8859-2", b"", {"same_origin_parent_encoding": "utf-16be", "likely_encoding": "iso-8859-2"}),
+ ("iso-8859-2", b"", {"same_origin_parent_encoding": "utf-16le", "likely_encoding": "iso-8859-2"}),
+ ("iso-8859-2", b"", {"likely_encoding": "iso-8859-2", "default_encoding": "iso-8859-3"}),
+ ("iso-8859-2", b"", {"default_encoding": "iso-8859-2"}),
+ ("windows-1252", b"", {"default_encoding": "totally-bogus-string"}),
+ ("windows-1252", b"", {}),
+])
+def test_parser_args(expected, data, kwargs):
+ stream = _inputstream.HTMLBinaryInputStream(data, useChardet=False, **kwargs)
+ assert expected == stream.charEncoding[0].name
+ p = HTMLParser()
+ p.parse(data, useChardet=False, **kwargs)
+ assert expected == p.documentEncoding
+
+
+@pytest.mark.parametrize("kwargs", [
+ {"override_encoding": "iso-8859-2"},
+ {"override_encoding": None},
+ {"transport_encoding": "iso-8859-2"},
+ {"transport_encoding": None},
+ {"same_origin_parent_encoding": "iso-8859-2"},
+ {"same_origin_parent_encoding": None},
+ {"likely_encoding": "iso-8859-2"},
+ {"likely_encoding": None},
+ {"default_encoding": "iso-8859-2"},
+ {"default_encoding": None},
+ {"foo_encoding": "iso-8859-2"},
+ {"foo_encoding": None},
+])
+def test_parser_args_raises(kwargs):
+ with pytest.raises(TypeError) as exc_info:
+ p = HTMLParser()
+ p.parse("", useChardet=False, **kwargs)
+ assert exc_info.value.args[0].startswith("Cannot set an encoding with a unicode input")
+
+
+def param_encoding():
+ for filename in get_data_files("encoding"):
+ tests = _TestData(filename, b"data", encoding=None)
+ for test in tests:
+ yield test[b'data'], test[b'encoding']
+
+
+@pytest.mark.parametrize("data, encoding", param_encoding())
+def test_parser_encoding(data, encoding):
+ p = HTMLParser()
+ assert p.documentEncoding is None
+ p.parse(data, useChardet=False)
+ encoding = encoding.lower().decode("ascii")
+
+ assert encoding == p.documentEncoding, errorMessage(data, encoding, p.documentEncoding)
+
+
+@pytest.mark.parametrize("data, encoding", param_encoding())
+def test_prescan_encoding(data, encoding):
+ stream = _inputstream.HTMLBinaryInputStream(data, useChardet=False)
+ encoding = encoding.lower().decode("ascii")
+
+ # Very crude way to ignore irrelevant tests
+ if len(data) > stream.numBytesMeta:
+ return
+
+ assert encoding == stream.charEncoding[0].name, errorMessage(data, encoding, stream.charEncoding[0].name)
+
+
+# pylint:disable=wrong-import-position
+try:
+ import chardet # noqa
+except ImportError:
+ print("chardet not found, skipping chardet tests")
+else:
+ def test_chardet():
+ with open(os.path.join(test_dir, "encoding", "chardet", "test_big5.txt"), "rb") as fp:
+ encoding = _inputstream.HTMLInputStream(fp.read()).charEncoding
+ assert encoding[0].name == "big5"
+# pylint:enable=wrong-import-position
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_meta.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_meta.py
new file mode 100644
index 0000000000..dd02dd7fb7
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_meta.py
@@ -0,0 +1,41 @@
+from __future__ import absolute_import, division, unicode_literals
+
+import six
+from mock import Mock
+
+from . import support
+
+
+def _createReprMock(r):
+ """Creates a mock with a __repr__ returning r
+
+ Also provides __str__ mock with default mock behaviour"""
+ mock = Mock()
+ mock.__repr__ = Mock()
+ mock.__repr__.return_value = r
+ mock.__str__ = Mock(wraps=mock.__str__)
+ return mock
+
+
+def test_errorMessage():
+ # Create mock objects to take repr of
+ input = _createReprMock("1")
+ expected = _createReprMock("2")
+ actual = _createReprMock("3")
+
+ # Run the actual test
+ r = support.errorMessage(input, expected, actual)
+
+ # Assertions!
+ if six.PY2:
+ assert b"Input:\n1\nExpected:\n2\nReceived\n3\n" == r
+ else:
+ assert six.PY3
+ assert "Input:\n1\nExpected:\n2\nReceived\n3\n" == r
+
+ assert input.__repr__.call_count == 1
+ assert expected.__repr__.call_count == 1
+ assert actual.__repr__.call_count == 1
+ assert not input.__str__.called
+ assert not expected.__str__.called
+ assert not actual.__str__.called
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_optionaltags_filter.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_optionaltags_filter.py
new file mode 100644
index 0000000000..cd2821497f
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_optionaltags_filter.py
@@ -0,0 +1,7 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from html5lib.filters.optionaltags import Filter
+
+
+def test_empty():
+ assert list(Filter([])) == []
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_parser2.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_parser2.py
new file mode 100644
index 0000000000..879d2447df
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_parser2.py
@@ -0,0 +1,94 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from six import PY2, text_type
+
+import io
+
+from . import support # noqa
+
+from html5lib.constants import namespaces
+from html5lib import parse, parseFragment, HTMLParser
+
+
+# tests that aren't autogenerated from text files
+def test_assertDoctypeCloneable():
+ doc = parse('<!DOCTYPE HTML>', treebuilder="dom")
+ assert doc.cloneNode(True) is not None
+
+
+def test_line_counter():
+ # http://groups.google.com/group/html5lib-discuss/browse_frm/thread/f4f00e4a2f26d5c0
+ assert parse("<pre>\nx\n&gt;\n</pre>") is not None
+
+
+def test_namespace_html_elements_0_dom():
+ doc = parse("<html></html>",
+ treebuilder="dom",
+ namespaceHTMLElements=True)
+ assert doc.childNodes[0].namespaceURI == namespaces["html"]
+
+
+def test_namespace_html_elements_1_dom():
+ doc = parse("<html></html>",
+ treebuilder="dom",
+ namespaceHTMLElements=False)
+ assert doc.childNodes[0].namespaceURI is None
+
+
+def test_namespace_html_elements_0_etree():
+ doc = parse("<html></html>",
+ treebuilder="etree",
+ namespaceHTMLElements=True)
+ assert doc.tag == "{%s}html" % (namespaces["html"],)
+
+
+def test_namespace_html_elements_1_etree():
+ doc = parse("<html></html>",
+ treebuilder="etree",
+ namespaceHTMLElements=False)
+ assert doc.tag == "html"
+
+
+def test_unicode_file():
+ assert parse(io.StringIO("a")) is not None
+
+
+def test_debug_log():
+ parser = HTMLParser(debug=True)
+ parser.parse("<!doctype html><title>a</title><p>b<script>c</script>d</p>e")
+
+ expected = [('dataState', 'InitialPhase', 'InitialPhase', 'processDoctype', {'type': 'Doctype'}),
+ ('dataState', 'BeforeHtmlPhase', 'BeforeHtmlPhase', 'processStartTag', {'name': 'title', 'type': 'StartTag'}),
+ ('dataState', 'BeforeHeadPhase', 'BeforeHeadPhase', 'processStartTag', {'name': 'title', 'type': 'StartTag'}),
+ ('dataState', 'InHeadPhase', 'InHeadPhase', 'processStartTag', {'name': 'title', 'type': 'StartTag'}),
+ ('rcdataState', 'TextPhase', 'TextPhase', 'processCharacters', {'type': 'Characters'}),
+ ('dataState', 'TextPhase', 'TextPhase', 'processEndTag', {'name': 'title', 'type': 'EndTag'}),
+ ('dataState', 'InHeadPhase', 'InHeadPhase', 'processStartTag', {'name': 'p', 'type': 'StartTag'}),
+ ('dataState', 'AfterHeadPhase', 'AfterHeadPhase', 'processStartTag', {'name': 'p', 'type': 'StartTag'}),
+ ('dataState', 'InBodyPhase', 'InBodyPhase', 'processStartTag', {'name': 'p', 'type': 'StartTag'}),
+ ('dataState', 'InBodyPhase', 'InBodyPhase', 'processCharacters', {'type': 'Characters'}),
+ ('dataState', 'InBodyPhase', 'InBodyPhase', 'processStartTag', {'name': 'script', 'type': 'StartTag'}),
+ ('dataState', 'InBodyPhase', 'InHeadPhase', 'processStartTag', {'name': 'script', 'type': 'StartTag'}),
+ ('scriptDataState', 'TextPhase', 'TextPhase', 'processCharacters', {'type': 'Characters'}),
+ ('dataState', 'TextPhase', 'TextPhase', 'processEndTag', {'name': 'script', 'type': 'EndTag'}),
+ ('dataState', 'InBodyPhase', 'InBodyPhase', 'processCharacters', {'type': 'Characters'}),
+ ('dataState', 'InBodyPhase', 'InBodyPhase', 'processEndTag', {'name': 'p', 'type': 'EndTag'}),
+ ('dataState', 'InBodyPhase', 'InBodyPhase', 'processCharacters', {'type': 'Characters'})]
+
+ if PY2:
+ for i, log in enumerate(expected):
+ log = [x.encode("ascii") if isinstance(x, text_type) else x for x in log]
+ expected[i] = tuple(log)
+
+ assert parser.log == expected
+
+
+def test_no_duplicate_clone():
+ frag = parseFragment("<b><em><foo><foob><fooc><aside></b></em>")
+ assert len(frag) == 2
+
+
+def test_self_closing_col():
+ parser = HTMLParser()
+ parser.parseFragment('<table><colgroup><col /></colgroup></table>')
+ assert not parser.errors
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_sanitizer.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_sanitizer.py
new file mode 100644
index 0000000000..f3faeb8050
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_sanitizer.py
@@ -0,0 +1,133 @@
+from __future__ import absolute_import, division, unicode_literals
+
+import pytest
+
+from html5lib import constants, parseFragment, serialize
+from html5lib.filters import sanitizer
+
+
+def sanitize_html(stream):
+ parsed = parseFragment(stream)
+ with pytest.deprecated_call():
+ serialized = serialize(parsed,
+ sanitize=True,
+ omit_optional_tags=False,
+ use_trailing_solidus=True,
+ space_before_trailing_solidus=False,
+ quote_attr_values="always",
+ quote_char='"',
+ alphabetical_attributes=True)
+ return serialized
+
+
+def test_should_handle_astral_plane_characters():
+ sanitized = sanitize_html("<p>&#x1d4b5; &#x1d538;</p>")
+ expected = '<p>\U0001d4b5 \U0001d538</p>'
+ assert expected == sanitized
+
+
+def test_should_allow_relative_uris():
+ sanitized = sanitize_html('<p><a href="/example.com"></a></p>')
+ expected = '<p><a href="/example.com"></a></p>'
+ assert expected == sanitized
+
+
+def test_invalid_data_uri():
+ sanitized = sanitize_html('<audio controls="" src="data:foobar"></audio>')
+ expected = '<audio controls></audio>'
+ assert expected == sanitized
+
+
+def test_invalid_ipv6_url():
+ sanitized = sanitize_html('<a href="h://]">')
+ expected = "<a></a>"
+ assert expected == sanitized
+
+
+def test_data_uri_disallowed_type():
+ sanitized = sanitize_html('<audio controls="" src="data:text/html,<html>"></audio>')
+ expected = "<audio controls></audio>"
+ assert expected == sanitized
+
+
+def param_sanitizer():
+ for ns, tag_name in sanitizer.allowed_elements:
+ if ns != constants.namespaces["html"]:
+ continue
+ if tag_name in ['caption', 'col', 'colgroup', 'optgroup', 'option', 'table', 'tbody', 'td',
+ 'tfoot', 'th', 'thead', 'tr', 'select']:
+ continue # TODO
+ if tag_name == 'image':
+ yield ("test_should_allow_%s_tag" % tag_name,
+ "<img title=\"1\"/>foo &lt;bad&gt;bar&lt;/bad&gt; baz",
+ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name))
+ elif tag_name == 'br':
+ yield ("test_should_allow_%s_tag" % tag_name,
+ "<br title=\"1\"/>foo &lt;bad&gt;bar&lt;/bad&gt; baz<br/>",
+ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name))
+ elif tag_name in constants.voidElements:
+ yield ("test_should_allow_%s_tag" % tag_name,
+ "<%s title=\"1\"/>foo &lt;bad&gt;bar&lt;/bad&gt; baz" % tag_name,
+ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name))
+ else:
+ yield ("test_should_allow_%s_tag" % tag_name,
+ "<%s title=\"1\">foo &lt;bad&gt;bar&lt;/bad&gt; baz</%s>" % (tag_name, tag_name),
+ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name))
+
+ for ns, attribute_name in sanitizer.allowed_attributes:
+ if ns is not None:
+ continue
+ if attribute_name != attribute_name.lower():
+ continue # TODO
+ if attribute_name == 'style':
+ continue
+ attribute_value = 'foo'
+ if attribute_name in sanitizer.attr_val_is_uri:
+ attribute_value = '%s://sub.domain.tld/path/object.ext' % sanitizer.allowed_protocols[0]
+ yield ("test_should_allow_%s_attribute" % attribute_name,
+ "<p %s=\"%s\">foo &lt;bad&gt;bar&lt;/bad&gt; baz</p>" % (attribute_name, attribute_value),
+ "<p %s='%s'>foo <bad>bar</bad> baz</p>" % (attribute_name, attribute_value))
+
+ for protocol in sanitizer.allowed_protocols:
+ rest_of_uri = '//sub.domain.tld/path/object.ext'
+ if protocol == 'data':
+ rest_of_uri = 'image/png;base64,aGVsbG8gd29ybGQ='
+ yield ("test_should_allow_uppercase_%s_uris" % protocol,
+ "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri),
+ """<img src="%s:%s">foo</a>""" % (protocol, rest_of_uri))
+
+ for protocol in sanitizer.allowed_protocols:
+ rest_of_uri = '//sub.domain.tld/path/object.ext'
+ if protocol == 'data':
+ rest_of_uri = 'image/png;base64,aGVsbG8gd29ybGQ='
+ protocol = protocol.upper()
+ yield ("test_should_allow_uppercase_%s_uris" % protocol,
+ "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri),
+ """<img src="%s:%s">foo</a>""" % (protocol, rest_of_uri))
+
+
+@pytest.mark.parametrize("expected, input",
+ (pytest.param(expected, input, id=id)
+ for id, expected, input in param_sanitizer()))
+def test_sanitizer(expected, input):
+ parsed = parseFragment(expected)
+ expected = serialize(parsed,
+ omit_optional_tags=False,
+ use_trailing_solidus=True,
+ space_before_trailing_solidus=False,
+ quote_attr_values="always",
+ quote_char='"',
+ alphabetical_attributes=True)
+ assert expected == sanitize_html(input)
+
+
+def test_lowercase_color_codes_in_style():
+ sanitized = sanitize_html("<p style=\"border: 1px solid #a2a2a2;\"></p>")
+ expected = '<p style=\"border: 1px solid #a2a2a2;\"></p>'
+ assert expected == sanitized
+
+
+def test_uppercase_color_codes_in_style():
+ sanitized = sanitize_html("<p style=\"border: 1px solid #A2A2A2;\"></p>")
+ expected = '<p style=\"border: 1px solid #A2A2A2;\"></p>'
+ assert expected == sanitized
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_serializer.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_serializer.py
new file mode 100644
index 0000000000..bce6245905
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_serializer.py
@@ -0,0 +1,226 @@
+from __future__ import absolute_import, division, unicode_literals
+
+import os
+import json
+
+import pytest
+
+from .support import get_data_files
+
+from html5lib import constants
+from html5lib.filters.lint import Filter as Lint
+from html5lib.serializer import HTMLSerializer, serialize
+from html5lib.treewalkers.base import TreeWalker
+
+# pylint:disable=wrong-import-position
+optionals_loaded = []
+
+try:
+ from lxml import etree
+ optionals_loaded.append("lxml")
+except ImportError:
+ pass
+# pylint:enable=wrong-import-position
+
+default_namespace = constants.namespaces["html"]
+
+
+class JsonWalker(TreeWalker):
+ def __iter__(self):
+ for token in self.tree:
+ type = token[0]
+ if type == "StartTag":
+ if len(token) == 4:
+ namespace, name, attrib = token[1:4]
+ else:
+ namespace = default_namespace
+ name, attrib = token[1:3]
+ yield self.startTag(namespace, name, self._convertAttrib(attrib))
+ elif type == "EndTag":
+ if len(token) == 3:
+ namespace, name = token[1:3]
+ else:
+ namespace = default_namespace
+ name = token[1]
+ yield self.endTag(namespace, name)
+ elif type == "EmptyTag":
+ if len(token) == 4:
+ namespace, name, attrib = token[1:]
+ else:
+ namespace = default_namespace
+ name, attrib = token[1:]
+ for token in self.emptyTag(namespace, name, self._convertAttrib(attrib)):
+ yield token
+ elif type == "Comment":
+ yield self.comment(token[1])
+ elif type in ("Characters", "SpaceCharacters"):
+ for token in self.text(token[1]):
+ yield token
+ elif type == "Doctype":
+ if len(token) == 4:
+ yield self.doctype(token[1], token[2], token[3])
+ elif len(token) == 3:
+ yield self.doctype(token[1], token[2])
+ else:
+ yield self.doctype(token[1])
+ else:
+ raise ValueError("Unknown token type: " + type)
+
+ def _convertAttrib(self, attribs):
+ """html5lib tree-walkers use a dict of (namespace, name): value for
+ attributes, but JSON cannot represent this. Convert from the format
+ in the serializer tests (a list of dicts with "namespace", "name",
+ and "value" as keys) to html5lib's tree-walker format."""
+ attrs = {}
+ for attrib in attribs:
+ name = (attrib["namespace"], attrib["name"])
+ assert(name not in attrs)
+ attrs[name] = attrib["value"]
+ return attrs
+
+
+def serialize_html(input, options):
+ options = {str(k): v for k, v in options.items()}
+ encoding = options.get("encoding", None)
+ if "encoding" in options:
+ del options["encoding"]
+ stream = Lint(JsonWalker(input), False)
+ serializer = HTMLSerializer(alphabetical_attributes=True, **options)
+ return serializer.render(stream, encoding)
+
+
+def throwsWithLatin1(input):
+ with pytest.raises(UnicodeEncodeError):
+ serialize_html(input, {"encoding": "iso-8859-1"})
+
+
+def testDoctypeName():
+ throwsWithLatin1([["Doctype", "\u0101"]])
+
+
+def testDoctypePublicId():
+ throwsWithLatin1([["Doctype", "potato", "\u0101"]])
+
+
+def testDoctypeSystemId():
+ throwsWithLatin1([["Doctype", "potato", "potato", "\u0101"]])
+
+
+def testCdataCharacters():
+ test_serializer([["StartTag", "http://www.w3.org/1999/xhtml", "style", {}], ["Characters", "\u0101"]],
+ ["<style>&amacr;"], {"encoding": "iso-8859-1"})
+
+
+def testCharacters():
+ test_serializer([["Characters", "\u0101"]],
+ ["&amacr;"], {"encoding": "iso-8859-1"})
+
+
+def testStartTagName():
+ throwsWithLatin1([["StartTag", "http://www.w3.org/1999/xhtml", "\u0101", []]])
+
+
+def testAttributeName():
+ throwsWithLatin1([["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": None, "name": "\u0101", "value": "potato"}]]])
+
+
+def testAttributeValue():
+ test_serializer([["StartTag", "http://www.w3.org/1999/xhtml", "span",
+ [{"namespace": None, "name": "potato", "value": "\u0101"}]]],
+ ["<span potato=&amacr;>"], {"encoding": "iso-8859-1"})
+
+
+def testEndTagName():
+ throwsWithLatin1([["EndTag", "http://www.w3.org/1999/xhtml", "\u0101"]])
+
+
+def testComment():
+ throwsWithLatin1([["Comment", "\u0101"]])
+
+
+def testThrowsUnknownOption():
+ with pytest.raises(TypeError):
+ HTMLSerializer(foobar=None)
+
+
+@pytest.mark.parametrize("c", list("\t\n\u000C\x20\r\"'=<>`"))
+def testSpecQuoteAttribute(c):
+ input_ = [["StartTag", "http://www.w3.org/1999/xhtml", "span",
+ [{"namespace": None, "name": "foo", "value": c}]]]
+ if c == '"':
+ output_ = ["<span foo='%s'>" % c]
+ else:
+ output_ = ['<span foo="%s">' % c]
+ options_ = {"quote_attr_values": "spec"}
+ test_serializer(input_, output_, options_)
+
+
+@pytest.mark.parametrize("c", list("\t\n\u000C\x20\r\"'=<>`"
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n"
+ "\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15"
+ "\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+ "\x20\x2f\x60\xa0\u1680\u180e\u180f\u2000"
+ "\u2001\u2002\u2003\u2004\u2005\u2006\u2007"
+ "\u2008\u2009\u200a\u2028\u2029\u202f\u205f"
+ "\u3000"))
+def testLegacyQuoteAttribute(c):
+ input_ = [["StartTag", "http://www.w3.org/1999/xhtml", "span",
+ [{"namespace": None, "name": "foo", "value": c}]]]
+ if c == '"':
+ output_ = ["<span foo='%s'>" % c]
+ else:
+ output_ = ['<span foo="%s">' % c]
+ options_ = {"quote_attr_values": "legacy"}
+ test_serializer(input_, output_, options_)
+
+
+@pytest.fixture
+def lxml_parser():
+ return etree.XMLParser(resolve_entities=False)
+
+
+@pytest.mark.skipif("lxml" not in optionals_loaded, reason="lxml not importable")
+def testEntityReplacement(lxml_parser):
+ doc = '<!DOCTYPE html SYSTEM "about:legacy-compat"><html>&beta;</html>'
+ tree = etree.fromstring(doc, parser=lxml_parser).getroottree()
+ result = serialize(tree, tree="lxml", omit_optional_tags=False)
+ assert result == '<!DOCTYPE html SYSTEM "about:legacy-compat"><html>\u03B2</html>'
+
+
+@pytest.mark.skipif("lxml" not in optionals_loaded, reason="lxml not importable")
+def testEntityXML(lxml_parser):
+ doc = '<!DOCTYPE html SYSTEM "about:legacy-compat"><html>&gt;</html>'
+ tree = etree.fromstring(doc, parser=lxml_parser).getroottree()
+ result = serialize(tree, tree="lxml", omit_optional_tags=False)
+ assert result == '<!DOCTYPE html SYSTEM "about:legacy-compat"><html>&gt;</html>'
+
+
+@pytest.mark.skipif("lxml" not in optionals_loaded, reason="lxml not importable")
+def testEntityNoResolve(lxml_parser):
+ doc = '<!DOCTYPE html SYSTEM "about:legacy-compat"><html>&beta;</html>'
+ tree = etree.fromstring(doc, parser=lxml_parser).getroottree()
+ result = serialize(tree, tree="lxml", omit_optional_tags=False,
+ resolve_entities=False)
+ assert result == '<!DOCTYPE html SYSTEM "about:legacy-compat"><html>&beta;</html>'
+
+
+def param_serializer():
+ for filename in get_data_files('serializer-testdata', '*.test', os.path.dirname(__file__)):
+ with open(filename) as fp:
+ tests = json.load(fp)
+ for test in tests['tests']:
+ yield test["input"], test["expected"], test.get("options", {})
+
+
+@pytest.mark.parametrize("input, expected, options", param_serializer())
+def test_serializer(input, expected, options):
+ encoding = options.get("encoding", None)
+
+ if encoding:
+ expected = list(map(lambda x: x.encode(encoding), expected))
+
+ result = serialize_html(input, options)
+ if len(expected) == 1:
+ assert expected[0] == result, "Expected:\n%s\nActual:\n%s\nOptions:\n%s" % (expected[0], result, str(options))
+ elif result not in expected:
+ assert False, "Expected: %s, Received: %s" % (expected, result)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_stream.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_stream.py
new file mode 100644
index 0000000000..efe9b472f5
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_stream.py
@@ -0,0 +1,325 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from . import support # noqa
+
+import codecs
+import sys
+from io import BytesIO, StringIO
+
+import pytest
+
+import six
+from six.moves import http_client, urllib
+
+from html5lib._inputstream import (BufferedStream, HTMLInputStream,
+ HTMLUnicodeInputStream, HTMLBinaryInputStream)
+from html5lib._utils import supports_lone_surrogates
+
+
+def test_basic():
+ s = b"abc"
+ fp = BufferedStream(BytesIO(s))
+ read = fp.read(10)
+ assert read == s
+
+
+def test_read_length():
+ fp = BufferedStream(BytesIO(b"abcdef"))
+ read1 = fp.read(1)
+ assert read1 == b"a"
+ read2 = fp.read(2)
+ assert read2 == b"bc"
+ read3 = fp.read(3)
+ assert read3 == b"def"
+ read4 = fp.read(4)
+ assert read4 == b""
+
+
+def test_tell():
+ fp = BufferedStream(BytesIO(b"abcdef"))
+ read1 = fp.read(1)
+ assert read1 == b"a"
+ assert fp.tell() == 1
+ read2 = fp.read(2)
+ assert read2 == b"bc"
+ assert fp.tell() == 3
+ read3 = fp.read(3)
+ assert read3 == b"def"
+ assert fp.tell() == 6
+ read4 = fp.read(4)
+ assert read4 == b""
+ assert fp.tell() == 6
+
+
+def test_seek():
+ fp = BufferedStream(BytesIO(b"abcdef"))
+ read1 = fp.read(1)
+ assert read1 == b"a"
+ fp.seek(0)
+ read2 = fp.read(1)
+ assert read2 == b"a"
+ read3 = fp.read(2)
+ assert read3 == b"bc"
+ fp.seek(2)
+ read4 = fp.read(2)
+ assert read4 == b"cd"
+ fp.seek(4)
+ read5 = fp.read(2)
+ assert read5 == b"ef"
+
+
+def test_seek_tell():
+ fp = BufferedStream(BytesIO(b"abcdef"))
+ read1 = fp.read(1)
+ assert read1 == b"a"
+ assert fp.tell() == 1
+ fp.seek(0)
+ read2 = fp.read(1)
+ assert read2 == b"a"
+ assert fp.tell() == 1
+ read3 = fp.read(2)
+ assert read3 == b"bc"
+ assert fp.tell() == 3
+ fp.seek(2)
+ read4 = fp.read(2)
+ assert read4 == b"cd"
+ assert fp.tell() == 4
+ fp.seek(4)
+ read5 = fp.read(2)
+ assert read5 == b"ef"
+ assert fp.tell() == 6
+
+
+class HTMLUnicodeInputStreamShortChunk(HTMLUnicodeInputStream):
+ _defaultChunkSize = 2
+
+
+class HTMLBinaryInputStreamShortChunk(HTMLBinaryInputStream):
+ _defaultChunkSize = 2
+
+
+def test_char_ascii():
+ stream = HTMLInputStream(b"'", override_encoding='ascii')
+ assert stream.charEncoding[0].name == 'windows-1252'
+ assert stream.char() == "'"
+
+
+def test_char_utf8():
+ stream = HTMLInputStream('\u2018'.encode('utf-8'), override_encoding='utf-8')
+ assert stream.charEncoding[0].name == 'utf-8'
+ assert stream.char() == '\u2018'
+
+
+def test_char_win1252():
+ stream = HTMLInputStream("\xa9\xf1\u2019".encode('windows-1252'))
+ assert stream.charEncoding[0].name == 'windows-1252'
+ assert stream.char() == "\xa9"
+ assert stream.char() == "\xf1"
+ assert stream.char() == "\u2019"
+
+
+def test_bom():
+ stream = HTMLInputStream(codecs.BOM_UTF8 + b"'")
+ assert stream.charEncoding[0].name == 'utf-8'
+ assert stream.char() == "'"
+
+
+def test_utf_16():
+ stream = HTMLInputStream((' ' * 1025).encode('utf-16'))
+ assert stream.charEncoding[0].name in ['utf-16le', 'utf-16be']
+ assert len(stream.charsUntil(' ', True)) == 1025
+
+
+def test_newlines():
+ stream = HTMLBinaryInputStreamShortChunk(codecs.BOM_UTF8 + b"a\nbb\r\nccc\rddddxe")
+ assert stream.position() == (1, 0)
+ assert stream.charsUntil('c') == "a\nbb\n"
+ assert stream.position() == (3, 0)
+ assert stream.charsUntil('x') == "ccc\ndddd"
+ assert stream.position() == (4, 4)
+ assert stream.charsUntil('e') == "x"
+ assert stream.position() == (4, 5)
+
+
+def test_newlines2():
+ size = HTMLUnicodeInputStream._defaultChunkSize
+ stream = HTMLInputStream("\r" * size + "\n")
+ assert stream.charsUntil('x') == "\n" * size
+
+
+def test_position():
+ stream = HTMLBinaryInputStreamShortChunk(codecs.BOM_UTF8 + b"a\nbb\nccc\nddde\nf\ngh")
+ assert stream.position() == (1, 0)
+ assert stream.charsUntil('c') == "a\nbb\n"
+ assert stream.position() == (3, 0)
+ stream.unget("\n")
+ assert stream.position() == (2, 2)
+ assert stream.charsUntil('c') == "\n"
+ assert stream.position() == (3, 0)
+ stream.unget("\n")
+ assert stream.position() == (2, 2)
+ assert stream.char() == "\n"
+ assert stream.position() == (3, 0)
+ assert stream.charsUntil('e') == "ccc\nddd"
+ assert stream.position() == (4, 3)
+ assert stream.charsUntil('h') == "e\nf\ng"
+ assert stream.position() == (6, 1)
+
+
+def test_position2():
+ stream = HTMLUnicodeInputStreamShortChunk("abc\nd")
+ assert stream.position() == (1, 0)
+ assert stream.char() == "a"
+ assert stream.position() == (1, 1)
+ assert stream.char() == "b"
+ assert stream.position() == (1, 2)
+ assert stream.char() == "c"
+ assert stream.position() == (1, 3)
+ assert stream.char() == "\n"
+ assert stream.position() == (2, 0)
+ assert stream.char() == "d"
+ assert stream.position() == (2, 1)
+
+
+def test_python_issue_20007():
+ """
+ Make sure we have a work-around for Python bug #20007
+ http://bugs.python.org/issue20007
+ """
+ class FakeSocket(object):
+ def makefile(self, _mode, _bufsize=None):
+ # pylint:disable=unused-argument
+ return BytesIO(b"HTTP/1.1 200 Ok\r\n\r\nText")
+
+ source = http_client.HTTPResponse(FakeSocket())
+ source.begin()
+ stream = HTMLInputStream(source)
+ assert stream.charsUntil(" ") == "Text"
+
+
+def test_python_issue_20007_b():
+ """
+ Make sure we have a work-around for Python bug #20007
+ http://bugs.python.org/issue20007
+ """
+ if six.PY2:
+ return
+
+ class FakeSocket(object):
+ def makefile(self, _mode, _bufsize=None):
+ # pylint:disable=unused-argument
+ return BytesIO(b"HTTP/1.1 200 Ok\r\n\r\nText")
+
+ source = http_client.HTTPResponse(FakeSocket())
+ source.begin()
+ wrapped = urllib.response.addinfourl(source, source.msg, "http://example.com")
+ stream = HTMLInputStream(wrapped)
+ assert stream.charsUntil(" ") == "Text"
+
+
+@pytest.mark.parametrize("inp,num",
+ [("\u0000", 0),
+ ("\u0001", 1),
+ ("\u0008", 1),
+ ("\u0009", 0),
+ ("\u000A", 0),
+ ("\u000B", 1),
+ ("\u000C", 0),
+ ("\u000D", 0),
+ ("\u000E", 1),
+ ("\u001F", 1),
+ ("\u0020", 0),
+ ("\u007E", 0),
+ ("\u007F", 1),
+ ("\u009F", 1),
+ ("\u00A0", 0),
+ ("\uFDCF", 0),
+ ("\uFDD0", 1),
+ ("\uFDEF", 1),
+ ("\uFDF0", 0),
+ ("\uFFFD", 0),
+ ("\uFFFE", 1),
+ ("\uFFFF", 1),
+ ("\U0001FFFD", 0),
+ ("\U0001FFFE", 1),
+ ("\U0001FFFF", 1),
+ ("\U0002FFFD", 0),
+ ("\U0002FFFE", 1),
+ ("\U0002FFFF", 1),
+ ("\U0003FFFD", 0),
+ ("\U0003FFFE", 1),
+ ("\U0003FFFF", 1),
+ ("\U0004FFFD", 0),
+ ("\U0004FFFE", 1),
+ ("\U0004FFFF", 1),
+ ("\U0005FFFD", 0),
+ ("\U0005FFFE", 1),
+ ("\U0005FFFF", 1),
+ ("\U0006FFFD", 0),
+ ("\U0006FFFE", 1),
+ ("\U0006FFFF", 1),
+ ("\U0007FFFD", 0),
+ ("\U0007FFFE", 1),
+ ("\U0007FFFF", 1),
+ ("\U0008FFFD", 0),
+ ("\U0008FFFE", 1),
+ ("\U0008FFFF", 1),
+ ("\U0009FFFD", 0),
+ ("\U0009FFFE", 1),
+ ("\U0009FFFF", 1),
+ ("\U000AFFFD", 0),
+ ("\U000AFFFE", 1),
+ ("\U000AFFFF", 1),
+ ("\U000BFFFD", 0),
+ ("\U000BFFFE", 1),
+ ("\U000BFFFF", 1),
+ ("\U000CFFFD", 0),
+ ("\U000CFFFE", 1),
+ ("\U000CFFFF", 1),
+ ("\U000DFFFD", 0),
+ ("\U000DFFFE", 1),
+ ("\U000DFFFF", 1),
+ ("\U000EFFFD", 0),
+ ("\U000EFFFE", 1),
+ ("\U000EFFFF", 1),
+ ("\U000FFFFD", 0),
+ ("\U000FFFFE", 1),
+ ("\U000FFFFF", 1),
+ ("\U0010FFFD", 0),
+ ("\U0010FFFE", 1),
+ ("\U0010FFFF", 1),
+ ("\x01\x01\x01", 3),
+ ("a\x01a\x01a\x01a", 3)])
+def test_invalid_codepoints(inp, num):
+ stream = HTMLUnicodeInputStream(StringIO(inp))
+ for _i in range(len(inp)):
+ stream.char()
+ assert len(stream.errors) == num
+
+
+@pytest.mark.skipif(not supports_lone_surrogates, reason="doesn't support lone surrogates")
+@pytest.mark.parametrize("inp,num",
+ [("'\\uD7FF'", 0),
+ ("'\\uD800'", 1),
+ ("'\\uDBFF'", 1),
+ ("'\\uDC00'", 1),
+ ("'\\uDFFF'", 1),
+ ("'\\uE000'", 0),
+ ("'\\uD800\\uD800\\uD800'", 3),
+ ("'a\\uD800a\\uD800a\\uD800a'", 3),
+ ("'\\uDFFF\\uDBFF'", 2),
+ pytest.param(
+ "'\\uDBFF\\uDFFF'", 2,
+ marks=pytest.mark.skipif(
+ sys.maxunicode == 0xFFFF,
+ reason="narrow Python"))])
+def test_invalid_codepoints_surrogates(inp, num):
+ inp = eval(inp) # pylint:disable=eval-used
+ fp = StringIO(inp)
+ if ord(max(fp.read())) > 0xFFFF:
+ pytest.skip("StringIO altered string")
+ fp.seek(0)
+ stream = HTMLUnicodeInputStream(fp)
+ for _i in range(len(inp)):
+ stream.char()
+ assert len(stream.errors) == num
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_tokenizer2.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_tokenizer2.py
new file mode 100644
index 0000000000..158d847a26
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_tokenizer2.py
@@ -0,0 +1,66 @@
+from __future__ import absolute_import, division, unicode_literals
+
+import io
+
+from six import unichr, text_type
+
+from html5lib._tokenizer import HTMLTokenizer
+from html5lib.constants import tokenTypes
+
+
+def ignore_parse_errors(toks):
+ for tok in toks:
+ if tok['type'] != tokenTypes['ParseError']:
+ yield tok
+
+
+def test_maintain_attribute_order():
+ # generate loads to maximize the chance a hash-based mutation will occur
+ attrs = [(unichr(x), text_type(i)) for i, x in enumerate(range(ord('a'), ord('z')))]
+ stream = io.StringIO("<span " + " ".join("%s='%s'" % (x, i) for x, i in attrs) + ">")
+
+ toks = HTMLTokenizer(stream)
+ out = list(ignore_parse_errors(toks))
+
+ assert len(out) == 1
+ assert out[0]['type'] == tokenTypes['StartTag']
+
+ attrs_tok = out[0]['data']
+ assert len(attrs_tok) == len(attrs)
+
+ for (in_name, in_value), (out_name, out_value) in zip(attrs, attrs_tok.items()):
+ assert in_name == out_name
+ assert in_value == out_value
+
+
+def test_duplicate_attribute():
+ stream = io.StringIO("<span a=1 a=2 a=3>")
+
+ toks = HTMLTokenizer(stream)
+ out = list(ignore_parse_errors(toks))
+
+ assert len(out) == 1
+ assert out[0]['type'] == tokenTypes['StartTag']
+
+ attrs_tok = out[0]['data']
+ assert len(attrs_tok) == 1
+ assert list(attrs_tok.items()) == [('a', '1')]
+
+
+def test_maintain_duplicate_attribute_order():
+ # generate loads to maximize the chance a hash-based mutation will occur
+ attrs = [(unichr(x), text_type(i)) for i, x in enumerate(range(ord('a'), ord('z')))]
+ stream = io.StringIO("<span " + " ".join("%s='%s'" % (x, i) for x, i in attrs) + " a=100>")
+
+ toks = HTMLTokenizer(stream)
+ out = list(ignore_parse_errors(toks))
+
+ assert len(out) == 1
+ assert out[0]['type'] == tokenTypes['StartTag']
+
+ attrs_tok = out[0]['data']
+ assert len(attrs_tok) == len(attrs)
+
+ for (in_name, in_value), (out_name, out_value) in zip(attrs, attrs_tok.items()):
+ assert in_name == out_name
+ assert in_value == out_value
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_treeadapters.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_treeadapters.py
new file mode 100644
index 0000000000..95e56c00c9
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_treeadapters.py
@@ -0,0 +1,40 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from . import support # noqa
+
+import html5lib
+from html5lib.treeadapters import sax
+from html5lib.treewalkers import getTreeWalker
+
+
+def test_to_sax():
+ handler = support.TracingSaxHandler()
+ tree = html5lib.parse("""<html xml:lang="en">
+ <title>Directory Listing</title>
+ <a href="/"><b/></p>
+ """, treebuilder="etree")
+ walker = getTreeWalker("etree")
+ sax.to_sax(walker(tree), handler)
+ expected = [
+ 'startDocument',
+ ('startElementNS', ('http://www.w3.org/1999/xhtml', 'html'),
+ 'html', {(None, 'xml:lang'): 'en'}),
+ ('startElementNS', ('http://www.w3.org/1999/xhtml', 'head'), 'head', {}),
+ ('startElementNS', ('http://www.w3.org/1999/xhtml', 'title'), 'title', {}),
+ ('characters', 'Directory Listing'),
+ ('endElementNS', ('http://www.w3.org/1999/xhtml', 'title'), 'title'),
+ ('characters', '\n '),
+ ('endElementNS', ('http://www.w3.org/1999/xhtml', 'head'), 'head'),
+ ('startElementNS', ('http://www.w3.org/1999/xhtml', 'body'), 'body', {}),
+ ('startElementNS', ('http://www.w3.org/1999/xhtml', 'a'), 'a', {(None, 'href'): '/'}),
+ ('startElementNS', ('http://www.w3.org/1999/xhtml', 'b'), 'b', {}),
+ ('startElementNS', ('http://www.w3.org/1999/xhtml', 'p'), 'p', {}),
+ ('endElementNS', ('http://www.w3.org/1999/xhtml', 'p'), 'p'),
+ ('characters', '\n '),
+ ('endElementNS', ('http://www.w3.org/1999/xhtml', 'b'), 'b'),
+ ('endElementNS', ('http://www.w3.org/1999/xhtml', 'a'), 'a'),
+ ('endElementNS', ('http://www.w3.org/1999/xhtml', 'body'), 'body'),
+ ('endElementNS', ('http://www.w3.org/1999/xhtml', 'html'), 'html'),
+ 'endDocument',
+ ]
+ assert expected == handler.visited
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_treewalkers.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_treewalkers.py
new file mode 100644
index 0000000000..780ca964ba
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_treewalkers.py
@@ -0,0 +1,205 @@
+from __future__ import absolute_import, division, unicode_literals
+
+import itertools
+import sys
+
+from six import unichr, text_type
+import pytest
+
+try:
+ import lxml.etree
+except ImportError:
+ pass
+
+from .support import treeTypes
+
+from html5lib import html5parser, treewalkers
+from html5lib.filters.lint import Filter as Lint
+
+import re
+attrlist = re.compile(r"^(\s+)\w+=.*(\n\1\w+=.*)+", re.M)
+
+
+def sortattrs(x):
+ lines = x.group(0).split("\n")
+ lines.sort()
+ return "\n".join(lines)
+
+
+def test_all_tokens():
+ expected = [
+ {'data': {}, 'type': 'StartTag', 'namespace': 'http://www.w3.org/1999/xhtml', 'name': 'html'},
+ {'data': {}, 'type': 'StartTag', 'namespace': 'http://www.w3.org/1999/xhtml', 'name': 'head'},
+ {'type': 'EndTag', 'namespace': 'http://www.w3.org/1999/xhtml', 'name': 'head'},
+ {'data': {}, 'type': 'StartTag', 'namespace': 'http://www.w3.org/1999/xhtml', 'name': 'body'},
+ {'data': 'a', 'type': 'Characters'},
+ {'data': {}, 'type': 'StartTag', 'namespace': 'http://www.w3.org/1999/xhtml', 'name': 'div'},
+ {'data': 'b', 'type': 'Characters'},
+ {'type': 'EndTag', 'namespace': 'http://www.w3.org/1999/xhtml', 'name': 'div'},
+ {'data': 'c', 'type': 'Characters'},
+ {'type': 'EndTag', 'namespace': 'http://www.w3.org/1999/xhtml', 'name': 'body'},
+ {'type': 'EndTag', 'namespace': 'http://www.w3.org/1999/xhtml', 'name': 'html'}
+ ]
+ for _, treeCls in sorted(treeTypes.items()):
+ if treeCls is None:
+ continue
+ p = html5parser.HTMLParser(tree=treeCls["builder"])
+ document = p.parse("<html><head></head><body>a<div>b</div>c</body></html>")
+ document = treeCls.get("adapter", lambda x: x)(document)
+ output = Lint(treeCls["walker"](document))
+ for expectedToken, outputToken in zip(expected, output):
+ assert expectedToken == outputToken
+
+
+def set_attribute_on_first_child(docfrag, name, value, treeName):
+ """naively sets an attribute on the first child of the document
+ fragment passed in"""
+ setter = {'ElementTree': lambda d: d[0].set,
+ 'DOM': lambda d: d.firstChild.setAttribute}
+ setter['cElementTree'] = setter['ElementTree']
+ try:
+ setter.get(treeName, setter['DOM'])(docfrag)(name, value)
+ except AttributeError:
+ setter['ElementTree'](docfrag)(name, value)
+
+
+def param_treewalker_six_mix():
+ """Str/Unicode mix. If str attrs added to tree"""
+
+ # On Python 2.x string literals are of type str. Unless, like this
+ # file, the programmer imports unicode_literals from __future__.
+ # In that case, string literals become objects of type unicode.
+
+ # This test simulates a Py2 user, modifying attributes on a document
+ # fragment but not using the u'' syntax nor importing unicode_literals
+ sm_tests = [
+ ('<a href="http://example.com">Example</a>',
+ [(str('class'), str('test123'))],
+ '<a>\n class="test123"\n href="http://example.com"\n "Example"'),
+
+ ('<link href="http://example.com/cow">',
+ [(str('rel'), str('alternate'))],
+ '<link>\n href="http://example.com/cow"\n rel="alternate"\n "Example"')
+ ]
+
+ for tree in sorted(treeTypes.items()):
+ for intext, attrs, expected in sm_tests:
+ yield intext, expected, attrs, tree
+
+
+@pytest.mark.parametrize("intext, expected, attrs_to_add, tree", param_treewalker_six_mix())
+def test_treewalker_six_mix(intext, expected, attrs_to_add, tree):
+ """tests what happens when we add attributes to the intext"""
+ treeName, treeClass = tree
+ if treeClass is None:
+ pytest.skip("Treebuilder not loaded")
+ parser = html5parser.HTMLParser(tree=treeClass["builder"])
+ document = parser.parseFragment(intext)
+ for nom, val in attrs_to_add:
+ set_attribute_on_first_child(document, nom, val, treeName)
+
+ document = treeClass.get("adapter", lambda x: x)(document)
+ output = treewalkers.pprint(treeClass["walker"](document))
+ output = attrlist.sub(sortattrs, output)
+ if output not in expected:
+ raise AssertionError("TreewalkerEditTest: %s\nExpected:\n%s\nReceived:\n%s" % (treeName, expected, output))
+
+
+@pytest.mark.parametrize("tree,char", itertools.product(sorted(treeTypes.items()), ["x", "\u1234"]))
+def test_fragment_single_char(tree, char):
+ expected = [
+ {'data': char, 'type': 'Characters'}
+ ]
+
+ treeName, treeClass = tree
+ if treeClass is None:
+ pytest.skip("Treebuilder not loaded")
+
+ parser = html5parser.HTMLParser(tree=treeClass["builder"])
+ document = parser.parseFragment(char)
+ document = treeClass.get("adapter", lambda x: x)(document)
+ output = Lint(treeClass["walker"](document))
+
+ assert list(output) == expected
+
+
+@pytest.mark.skipif(treeTypes["lxml"] is None, reason="lxml not importable")
+def test_lxml_xml():
+ expected = [
+ {'data': {}, 'name': 'div', 'namespace': None, 'type': 'StartTag'},
+ {'data': {}, 'name': 'div', 'namespace': None, 'type': 'StartTag'},
+ {'name': 'div', 'namespace': None, 'type': 'EndTag'},
+ {'name': 'div', 'namespace': None, 'type': 'EndTag'}
+ ]
+
+ lxmltree = lxml.etree.fromstring('<div><div></div></div>')
+ walker = treewalkers.getTreeWalker('lxml')
+ output = Lint(walker(lxmltree))
+
+ assert list(output) == expected
+
+
+@pytest.mark.parametrize("treeName",
+ [pytest.param(treeName, marks=[getattr(pytest.mark, treeName),
+ pytest.mark.skipif(
+ treeName != "lxml" or
+ sys.version_info < (3, 7), reason="dict order undef")])
+ for treeName in sorted(treeTypes.keys())])
+def test_maintain_attribute_order(treeName):
+ treeAPIs = treeTypes[treeName]
+ if treeAPIs is None:
+ pytest.skip("Treebuilder not loaded")
+
+ # generate loads to maximize the chance a hash-based mutation will occur
+ attrs = [(unichr(x), text_type(i)) for i, x in enumerate(range(ord('a'), ord('z')))]
+ data = "<span " + " ".join("%s='%s'" % (x, i) for x, i in attrs) + ">"
+
+ parser = html5parser.HTMLParser(tree=treeAPIs["builder"])
+ document = parser.parseFragment(data)
+
+ document = treeAPIs.get("adapter", lambda x: x)(document)
+ output = list(Lint(treeAPIs["walker"](document)))
+
+ assert len(output) == 2
+ assert output[0]['type'] == 'StartTag'
+ assert output[1]['type'] == "EndTag"
+
+ attrs_out = output[0]['data']
+ assert len(attrs) == len(attrs_out)
+
+ for (in_name, in_value), (out_name, out_value) in zip(attrs, attrs_out.items()):
+ assert (None, in_name) == out_name
+ assert in_value == out_value
+
+
+@pytest.mark.parametrize("treeName",
+ [pytest.param(treeName, marks=[getattr(pytest.mark, treeName),
+ pytest.mark.skipif(
+ treeName != "lxml" or
+ sys.version_info < (3, 7), reason="dict order undef")])
+ for treeName in sorted(treeTypes.keys())])
+def test_maintain_attribute_order_adjusted(treeName):
+ treeAPIs = treeTypes[treeName]
+ if treeAPIs is None:
+ pytest.skip("Treebuilder not loaded")
+
+ # generate loads to maximize the chance a hash-based mutation will occur
+ data = "<svg a=1 refx=2 b=3 xml:lang=4 c=5>"
+
+ parser = html5parser.HTMLParser(tree=treeAPIs["builder"])
+ document = parser.parseFragment(data)
+
+ document = treeAPIs.get("adapter", lambda x: x)(document)
+ output = list(Lint(treeAPIs["walker"](document)))
+
+ assert len(output) == 2
+ assert output[0]['type'] == 'StartTag'
+ assert output[1]['type'] == "EndTag"
+
+ attrs_out = output[0]['data']
+
+ assert list(attrs_out.items()) == [((None, 'a'), '1'),
+ ((None, 'refX'), '2'),
+ ((None, 'b'), '3'),
+ (('http://www.w3.org/XML/1998/namespace', 'lang'), '4'),
+ ((None, 'c'), '5')]
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_whitespace_filter.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_whitespace_filter.py
new file mode 100644
index 0000000000..e9da6140a9
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/test_whitespace_filter.py
@@ -0,0 +1,125 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from html5lib.filters.whitespace import Filter
+from html5lib.constants import spaceCharacters
+spaceCharacters = "".join(spaceCharacters)
+
+
+def runTest(input, expected):
+ output = list(Filter(input))
+ errorMsg = "\n".join(["\n\nInput:", str(input),
+ "\nExpected:", str(expected),
+ "\nReceived:", str(output)])
+ assert expected == output, errorMsg
+
+
+def runTestUnmodifiedOutput(input):
+ runTest(input, input)
+
+
+def testPhrasingElements():
+ runTestUnmodifiedOutput(
+ [{"type": "Characters", "data": "This is a "},
+ {"type": "StartTag", "name": "span", "data": []},
+ {"type": "Characters", "data": "phrase"},
+ {"type": "EndTag", "name": "span", "data": []},
+ {"type": "SpaceCharacters", "data": " "},
+ {"type": "Characters", "data": "with"},
+ {"type": "SpaceCharacters", "data": " "},
+ {"type": "StartTag", "name": "em", "data": []},
+ {"type": "Characters", "data": "emphasised text"},
+ {"type": "EndTag", "name": "em", "data": []},
+ {"type": "Characters", "data": " and an "},
+ {"type": "StartTag", "name": "img", "data": [["alt", "image"]]},
+ {"type": "Characters", "data": "."}])
+
+
+def testLeadingWhitespace():
+ runTest(
+ [{"type": "StartTag", "name": "p", "data": []},
+ {"type": "SpaceCharacters", "data": spaceCharacters},
+ {"type": "Characters", "data": "foo"},
+ {"type": "EndTag", "name": "p", "data": []}],
+ [{"type": "StartTag", "name": "p", "data": []},
+ {"type": "SpaceCharacters", "data": " "},
+ {"type": "Characters", "data": "foo"},
+ {"type": "EndTag", "name": "p", "data": []}])
+
+
+def testLeadingWhitespaceAsCharacters():
+ runTest(
+ [{"type": "StartTag", "name": "p", "data": []},
+ {"type": "Characters", "data": spaceCharacters + "foo"},
+ {"type": "EndTag", "name": "p", "data": []}],
+ [{"type": "StartTag", "name": "p", "data": []},
+ {"type": "Characters", "data": " foo"},
+ {"type": "EndTag", "name": "p", "data": []}])
+
+
+def testTrailingWhitespace():
+ runTest(
+ [{"type": "StartTag", "name": "p", "data": []},
+ {"type": "Characters", "data": "foo"},
+ {"type": "SpaceCharacters", "data": spaceCharacters},
+ {"type": "EndTag", "name": "p", "data": []}],
+ [{"type": "StartTag", "name": "p", "data": []},
+ {"type": "Characters", "data": "foo"},
+ {"type": "SpaceCharacters", "data": " "},
+ {"type": "EndTag", "name": "p", "data": []}])
+
+
+def testTrailingWhitespaceAsCharacters():
+ runTest(
+ [{"type": "StartTag", "name": "p", "data": []},
+ {"type": "Characters", "data": "foo" + spaceCharacters},
+ {"type": "EndTag", "name": "p", "data": []}],
+ [{"type": "StartTag", "name": "p", "data": []},
+ {"type": "Characters", "data": "foo "},
+ {"type": "EndTag", "name": "p", "data": []}])
+
+
+def testWhitespace():
+ runTest(
+ [{"type": "StartTag", "name": "p", "data": []},
+ {"type": "Characters", "data": "foo" + spaceCharacters + "bar"},
+ {"type": "EndTag", "name": "p", "data": []}],
+ [{"type": "StartTag", "name": "p", "data": []},
+ {"type": "Characters", "data": "foo bar"},
+ {"type": "EndTag", "name": "p", "data": []}])
+
+
+def testLeadingWhitespaceInPre():
+ runTestUnmodifiedOutput(
+ [{"type": "StartTag", "name": "pre", "data": []},
+ {"type": "SpaceCharacters", "data": spaceCharacters},
+ {"type": "Characters", "data": "foo"},
+ {"type": "EndTag", "name": "pre", "data": []}])
+
+
+def testLeadingWhitespaceAsCharactersInPre():
+ runTestUnmodifiedOutput(
+ [{"type": "StartTag", "name": "pre", "data": []},
+ {"type": "Characters", "data": spaceCharacters + "foo"},
+ {"type": "EndTag", "name": "pre", "data": []}])
+
+
+def testTrailingWhitespaceInPre():
+ runTestUnmodifiedOutput(
+ [{"type": "StartTag", "name": "pre", "data": []},
+ {"type": "Characters", "data": "foo"},
+ {"type": "SpaceCharacters", "data": spaceCharacters},
+ {"type": "EndTag", "name": "pre", "data": []}])
+
+
+def testTrailingWhitespaceAsCharactersInPre():
+ runTestUnmodifiedOutput(
+ [{"type": "StartTag", "name": "pre", "data": []},
+ {"type": "Characters", "data": "foo" + spaceCharacters},
+ {"type": "EndTag", "name": "pre", "data": []}])
+
+
+def testWhitespaceInPre():
+ runTestUnmodifiedOutput(
+ [{"type": "StartTag", "name": "pre", "data": []},
+ {"type": "Characters", "data": "foo" + spaceCharacters + "bar"},
+ {"type": "EndTag", "name": "pre", "data": []}])
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/tokenizer.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/tokenizer.py
new file mode 100644
index 0000000000..47264cc325
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/tokenizer.py
@@ -0,0 +1,253 @@
+from __future__ import absolute_import, division, unicode_literals
+
+import codecs
+import json
+import warnings
+import re
+
+import pytest
+from six import unichr
+
+from html5lib._tokenizer import HTMLTokenizer
+from html5lib import constants, _utils
+
+
+class TokenizerTestParser(object):
+ def __init__(self, initialState, lastStartTag=None):
+ self.tokenizer = HTMLTokenizer
+ self._state = initialState
+ self._lastStartTag = lastStartTag
+
+ def parse(self, stream, encoding=None, innerHTML=False):
+ # pylint:disable=unused-argument
+ tokenizer = self.tokenizer(stream, encoding)
+ self.outputTokens = []
+
+ tokenizer.state = getattr(tokenizer, self._state)
+ if self._lastStartTag is not None:
+ tokenizer.currentToken = {"type": "startTag",
+ "name": self._lastStartTag}
+
+ types = {v: k for k, v in constants.tokenTypes.items()}
+ for token in tokenizer:
+ getattr(self, 'process%s' % types[token["type"]])(token)
+
+ return self.outputTokens
+
+ def processDoctype(self, token):
+ self.outputTokens.append(["DOCTYPE", token["name"], token["publicId"],
+ token["systemId"], token["correct"]])
+
+ def processStartTag(self, token):
+ self.outputTokens.append(["StartTag", token["name"],
+ token["data"], token["selfClosing"]])
+
+ def processEmptyTag(self, token):
+ if token["name"] not in constants.voidElements:
+ self.outputTokens.append("ParseError")
+ self.outputTokens.append(["StartTag", token["name"], dict(token["data"][::-1])])
+
+ def processEndTag(self, token):
+ self.outputTokens.append(["EndTag", token["name"],
+ token["selfClosing"]])
+
+ def processComment(self, token):
+ self.outputTokens.append(["Comment", token["data"]])
+
+ def processSpaceCharacters(self, token):
+ self.outputTokens.append(["Character", token["data"]])
+ self.processSpaceCharacters = self.processCharacters
+
+ def processCharacters(self, token):
+ self.outputTokens.append(["Character", token["data"]])
+
+ def processEOF(self, token):
+ pass
+
+ def processParseError(self, token):
+ self.outputTokens.append(["ParseError", token["data"]])
+
+
+def concatenateCharacterTokens(tokens):
+ outputTokens = []
+ for token in tokens:
+ if "ParseError" not in token and token[0] == "Character":
+ if (outputTokens and "ParseError" not in outputTokens[-1] and
+ outputTokens[-1][0] == "Character"):
+ outputTokens[-1][1] += token[1]
+ else:
+ outputTokens.append(token)
+ else:
+ outputTokens.append(token)
+ return outputTokens
+
+
+def normalizeTokens(tokens):
+ # TODO: convert tests to reflect arrays
+ for i, token in enumerate(tokens):
+ if token[0] == 'ParseError':
+ tokens[i] = token[0]
+ return tokens
+
+
+def tokensMatch(expectedTokens, receivedTokens, ignoreErrorOrder,
+ ignoreErrors=False):
+ """Test whether the test has passed or failed
+
+ If the ignoreErrorOrder flag is set to true we don't test the relative
+ positions of parse errors and non parse errors
+ """
+ checkSelfClosing = False
+ for token in expectedTokens:
+ if (token[0] == "StartTag" and len(token) == 4 or
+ token[0] == "EndTag" and len(token) == 3):
+ checkSelfClosing = True
+ break
+
+ if not checkSelfClosing:
+ for token in receivedTokens:
+ if token[0] == "StartTag" or token[0] == "EndTag":
+ token.pop()
+
+ if not ignoreErrorOrder and not ignoreErrors:
+ expectedTokens = concatenateCharacterTokens(expectedTokens)
+ return expectedTokens == receivedTokens
+ else:
+ # Sort the tokens into two groups; non-parse errors and parse errors
+ tokens = {"expected": [[], []], "received": [[], []]}
+ for tokenType, tokenList in zip(list(tokens.keys()),
+ (expectedTokens, receivedTokens)):
+ for token in tokenList:
+ if token != "ParseError":
+ tokens[tokenType][0].append(token)
+ else:
+ if not ignoreErrors:
+ tokens[tokenType][1].append(token)
+ tokens[tokenType][0] = concatenateCharacterTokens(tokens[tokenType][0])
+ return tokens["expected"] == tokens["received"]
+
+
+_surrogateRe = re.compile(r"\\u([0-9A-Fa-f]{4})(?:\\u([0-9A-Fa-f]{4}))?")
+
+
+def unescape(test):
+ def decode(inp):
+ """Decode \\uXXXX escapes
+
+ This decodes \\uXXXX escapes, possibly into non-BMP characters when
+ two surrogate character escapes are adjacent to each other.
+ """
+ # This cannot be implemented using the unicode_escape codec
+ # because that requires its input be ISO-8859-1, and we need
+ # arbitrary unicode as input.
+ def repl(m):
+ if m.group(2) is not None:
+ high = int(m.group(1), 16)
+ low = int(m.group(2), 16)
+ if 0xD800 <= high <= 0xDBFF and 0xDC00 <= low <= 0xDFFF:
+ cp = ((high - 0xD800) << 10) + (low - 0xDC00) + 0x10000
+ return unichr(cp)
+ else:
+ return unichr(high) + unichr(low)
+ else:
+ return unichr(int(m.group(1), 16))
+ try:
+ return _surrogateRe.sub(repl, inp)
+ except ValueError:
+ # This occurs when unichr throws ValueError, which should
+ # only be for a lone-surrogate.
+ if _utils.supports_lone_surrogates:
+ raise
+ return None
+
+ test["input"] = decode(test["input"])
+ for token in test["output"]:
+ if token == "ParseError":
+ continue
+ else:
+ token[1] = decode(token[1])
+ if len(token) > 2:
+ for key, value in token[2]:
+ del token[2][key]
+ token[2][decode(key)] = decode(value)
+ return test
+
+
+def _doCapitalize(match):
+ return match.group(1).upper()
+
+
+_capitalizeRe = re.compile(r"\W+(\w)").sub
+
+
+def capitalize(s):
+ s = s.lower()
+ s = _capitalizeRe(_doCapitalize, s)
+ return s
+
+
+class TokenizerFile(pytest.File):
+ def collect(self):
+ with codecs.open(str(self.fspath), "r", encoding="utf-8") as fp:
+ tests = json.load(fp)
+ if 'tests' in tests:
+ for i, test in enumerate(tests['tests']):
+ yield TokenizerTestCollector(str(i), self, testdata=test)
+
+
+class TokenizerTestCollector(pytest.Collector):
+ def __init__(self, name, parent=None, config=None, session=None, testdata=None):
+ super(TokenizerTestCollector, self).__init__(name, parent, config, session)
+ if 'initialStates' not in testdata:
+ testdata["initialStates"] = ["Data state"]
+ if 'doubleEscaped' in testdata:
+ testdata = unescape(testdata)
+ self.testdata = testdata
+
+ def collect(self):
+ for initialState in self.testdata["initialStates"]:
+ initialState = capitalize(initialState)
+ item = TokenizerTest(initialState,
+ self,
+ self.testdata,
+ initialState)
+ if self.testdata["input"] is None:
+ item.add_marker(pytest.mark.skipif(True, reason="Relies on lone surrogates"))
+ yield item
+
+
+class TokenizerTest(pytest.Item):
+ def __init__(self, name, parent, test, initialState):
+ super(TokenizerTest, self).__init__(name, parent)
+ self.obj = lambda: 1 # this is to hack around skipif needing a function!
+ self.test = test
+ self.initialState = initialState
+
+ def runtest(self):
+ warnings.resetwarnings()
+ warnings.simplefilter("error")
+
+ expected = self.test['output']
+ if 'lastStartTag' not in self.test:
+ self.test['lastStartTag'] = None
+ parser = TokenizerTestParser(self.initialState,
+ self.test['lastStartTag'])
+ tokens = parser.parse(self.test['input'])
+ received = normalizeTokens(tokens)
+ errorMsg = "\n".join(["\n\nInitial state:",
+ self.initialState,
+ "\nInput:", self.test['input'],
+ "\nExpected:", repr(expected),
+ "\nreceived:", repr(tokens)])
+ errorMsg = errorMsg
+ ignoreErrorOrder = self.test.get('ignoreErrorOrder', False)
+ assert tokensMatch(expected, received, ignoreErrorOrder, True), errorMsg
+
+ def repr_failure(self, excinfo):
+ traceback = excinfo.traceback
+ ntraceback = traceback.cut(path=__file__)
+ excinfo.traceback = ntraceback.filter()
+
+ return excinfo.getrepr(funcargs=True,
+ showlocals=False,
+ style="short", tbfilter=False)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/tokenizertotree.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/tokenizertotree.py
new file mode 100644
index 0000000000..8528e8766a
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/tokenizertotree.py
@@ -0,0 +1,69 @@
+from __future__ import absolute_import, division, unicode_literals
+
+import sys
+import os
+import json
+import re
+
+import html5lib
+from . import support
+from . import test_tokenizer
+
+p = html5lib.HTMLParser()
+
+unnamespaceExpected = re.compile(r"^(\|\s*)<html ([^>]+)>", re.M).sub
+
+
+def main(out_path):
+ if not os.path.exists(out_path):
+ sys.stderr.write("Path %s does not exist" % out_path)
+ sys.exit(1)
+
+ for filename in support.get_data_files('tokenizer', '*.test'):
+ run_file(filename, out_path)
+
+
+def run_file(filename, out_path):
+ try:
+ tests_data = json.load(open(filename, "r"))
+ except ValueError:
+ sys.stderr.write("Failed to load %s\n" % filename)
+ return
+ name = os.path.splitext(os.path.split(filename)[1])[0]
+ output_file = open(os.path.join(out_path, "tokenizer_%s.dat" % name), "w")
+
+ if 'tests' in tests_data:
+ for test_data in tests_data['tests']:
+ if 'initialStates' not in test_data:
+ test_data["initialStates"] = ["Data state"]
+
+ for initial_state in test_data["initialStates"]:
+ if initial_state != "Data state":
+ # don't support this yet
+ continue
+ test = make_test(test_data)
+ output_file.write(test)
+
+ output_file.close()
+
+
+def make_test(test_data):
+ if 'doubleEscaped' in test_data:
+ test_data = test_tokenizer.unescape_test(test_data)
+
+ rv = []
+ rv.append("#data")
+ rv.append(test_data["input"].encode("utf8"))
+ rv.append("#errors")
+ tree = p.parse(test_data["input"])
+ output = p.tree.testSerializer(tree)
+ output = "\n".join(("| " + line[3:]) if line.startswith("| ") else line
+ for line in output.split("\n"))
+ output = unnamespaceExpected(r"\1<\2>", output)
+ rv.append(output.encode("utf8"))
+ rv.append("")
+ return "\n".join(rv)
+
+
+if __name__ == "__main__":
+ main(sys.argv[1])
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/tree_construction.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/tree_construction.py
new file mode 100644
index 0000000000..1ef6e7250c
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/tree_construction.py
@@ -0,0 +1,205 @@
+from __future__ import absolute_import, division, unicode_literals
+
+import itertools
+import re
+import warnings
+from difflib import unified_diff
+
+import pytest
+
+from .support import TestData, convert, convertExpected, treeTypes
+from html5lib import html5parser, constants, treewalkers
+from html5lib.filters.lint import Filter as Lint
+
+_attrlist_re = re.compile(r"^(\s+)\w+=.*(\n\1\w+=.*)+", re.M)
+
+
+def sortattrs(s):
+ def replace(m):
+ lines = m.group(0).split("\n")
+ lines.sort()
+ return "\n".join(lines)
+ return _attrlist_re.sub(replace, s)
+
+
+class TreeConstructionFile(pytest.File):
+ def collect(self):
+ tests = TestData(str(self.fspath), "data")
+ for i, test in enumerate(tests):
+ yield TreeConstructionTest(str(i), self, testdata=test)
+
+
+class TreeConstructionTest(pytest.Collector):
+ def __init__(self, name, parent=None, config=None, session=None, testdata=None):
+ super(TreeConstructionTest, self).__init__(name, parent, config, session)
+ self.testdata = testdata
+
+ def collect(self):
+ for treeName, treeAPIs in sorted(treeTypes.items()):
+ for x in itertools.chain(self._getParserTests(treeName, treeAPIs),
+ self._getTreeWalkerTests(treeName, treeAPIs)):
+ yield x
+
+ def _getParserTests(self, treeName, treeAPIs):
+ if treeAPIs is not None and "adapter" in treeAPIs:
+ return
+ for namespaceHTMLElements in (True, False):
+ if namespaceHTMLElements:
+ nodeid = "%s::parser::namespaced" % treeName
+ else:
+ nodeid = "%s::parser::void-namespace" % treeName
+ item = ParserTest(nodeid,
+ self,
+ self.testdata,
+ treeAPIs["builder"] if treeAPIs is not None else None,
+ namespaceHTMLElements)
+ item.add_marker(getattr(pytest.mark, treeName))
+ item.add_marker(pytest.mark.parser)
+ if namespaceHTMLElements:
+ item.add_marker(pytest.mark.namespaced)
+ yield item
+
+ def _getTreeWalkerTests(self, treeName, treeAPIs):
+ nodeid = "%s::treewalker" % treeName
+ item = TreeWalkerTest(nodeid,
+ self,
+ self.testdata,
+ treeAPIs)
+ item.add_marker(getattr(pytest.mark, treeName))
+ item.add_marker(pytest.mark.treewalker)
+ yield item
+
+
+def convertTreeDump(data):
+ return "\n".join(convert(3)(data).split("\n")[1:])
+
+
+namespaceExpected = re.compile(r"^(\s*)<(\S+)>", re.M).sub
+
+
+class ParserTest(pytest.Item):
+ def __init__(self, name, parent, test, treeClass, namespaceHTMLElements):
+ super(ParserTest, self).__init__(name, parent)
+ self.test = test
+ self.treeClass = treeClass
+ self.namespaceHTMLElements = namespaceHTMLElements
+
+ def runtest(self):
+ if self.treeClass is None:
+ pytest.skip("Treebuilder not loaded")
+
+ p = html5parser.HTMLParser(tree=self.treeClass,
+ namespaceHTMLElements=self.namespaceHTMLElements)
+
+ input = self.test['data']
+ fragmentContainer = self.test['document-fragment']
+ expected = convertExpected(self.test['document'])
+ expectedErrors = self.test['errors'].split("\n") if self.test['errors'] else []
+
+ scripting = False
+ if 'script-on' in self.test:
+ scripting = True
+
+ with warnings.catch_warnings():
+ warnings.simplefilter("error")
+ try:
+ if fragmentContainer:
+ document = p.parseFragment(input, fragmentContainer, scripting=scripting)
+ else:
+ document = p.parse(input, scripting=scripting)
+ except constants.DataLossWarning:
+ pytest.skip("data loss warning")
+
+ output = convertTreeDump(p.tree.testSerializer(document))
+
+ expected = expected
+ if self.namespaceHTMLElements:
+ expected = namespaceExpected(r"\1<html \2>", expected)
+
+ errorMsg = "\n".join(["\n\nInput:", input, "\nExpected:", expected,
+ "\nReceived:", output])
+ assert expected == output, errorMsg
+
+ errStr = []
+ for (line, col), errorcode, datavars in p.errors:
+ assert isinstance(datavars, dict), "%s, %s" % (errorcode, repr(datavars))
+ errStr.append("Line: %i Col: %i %s" % (line, col,
+ constants.E[errorcode] % datavars))
+
+ errorMsg2 = "\n".join(["\n\nInput:", input,
+ "\nExpected errors (" + str(len(expectedErrors)) + "):\n" + "\n".join(expectedErrors),
+ "\nActual errors (" + str(len(p.errors)) + "):\n" + "\n".join(errStr)])
+ if False: # we're currently not testing parse errors
+ assert len(p.errors) == len(expectedErrors), errorMsg2
+
+ def repr_failure(self, excinfo):
+ traceback = excinfo.traceback
+ ntraceback = traceback.cut(path=__file__)
+ excinfo.traceback = ntraceback.filter()
+
+ return excinfo.getrepr(funcargs=True,
+ showlocals=False,
+ style="short", tbfilter=False)
+
+
+class TreeWalkerTest(pytest.Item):
+ def __init__(self, name, parent, test, treeAPIs):
+ super(TreeWalkerTest, self).__init__(name, parent)
+ self.test = test
+ self.treeAPIs = treeAPIs
+
+ def runtest(self):
+ if self.treeAPIs is None:
+ pytest.skip("Treebuilder not loaded")
+
+ p = html5parser.HTMLParser(tree=self.treeAPIs["builder"])
+
+ input = self.test['data']
+ fragmentContainer = self.test['document-fragment']
+ expected = convertExpected(self.test['document'])
+
+ scripting = False
+ if 'script-on' in self.test:
+ scripting = True
+
+ with warnings.catch_warnings():
+ warnings.simplefilter("error")
+ try:
+ if fragmentContainer:
+ document = p.parseFragment(input, fragmentContainer, scripting=scripting)
+ else:
+ document = p.parse(input, scripting=scripting)
+ except constants.DataLossWarning:
+ pytest.skip("data loss warning")
+
+ poutput = convertTreeDump(p.tree.testSerializer(document))
+ namespace_expected = namespaceExpected(r"\1<html \2>", expected)
+ if poutput != namespace_expected:
+ pytest.skip("parser output incorrect")
+
+ document = self.treeAPIs.get("adapter", lambda x: x)(document)
+
+ try:
+ output = treewalkers.pprint(Lint(self.treeAPIs["walker"](document)))
+ output = sortattrs(output)
+ expected = sortattrs(expected)
+ diff = "".join(unified_diff([line + "\n" for line in expected.splitlines()],
+ [line + "\n" for line in output.splitlines()],
+ "Expected", "Received"))
+ assert expected == output, "\n".join([
+ "", "Input:", input,
+ "", "Expected:", expected,
+ "", "Received:", output,
+ "", "Diff:", diff,
+ ])
+ except NotImplementedError:
+ pytest.skip("tree walker NotImplementedError")
+
+ def repr_failure(self, excinfo):
+ traceback = excinfo.traceback
+ ntraceback = traceback.cut(path=__file__)
+ excinfo.traceback = ntraceback.filter()
+
+ return excinfo.getrepr(funcargs=True,
+ showlocals=False,
+ style="short", tbfilter=False)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/us-ascii.html b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/us-ascii.html
new file mode 100644
index 0000000000..728cb6baf9
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/us-ascii.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<title>Test</title>
+<p>Hello World! \ No newline at end of file
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/utf-8-bom.html b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/utf-8-bom.html
new file mode 100644
index 0000000000..6ac5efcedf
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/tests/utf-8-bom.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<title>Test</title>
+<p>Hello World! © \ No newline at end of file
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treeadapters/__init__.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treeadapters/__init__.py
new file mode 100644
index 0000000000..dfeb0ba5e1
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treeadapters/__init__.py
@@ -0,0 +1,30 @@
+"""Tree adapters let you convert from one tree structure to another
+
+Example:
+
+.. code-block:: python
+
+ import html5lib
+ from html5lib.treeadapters import genshi
+
+ doc = '<html><body>Hi!</body></html>'
+ treebuilder = html5lib.getTreeBuilder('etree')
+ parser = html5lib.HTMLParser(tree=treebuilder)
+ tree = parser.parse(doc)
+ TreeWalker = html5lib.getTreeWalker('etree')
+
+ genshi_tree = genshi.to_genshi(TreeWalker(tree))
+
+"""
+from __future__ import absolute_import, division, unicode_literals
+
+from . import sax
+
+__all__ = ["sax"]
+
+try:
+ from . import genshi # noqa
+except ImportError:
+ pass
+else:
+ __all__.append("genshi")
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treeadapters/genshi.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treeadapters/genshi.py
new file mode 100644
index 0000000000..61d5fb6ac4
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treeadapters/genshi.py
@@ -0,0 +1,54 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from genshi.core import QName, Attrs
+from genshi.core import START, END, TEXT, COMMENT, DOCTYPE
+
+
+def to_genshi(walker):
+ """Convert a tree to a genshi tree
+
+ :arg walker: the treewalker to use to walk the tree to convert it
+
+ :returns: generator of genshi nodes
+
+ """
+ text = []
+ for token in walker:
+ type = token["type"]
+ if type in ("Characters", "SpaceCharacters"):
+ text.append(token["data"])
+ elif text:
+ yield TEXT, "".join(text), (None, -1, -1)
+ text = []
+
+ if type in ("StartTag", "EmptyTag"):
+ if token["namespace"]:
+ name = "{%s}%s" % (token["namespace"], token["name"])
+ else:
+ name = token["name"]
+ attrs = Attrs([(QName("{%s}%s" % attr if attr[0] is not None else attr[1]), value)
+ for attr, value in token["data"].items()])
+ yield (START, (QName(name), attrs), (None, -1, -1))
+ if type == "EmptyTag":
+ type = "EndTag"
+
+ if type == "EndTag":
+ if token["namespace"]:
+ name = "{%s}%s" % (token["namespace"], token["name"])
+ else:
+ name = token["name"]
+
+ yield END, QName(name), (None, -1, -1)
+
+ elif type == "Comment":
+ yield COMMENT, token["data"], (None, -1, -1)
+
+ elif type == "Doctype":
+ yield DOCTYPE, (token["name"], token["publicId"],
+ token["systemId"]), (None, -1, -1)
+
+ else:
+ pass # FIXME: What to do?
+
+ if text:
+ yield TEXT, "".join(text), (None, -1, -1)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treeadapters/sax.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treeadapters/sax.py
new file mode 100644
index 0000000000..f4ccea5a25
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treeadapters/sax.py
@@ -0,0 +1,50 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from xml.sax.xmlreader import AttributesNSImpl
+
+from ..constants import adjustForeignAttributes, unadjustForeignAttributes
+
+prefix_mapping = {}
+for prefix, localName, namespace in adjustForeignAttributes.values():
+ if prefix is not None:
+ prefix_mapping[prefix] = namespace
+
+
+def to_sax(walker, handler):
+ """Call SAX-like content handler based on treewalker walker
+
+ :arg walker: the treewalker to use to walk the tree to convert it
+
+ :arg handler: SAX handler to use
+
+ """
+ handler.startDocument()
+ for prefix, namespace in prefix_mapping.items():
+ handler.startPrefixMapping(prefix, namespace)
+
+ for token in walker:
+ type = token["type"]
+ if type == "Doctype":
+ continue
+ elif type in ("StartTag", "EmptyTag"):
+ attrs = AttributesNSImpl(token["data"],
+ unadjustForeignAttributes)
+ handler.startElementNS((token["namespace"], token["name"]),
+ token["name"],
+ attrs)
+ if type == "EmptyTag":
+ handler.endElementNS((token["namespace"], token["name"]),
+ token["name"])
+ elif type == "EndTag":
+ handler.endElementNS((token["namespace"], token["name"]),
+ token["name"])
+ elif type in ("Characters", "SpaceCharacters"):
+ handler.characters(token["data"])
+ elif type == "Comment":
+ pass
+ else:
+ assert False, "Unknown token type"
+
+ for prefix, namespace in prefix_mapping.items():
+ handler.endPrefixMapping(prefix)
+ handler.endDocument()
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/__init__.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/__init__.py
new file mode 100644
index 0000000000..d44447eaf5
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/__init__.py
@@ -0,0 +1,88 @@
+"""A collection of modules for building different kinds of trees from HTML
+documents.
+
+To create a treebuilder for a new type of tree, you need to do
+implement several things:
+
+1. A set of classes for various types of elements: Document, Doctype, Comment,
+ Element. These must implement the interface of ``base.treebuilders.Node``
+ (although comment nodes have a different signature for their constructor,
+ see ``treebuilders.etree.Comment``) Textual content may also be implemented
+ as another node type, or not, as your tree implementation requires.
+
+2. A treebuilder object (called ``TreeBuilder`` by convention) that inherits
+ from ``treebuilders.base.TreeBuilder``. This has 4 required attributes:
+
+ * ``documentClass`` - the class to use for the bottommost node of a document
+ * ``elementClass`` - the class to use for HTML Elements
+ * ``commentClass`` - the class to use for comments
+ * ``doctypeClass`` - the class to use for doctypes
+
+ It also has one required method:
+
+ * ``getDocument`` - Returns the root node of the complete document tree
+
+3. If you wish to run the unit tests, you must also create a ``testSerializer``
+ method on your treebuilder which accepts a node and returns a string
+ containing Node and its children serialized according to the format used in
+ the unittests
+
+"""
+
+from __future__ import absolute_import, division, unicode_literals
+
+from .._utils import default_etree
+
+treeBuilderCache = {}
+
+
+def getTreeBuilder(treeType, implementation=None, **kwargs):
+ """Get a TreeBuilder class for various types of trees with built-in support
+
+ :arg treeType: the name of the tree type required (case-insensitive). Supported
+ values are:
+
+ * "dom" - A generic builder for DOM implementations, defaulting to a
+ xml.dom.minidom based implementation.
+ * "etree" - A generic builder for tree implementations exposing an
+ ElementTree-like interface, defaulting to xml.etree.cElementTree if
+ available and xml.etree.ElementTree if not.
+ * "lxml" - A etree-based builder for lxml.etree, handling limitations
+ of lxml's implementation.
+
+ :arg implementation: (Currently applies to the "etree" and "dom" tree
+ types). A module implementing the tree type e.g. xml.etree.ElementTree
+ or xml.etree.cElementTree.
+
+ :arg kwargs: Any additional options to pass to the TreeBuilder when
+ creating it.
+
+ Example:
+
+ >>> from html5lib.treebuilders import getTreeBuilder
+ >>> builder = getTreeBuilder('etree')
+
+ """
+
+ treeType = treeType.lower()
+ if treeType not in treeBuilderCache:
+ if treeType == "dom":
+ from . import dom
+ # Come up with a sane default (pref. from the stdlib)
+ if implementation is None:
+ from xml.dom import minidom
+ implementation = minidom
+ # NEVER cache here, caching is done in the dom submodule
+ return dom.getDomModule(implementation, **kwargs).TreeBuilder
+ elif treeType == "lxml":
+ from . import etree_lxml
+ treeBuilderCache[treeType] = etree_lxml.TreeBuilder
+ elif treeType == "etree":
+ from . import etree
+ if implementation is None:
+ implementation = default_etree
+ # NEVER cache here, caching is done in the etree submodule
+ return etree.getETreeModule(implementation, **kwargs).TreeBuilder
+ else:
+ raise ValueError("""Unrecognised treebuilder "%s" """ % treeType)
+ return treeBuilderCache.get(treeType)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/base.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/base.py
new file mode 100644
index 0000000000..e4a3d710d9
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/base.py
@@ -0,0 +1,417 @@
+from __future__ import absolute_import, division, unicode_literals
+from six import text_type
+
+from ..constants import scopingElements, tableInsertModeElements, namespaces
+
+# The scope markers are inserted when entering object elements,
+# marquees, table cells, and table captions, and are used to prevent formatting
+# from "leaking" into tables, object elements, and marquees.
+Marker = None
+
+listElementsMap = {
+ None: (frozenset(scopingElements), False),
+ "button": (frozenset(scopingElements | {(namespaces["html"], "button")}), False),
+ "list": (frozenset(scopingElements | {(namespaces["html"], "ol"),
+ (namespaces["html"], "ul")}), False),
+ "table": (frozenset([(namespaces["html"], "html"),
+ (namespaces["html"], "table")]), False),
+ "select": (frozenset([(namespaces["html"], "optgroup"),
+ (namespaces["html"], "option")]), True)
+}
+
+
+class Node(object):
+ """Represents an item in the tree"""
+ def __init__(self, name):
+ """Creates a Node
+
+ :arg name: The tag name associated with the node
+
+ """
+ # The tag name associated with the node
+ self.name = name
+ # The parent of the current node (or None for the document node)
+ self.parent = None
+ # The value of the current node (applies to text nodes and comments)
+ self.value = None
+ # A dict holding name -> value pairs for attributes of the node
+ self.attributes = {}
+ # A list of child nodes of the current node. This must include all
+ # elements but not necessarily other node types.
+ self.childNodes = []
+ # A list of miscellaneous flags that can be set on the node.
+ self._flags = []
+
+ def __str__(self):
+ attributesStr = " ".join(["%s=\"%s\"" % (name, value)
+ for name, value in
+ self.attributes.items()])
+ if attributesStr:
+ return "<%s %s>" % (self.name, attributesStr)
+ else:
+ return "<%s>" % (self.name)
+
+ def __repr__(self):
+ return "<%s>" % (self.name)
+
+ def appendChild(self, node):
+ """Insert node as a child of the current node
+
+ :arg node: the node to insert
+
+ """
+ raise NotImplementedError
+
+ def insertText(self, data, insertBefore=None):
+ """Insert data as text in the current node, positioned before the
+ start of node insertBefore or to the end of the node's text.
+
+ :arg data: the data to insert
+
+ :arg insertBefore: True if you want to insert the text before the node
+ and False if you want to insert it after the node
+
+ """
+ raise NotImplementedError
+
+ def insertBefore(self, node, refNode):
+ """Insert node as a child of the current node, before refNode in the
+ list of child nodes. Raises ValueError if refNode is not a child of
+ the current node
+
+ :arg node: the node to insert
+
+ :arg refNode: the child node to insert the node before
+
+ """
+ raise NotImplementedError
+
+ def removeChild(self, node):
+ """Remove node from the children of the current node
+
+ :arg node: the child node to remove
+
+ """
+ raise NotImplementedError
+
+ def reparentChildren(self, newParent):
+ """Move all the children of the current node to newParent.
+ This is needed so that trees that don't store text as nodes move the
+ text in the correct way
+
+ :arg newParent: the node to move all this node's children to
+
+ """
+ # XXX - should this method be made more general?
+ for child in self.childNodes:
+ newParent.appendChild(child)
+ self.childNodes = []
+
+ def cloneNode(self):
+ """Return a shallow copy of the current node i.e. a node with the same
+ name and attributes but with no parent or child nodes
+ """
+ raise NotImplementedError
+
+ def hasContent(self):
+ """Return true if the node has children or text, false otherwise
+ """
+ raise NotImplementedError
+
+
+class ActiveFormattingElements(list):
+ def append(self, node):
+ equalCount = 0
+ if node != Marker:
+ for element in self[::-1]:
+ if element == Marker:
+ break
+ if self.nodesEqual(element, node):
+ equalCount += 1
+ if equalCount == 3:
+ self.remove(element)
+ break
+ list.append(self, node)
+
+ def nodesEqual(self, node1, node2):
+ if not node1.nameTuple == node2.nameTuple:
+ return False
+
+ if not node1.attributes == node2.attributes:
+ return False
+
+ return True
+
+
+class TreeBuilder(object):
+ """Base treebuilder implementation
+
+ * documentClass - the class to use for the bottommost node of a document
+ * elementClass - the class to use for HTML Elements
+ * commentClass - the class to use for comments
+ * doctypeClass - the class to use for doctypes
+
+ """
+ # pylint:disable=not-callable
+
+ # Document class
+ documentClass = None
+
+ # The class to use for creating a node
+ elementClass = None
+
+ # The class to use for creating comments
+ commentClass = None
+
+ # The class to use for creating doctypes
+ doctypeClass = None
+
+ # Fragment class
+ fragmentClass = None
+
+ def __init__(self, namespaceHTMLElements):
+ """Create a TreeBuilder
+
+ :arg namespaceHTMLElements: whether or not to namespace HTML elements
+
+ """
+ if namespaceHTMLElements:
+ self.defaultNamespace = "http://www.w3.org/1999/xhtml"
+ else:
+ self.defaultNamespace = None
+ self.reset()
+
+ def reset(self):
+ self.openElements = []
+ self.activeFormattingElements = ActiveFormattingElements()
+
+ # XXX - rename these to headElement, formElement
+ self.headPointer = None
+ self.formPointer = None
+
+ self.insertFromTable = False
+
+ self.document = self.documentClass()
+
+ def elementInScope(self, target, variant=None):
+
+ # If we pass a node in we match that. if we pass a string
+ # match any node with that name
+ exactNode = hasattr(target, "nameTuple")
+ if not exactNode:
+ if isinstance(target, text_type):
+ target = (namespaces["html"], target)
+ assert isinstance(target, tuple)
+
+ listElements, invert = listElementsMap[variant]
+
+ for node in reversed(self.openElements):
+ if exactNode and node == target:
+ return True
+ elif not exactNode and node.nameTuple == target:
+ return True
+ elif (invert ^ (node.nameTuple in listElements)):
+ return False
+
+ assert False # We should never reach this point
+
+ def reconstructActiveFormattingElements(self):
+ # Within this algorithm the order of steps described in the
+ # specification is not quite the same as the order of steps in the
+ # code. It should still do the same though.
+
+ # Step 1: stop the algorithm when there's nothing to do.
+ if not self.activeFormattingElements:
+ return
+
+ # Step 2 and step 3: we start with the last element. So i is -1.
+ i = len(self.activeFormattingElements) - 1
+ entry = self.activeFormattingElements[i]
+ if entry == Marker or entry in self.openElements:
+ return
+
+ # Step 6
+ while entry != Marker and entry not in self.openElements:
+ if i == 0:
+ # This will be reset to 0 below
+ i = -1
+ break
+ i -= 1
+ # Step 5: let entry be one earlier in the list.
+ entry = self.activeFormattingElements[i]
+
+ while True:
+ # Step 7
+ i += 1
+
+ # Step 8
+ entry = self.activeFormattingElements[i]
+ clone = entry.cloneNode() # Mainly to get a new copy of the attributes
+
+ # Step 9
+ element = self.insertElement({"type": "StartTag",
+ "name": clone.name,
+ "namespace": clone.namespace,
+ "data": clone.attributes})
+
+ # Step 10
+ self.activeFormattingElements[i] = element
+
+ # Step 11
+ if element == self.activeFormattingElements[-1]:
+ break
+
+ def clearActiveFormattingElements(self):
+ entry = self.activeFormattingElements.pop()
+ while self.activeFormattingElements and entry != Marker:
+ entry = self.activeFormattingElements.pop()
+
+ def elementInActiveFormattingElements(self, name):
+ """Check if an element exists between the end of the active
+ formatting elements and the last marker. If it does, return it, else
+ return false"""
+
+ for item in self.activeFormattingElements[::-1]:
+ # Check for Marker first because if it's a Marker it doesn't have a
+ # name attribute.
+ if item == Marker:
+ break
+ elif item.name == name:
+ return item
+ return False
+
+ def insertRoot(self, token):
+ element = self.createElement(token)
+ self.openElements.append(element)
+ self.document.appendChild(element)
+
+ def insertDoctype(self, token):
+ name = token["name"]
+ publicId = token["publicId"]
+ systemId = token["systemId"]
+
+ doctype = self.doctypeClass(name, publicId, systemId)
+ self.document.appendChild(doctype)
+
+ def insertComment(self, token, parent=None):
+ if parent is None:
+ parent = self.openElements[-1]
+ parent.appendChild(self.commentClass(token["data"]))
+
+ def createElement(self, token):
+ """Create an element but don't insert it anywhere"""
+ name = token["name"]
+ namespace = token.get("namespace", self.defaultNamespace)
+ element = self.elementClass(name, namespace)
+ element.attributes = token["data"]
+ return element
+
+ def _getInsertFromTable(self):
+ return self._insertFromTable
+
+ def _setInsertFromTable(self, value):
+ """Switch the function used to insert an element from the
+ normal one to the misnested table one and back again"""
+ self._insertFromTable = value
+ if value:
+ self.insertElement = self.insertElementTable
+ else:
+ self.insertElement = self.insertElementNormal
+
+ insertFromTable = property(_getInsertFromTable, _setInsertFromTable)
+
+ def insertElementNormal(self, token):
+ name = token["name"]
+ assert isinstance(name, text_type), "Element %s not unicode" % name
+ namespace = token.get("namespace", self.defaultNamespace)
+ element = self.elementClass(name, namespace)
+ element.attributes = token["data"]
+ self.openElements[-1].appendChild(element)
+ self.openElements.append(element)
+ return element
+
+ def insertElementTable(self, token):
+ """Create an element and insert it into the tree"""
+ element = self.createElement(token)
+ if self.openElements[-1].name not in tableInsertModeElements:
+ return self.insertElementNormal(token)
+ else:
+ # We should be in the InTable mode. This means we want to do
+ # special magic element rearranging
+ parent, insertBefore = self.getTableMisnestedNodePosition()
+ if insertBefore is None:
+ parent.appendChild(element)
+ else:
+ parent.insertBefore(element, insertBefore)
+ self.openElements.append(element)
+ return element
+
+ def insertText(self, data, parent=None):
+ """Insert text data."""
+ if parent is None:
+ parent = self.openElements[-1]
+
+ if (not self.insertFromTable or (self.insertFromTable and
+ self.openElements[-1].name
+ not in tableInsertModeElements)):
+ parent.insertText(data)
+ else:
+ # We should be in the InTable mode. This means we want to do
+ # special magic element rearranging
+ parent, insertBefore = self.getTableMisnestedNodePosition()
+ parent.insertText(data, insertBefore)
+
+ def getTableMisnestedNodePosition(self):
+ """Get the foster parent element, and sibling to insert before
+ (or None) when inserting a misnested table node"""
+ # The foster parent element is the one which comes before the most
+ # recently opened table element
+ # XXX - this is really inelegant
+ lastTable = None
+ fosterParent = None
+ insertBefore = None
+ for elm in self.openElements[::-1]:
+ if elm.name == "table":
+ lastTable = elm
+ break
+ if lastTable:
+ # XXX - we should really check that this parent is actually a
+ # node here
+ if lastTable.parent:
+ fosterParent = lastTable.parent
+ insertBefore = lastTable
+ else:
+ fosterParent = self.openElements[
+ self.openElements.index(lastTable) - 1]
+ else:
+ fosterParent = self.openElements[0]
+ return fosterParent, insertBefore
+
+ def generateImpliedEndTags(self, exclude=None):
+ name = self.openElements[-1].name
+ # XXX td, th and tr are not actually needed
+ if (name in frozenset(("dd", "dt", "li", "option", "optgroup", "p", "rp", "rt")) and
+ name != exclude):
+ self.openElements.pop()
+ # XXX This is not entirely what the specification says. We should
+ # investigate it more closely.
+ self.generateImpliedEndTags(exclude)
+
+ def getDocument(self):
+ """Return the final tree"""
+ return self.document
+
+ def getFragment(self):
+ """Return the final fragment"""
+ # assert self.innerHTML
+ fragment = self.fragmentClass()
+ self.openElements[0].reparentChildren(fragment)
+ return fragment
+
+ def testSerializer(self, node):
+ """Serialize the subtree of node in the format required by unit tests
+
+ :arg node: the node from which to start serializing
+
+ """
+ raise NotImplementedError
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py
new file mode 100644
index 0000000000..d8b5300465
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py
@@ -0,0 +1,239 @@
+from __future__ import absolute_import, division, unicode_literals
+
+
+try:
+ from collections.abc import MutableMapping
+except ImportError: # Python 2.7
+ from collections import MutableMapping
+from xml.dom import minidom, Node
+import weakref
+
+from . import base
+from .. import constants
+from ..constants import namespaces
+from .._utils import moduleFactoryFactory
+
+
+def getDomBuilder(DomImplementation):
+ Dom = DomImplementation
+
+ class AttrList(MutableMapping):
+ def __init__(self, element):
+ self.element = element
+
+ def __iter__(self):
+ return iter(self.element.attributes.keys())
+
+ def __setitem__(self, name, value):
+ if isinstance(name, tuple):
+ raise NotImplementedError
+ else:
+ attr = self.element.ownerDocument.createAttribute(name)
+ attr.value = value
+ self.element.attributes[name] = attr
+
+ def __len__(self):
+ return len(self.element.attributes)
+
+ def items(self):
+ return list(self.element.attributes.items())
+
+ def values(self):
+ return list(self.element.attributes.values())
+
+ def __getitem__(self, name):
+ if isinstance(name, tuple):
+ raise NotImplementedError
+ else:
+ return self.element.attributes[name].value
+
+ def __delitem__(self, name):
+ if isinstance(name, tuple):
+ raise NotImplementedError
+ else:
+ del self.element.attributes[name]
+
+ class NodeBuilder(base.Node):
+ def __init__(self, element):
+ base.Node.__init__(self, element.nodeName)
+ self.element = element
+
+ namespace = property(lambda self: hasattr(self.element, "namespaceURI") and
+ self.element.namespaceURI or None)
+
+ def appendChild(self, node):
+ node.parent = self
+ self.element.appendChild(node.element)
+
+ def insertText(self, data, insertBefore=None):
+ text = self.element.ownerDocument.createTextNode(data)
+ if insertBefore:
+ self.element.insertBefore(text, insertBefore.element)
+ else:
+ self.element.appendChild(text)
+
+ def insertBefore(self, node, refNode):
+ self.element.insertBefore(node.element, refNode.element)
+ node.parent = self
+
+ def removeChild(self, node):
+ if node.element.parentNode == self.element:
+ self.element.removeChild(node.element)
+ node.parent = None
+
+ def reparentChildren(self, newParent):
+ while self.element.hasChildNodes():
+ child = self.element.firstChild
+ self.element.removeChild(child)
+ newParent.element.appendChild(child)
+ self.childNodes = []
+
+ def getAttributes(self):
+ return AttrList(self.element)
+
+ def setAttributes(self, attributes):
+ if attributes:
+ for name, value in list(attributes.items()):
+ if isinstance(name, tuple):
+ if name[0] is not None:
+ qualifiedName = (name[0] + ":" + name[1])
+ else:
+ qualifiedName = name[1]
+ self.element.setAttributeNS(name[2], qualifiedName,
+ value)
+ else:
+ self.element.setAttribute(
+ name, value)
+ attributes = property(getAttributes, setAttributes)
+
+ def cloneNode(self):
+ return NodeBuilder(self.element.cloneNode(False))
+
+ def hasContent(self):
+ return self.element.hasChildNodes()
+
+ def getNameTuple(self):
+ if self.namespace is None:
+ return namespaces["html"], self.name
+ else:
+ return self.namespace, self.name
+
+ nameTuple = property(getNameTuple)
+
+ class TreeBuilder(base.TreeBuilder): # pylint:disable=unused-variable
+ def documentClass(self):
+ self.dom = Dom.getDOMImplementation().createDocument(None, None, None)
+ return weakref.proxy(self)
+
+ def insertDoctype(self, token):
+ name = token["name"]
+ publicId = token["publicId"]
+ systemId = token["systemId"]
+
+ domimpl = Dom.getDOMImplementation()
+ doctype = domimpl.createDocumentType(name, publicId, systemId)
+ self.document.appendChild(NodeBuilder(doctype))
+ if Dom == minidom:
+ doctype.ownerDocument = self.dom
+
+ def elementClass(self, name, namespace=None):
+ if namespace is None and self.defaultNamespace is None:
+ node = self.dom.createElement(name)
+ else:
+ node = self.dom.createElementNS(namespace, name)
+
+ return NodeBuilder(node)
+
+ def commentClass(self, data):
+ return NodeBuilder(self.dom.createComment(data))
+
+ def fragmentClass(self):
+ return NodeBuilder(self.dom.createDocumentFragment())
+
+ def appendChild(self, node):
+ self.dom.appendChild(node.element)
+
+ def testSerializer(self, element):
+ return testSerializer(element)
+
+ def getDocument(self):
+ return self.dom
+
+ def getFragment(self):
+ return base.TreeBuilder.getFragment(self).element
+
+ def insertText(self, data, parent=None):
+ data = data
+ if parent != self:
+ base.TreeBuilder.insertText(self, data, parent)
+ else:
+ # HACK: allow text nodes as children of the document node
+ if hasattr(self.dom, '_child_node_types'):
+ # pylint:disable=protected-access
+ if Node.TEXT_NODE not in self.dom._child_node_types:
+ self.dom._child_node_types = list(self.dom._child_node_types)
+ self.dom._child_node_types.append(Node.TEXT_NODE)
+ self.dom.appendChild(self.dom.createTextNode(data))
+
+ implementation = DomImplementation
+ name = None
+
+ def testSerializer(element):
+ element.normalize()
+ rv = []
+
+ def serializeElement(element, indent=0):
+ if element.nodeType == Node.DOCUMENT_TYPE_NODE:
+ if element.name:
+ if element.publicId or element.systemId:
+ publicId = element.publicId or ""
+ systemId = element.systemId or ""
+ rv.append("""|%s<!DOCTYPE %s "%s" "%s">""" %
+ (' ' * indent, element.name, publicId, systemId))
+ else:
+ rv.append("|%s<!DOCTYPE %s>" % (' ' * indent, element.name))
+ else:
+ rv.append("|%s<!DOCTYPE >" % (' ' * indent,))
+ elif element.nodeType == Node.DOCUMENT_NODE:
+ rv.append("#document")
+ elif element.nodeType == Node.DOCUMENT_FRAGMENT_NODE:
+ rv.append("#document-fragment")
+ elif element.nodeType == Node.COMMENT_NODE:
+ rv.append("|%s<!-- %s -->" % (' ' * indent, element.nodeValue))
+ elif element.nodeType == Node.TEXT_NODE:
+ rv.append("|%s\"%s\"" % (' ' * indent, element.nodeValue))
+ else:
+ if (hasattr(element, "namespaceURI") and
+ element.namespaceURI is not None):
+ name = "%s %s" % (constants.prefixes[element.namespaceURI],
+ element.nodeName)
+ else:
+ name = element.nodeName
+ rv.append("|%s<%s>" % (' ' * indent, name))
+ if element.hasAttributes():
+ attributes = []
+ for i in range(len(element.attributes)):
+ attr = element.attributes.item(i)
+ name = attr.nodeName
+ value = attr.value
+ ns = attr.namespaceURI
+ if ns:
+ name = "%s %s" % (constants.prefixes[ns], attr.localName)
+ else:
+ name = attr.nodeName
+ attributes.append((name, value))
+
+ for name, value in sorted(attributes):
+ rv.append('|%s%s="%s"' % (' ' * (indent + 2), name, value))
+ indent += 2
+ for child in element.childNodes:
+ serializeElement(child, indent)
+ serializeElement(element, 0)
+
+ return "\n".join(rv)
+
+ return locals()
+
+
+# The actual means to get a module!
+getDomModule = moduleFactoryFactory(getDomBuilder)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/etree.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/etree.py
new file mode 100644
index 0000000000..086bed4eed
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/etree.py
@@ -0,0 +1,343 @@
+from __future__ import absolute_import, division, unicode_literals
+# pylint:disable=protected-access
+
+from six import text_type
+
+import re
+
+from copy import copy
+
+from . import base
+from .. import _ihatexml
+from .. import constants
+from ..constants import namespaces
+from .._utils import moduleFactoryFactory
+
+tag_regexp = re.compile("{([^}]*)}(.*)")
+
+
+def getETreeBuilder(ElementTreeImplementation, fullTree=False):
+ ElementTree = ElementTreeImplementation
+ ElementTreeCommentType = ElementTree.Comment("asd").tag
+
+ class Element(base.Node):
+ def __init__(self, name, namespace=None):
+ self._name = name
+ self._namespace = namespace
+ self._element = ElementTree.Element(self._getETreeTag(name,
+ namespace))
+ if namespace is None:
+ self.nameTuple = namespaces["html"], self._name
+ else:
+ self.nameTuple = self._namespace, self._name
+ self.parent = None
+ self._childNodes = []
+ self._flags = []
+
+ def _getETreeTag(self, name, namespace):
+ if namespace is None:
+ etree_tag = name
+ else:
+ etree_tag = "{%s}%s" % (namespace, name)
+ return etree_tag
+
+ def _setName(self, name):
+ self._name = name
+ self._element.tag = self._getETreeTag(self._name, self._namespace)
+
+ def _getName(self):
+ return self._name
+
+ name = property(_getName, _setName)
+
+ def _setNamespace(self, namespace):
+ self._namespace = namespace
+ self._element.tag = self._getETreeTag(self._name, self._namespace)
+
+ def _getNamespace(self):
+ return self._namespace
+
+ namespace = property(_getNamespace, _setNamespace)
+
+ def _getAttributes(self):
+ return self._element.attrib
+
+ def _setAttributes(self, attributes):
+ el_attrib = self._element.attrib
+ el_attrib.clear()
+ if attributes:
+ # calling .items _always_ allocates, and the above truthy check is cheaper than the
+ # allocation on average
+ for key, value in attributes.items():
+ if isinstance(key, tuple):
+ name = "{%s}%s" % (key[2], key[1])
+ else:
+ name = key
+ el_attrib[name] = value
+
+ attributes = property(_getAttributes, _setAttributes)
+
+ def _getChildNodes(self):
+ return self._childNodes
+
+ def _setChildNodes(self, value):
+ del self._element[:]
+ self._childNodes = []
+ for element in value:
+ self.insertChild(element)
+
+ childNodes = property(_getChildNodes, _setChildNodes)
+
+ def hasContent(self):
+ """Return true if the node has children or text"""
+ return bool(self._element.text or len(self._element))
+
+ def appendChild(self, node):
+ self._childNodes.append(node)
+ self._element.append(node._element)
+ node.parent = self
+
+ def insertBefore(self, node, refNode):
+ index = list(self._element).index(refNode._element)
+ self._element.insert(index, node._element)
+ node.parent = self
+
+ def removeChild(self, node):
+ self._childNodes.remove(node)
+ self._element.remove(node._element)
+ node.parent = None
+
+ def insertText(self, data, insertBefore=None):
+ if not(len(self._element)):
+ if not self._element.text:
+ self._element.text = ""
+ self._element.text += data
+ elif insertBefore is None:
+ # Insert the text as the tail of the last child element
+ if not self._element[-1].tail:
+ self._element[-1].tail = ""
+ self._element[-1].tail += data
+ else:
+ # Insert the text before the specified node
+ children = list(self._element)
+ index = children.index(insertBefore._element)
+ if index > 0:
+ if not self._element[index - 1].tail:
+ self._element[index - 1].tail = ""
+ self._element[index - 1].tail += data
+ else:
+ if not self._element.text:
+ self._element.text = ""
+ self._element.text += data
+
+ def cloneNode(self):
+ element = type(self)(self.name, self.namespace)
+ if self._element.attrib:
+ element._element.attrib = copy(self._element.attrib)
+ return element
+
+ def reparentChildren(self, newParent):
+ if newParent.childNodes:
+ newParent.childNodes[-1]._element.tail += self._element.text
+ else:
+ if not newParent._element.text:
+ newParent._element.text = ""
+ if self._element.text is not None:
+ newParent._element.text += self._element.text
+ self._element.text = ""
+ base.Node.reparentChildren(self, newParent)
+
+ class Comment(Element):
+ def __init__(self, data):
+ # Use the superclass constructor to set all properties on the
+ # wrapper element
+ self._element = ElementTree.Comment(data)
+ self.parent = None
+ self._childNodes = []
+ self._flags = []
+
+ def _getData(self):
+ return self._element.text
+
+ def _setData(self, value):
+ self._element.text = value
+
+ data = property(_getData, _setData)
+
+ class DocumentType(Element):
+ def __init__(self, name, publicId, systemId):
+ Element.__init__(self, "<!DOCTYPE>")
+ self._element.text = name
+ self.publicId = publicId
+ self.systemId = systemId
+
+ def _getPublicId(self):
+ return self._element.get("publicId", "")
+
+ def _setPublicId(self, value):
+ if value is not None:
+ self._element.set("publicId", value)
+
+ publicId = property(_getPublicId, _setPublicId)
+
+ def _getSystemId(self):
+ return self._element.get("systemId", "")
+
+ def _setSystemId(self, value):
+ if value is not None:
+ self._element.set("systemId", value)
+
+ systemId = property(_getSystemId, _setSystemId)
+
+ class Document(Element):
+ def __init__(self):
+ Element.__init__(self, "DOCUMENT_ROOT")
+
+ class DocumentFragment(Element):
+ def __init__(self):
+ Element.__init__(self, "DOCUMENT_FRAGMENT")
+
+ def testSerializer(element):
+ rv = []
+
+ def serializeElement(element, indent=0):
+ if not(hasattr(element, "tag")):
+ element = element.getroot()
+ if element.tag == "<!DOCTYPE>":
+ if element.get("publicId") or element.get("systemId"):
+ publicId = element.get("publicId") or ""
+ systemId = element.get("systemId") or ""
+ rv.append("""<!DOCTYPE %s "%s" "%s">""" %
+ (element.text, publicId, systemId))
+ else:
+ rv.append("<!DOCTYPE %s>" % (element.text,))
+ elif element.tag == "DOCUMENT_ROOT":
+ rv.append("#document")
+ if element.text is not None:
+ rv.append("|%s\"%s\"" % (' ' * (indent + 2), element.text))
+ if element.tail is not None:
+ raise TypeError("Document node cannot have tail")
+ if hasattr(element, "attrib") and len(element.attrib):
+ raise TypeError("Document node cannot have attributes")
+ elif element.tag == ElementTreeCommentType:
+ rv.append("|%s<!-- %s -->" % (' ' * indent, element.text))
+ else:
+ assert isinstance(element.tag, text_type), \
+ "Expected unicode, got %s, %s" % (type(element.tag), element.tag)
+ nsmatch = tag_regexp.match(element.tag)
+
+ if nsmatch is None:
+ name = element.tag
+ else:
+ ns, name = nsmatch.groups()
+ prefix = constants.prefixes[ns]
+ name = "%s %s" % (prefix, name)
+ rv.append("|%s<%s>" % (' ' * indent, name))
+
+ if hasattr(element, "attrib"):
+ attributes = []
+ for name, value in element.attrib.items():
+ nsmatch = tag_regexp.match(name)
+ if nsmatch is not None:
+ ns, name = nsmatch.groups()
+ prefix = constants.prefixes[ns]
+ attr_string = "%s %s" % (prefix, name)
+ else:
+ attr_string = name
+ attributes.append((attr_string, value))
+
+ for name, value in sorted(attributes):
+ rv.append('|%s%s="%s"' % (' ' * (indent + 2), name, value))
+ if element.text:
+ rv.append("|%s\"%s\"" % (' ' * (indent + 2), element.text))
+ indent += 2
+ for child in element:
+ serializeElement(child, indent)
+ if element.tail:
+ rv.append("|%s\"%s\"" % (' ' * (indent - 2), element.tail))
+ serializeElement(element, 0)
+
+ return "\n".join(rv)
+
+ def tostring(element): # pylint:disable=unused-variable
+ """Serialize an element and its child nodes to a string"""
+ rv = []
+ filter = _ihatexml.InfosetFilter()
+
+ def serializeElement(element):
+ if isinstance(element, ElementTree.ElementTree):
+ element = element.getroot()
+
+ if element.tag == "<!DOCTYPE>":
+ if element.get("publicId") or element.get("systemId"):
+ publicId = element.get("publicId") or ""
+ systemId = element.get("systemId") or ""
+ rv.append("""<!DOCTYPE %s PUBLIC "%s" "%s">""" %
+ (element.text, publicId, systemId))
+ else:
+ rv.append("<!DOCTYPE %s>" % (element.text,))
+ elif element.tag == "DOCUMENT_ROOT":
+ if element.text is not None:
+ rv.append(element.text)
+ if element.tail is not None:
+ raise TypeError("Document node cannot have tail")
+ if hasattr(element, "attrib") and len(element.attrib):
+ raise TypeError("Document node cannot have attributes")
+
+ for child in element:
+ serializeElement(child)
+
+ elif element.tag == ElementTreeCommentType:
+ rv.append("<!--%s-->" % (element.text,))
+ else:
+ # This is assumed to be an ordinary element
+ if not element.attrib:
+ rv.append("<%s>" % (filter.fromXmlName(element.tag),))
+ else:
+ attr = " ".join(["%s=\"%s\"" % (
+ filter.fromXmlName(name), value)
+ for name, value in element.attrib.items()])
+ rv.append("<%s %s>" % (element.tag, attr))
+ if element.text:
+ rv.append(element.text)
+
+ for child in element:
+ serializeElement(child)
+
+ rv.append("</%s>" % (element.tag,))
+
+ if element.tail:
+ rv.append(element.tail)
+
+ serializeElement(element)
+
+ return "".join(rv)
+
+ class TreeBuilder(base.TreeBuilder): # pylint:disable=unused-variable
+ documentClass = Document
+ doctypeClass = DocumentType
+ elementClass = Element
+ commentClass = Comment
+ fragmentClass = DocumentFragment
+ implementation = ElementTreeImplementation
+
+ def testSerializer(self, element):
+ return testSerializer(element)
+
+ def getDocument(self):
+ if fullTree:
+ return self.document._element
+ else:
+ if self.defaultNamespace is not None:
+ return self.document._element.find(
+ "{%s}html" % self.defaultNamespace)
+ else:
+ return self.document._element.find("html")
+
+ def getFragment(self):
+ return base.TreeBuilder.getFragment(self)._element
+
+ return locals()
+
+
+getETreeModule = moduleFactoryFactory(getETreeBuilder)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/etree_lxml.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/etree_lxml.py
new file mode 100644
index 0000000000..e73de61a85
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/etree_lxml.py
@@ -0,0 +1,392 @@
+"""Module for supporting the lxml.etree library. The idea here is to use as much
+of the native library as possible, without using fragile hacks like custom element
+names that break between releases. The downside of this is that we cannot represent
+all possible trees; specifically the following are known to cause problems:
+
+Text or comments as siblings of the root element
+Docypes with no name
+
+When any of these things occur, we emit a DataLossWarning
+"""
+
+from __future__ import absolute_import, division, unicode_literals
+# pylint:disable=protected-access
+
+import warnings
+import re
+import sys
+
+try:
+ from collections.abc import MutableMapping
+except ImportError:
+ from collections import MutableMapping
+
+from . import base
+from ..constants import DataLossWarning
+from .. import constants
+from . import etree as etree_builders
+from .. import _ihatexml
+
+import lxml.etree as etree
+from six import PY3, binary_type
+
+
+fullTree = True
+tag_regexp = re.compile("{([^}]*)}(.*)")
+
+comment_type = etree.Comment("asd").tag
+
+
+class DocumentType(object):
+ def __init__(self, name, publicId, systemId):
+ self.name = name
+ self.publicId = publicId
+ self.systemId = systemId
+
+
+class Document(object):
+ def __init__(self):
+ self._elementTree = None
+ self._childNodes = []
+
+ def appendChild(self, element):
+ last = self._elementTree.getroot()
+ for last in self._elementTree.getroot().itersiblings():
+ pass
+
+ last.addnext(element._element)
+
+ def _getChildNodes(self):
+ return self._childNodes
+
+ childNodes = property(_getChildNodes)
+
+
+def testSerializer(element):
+ rv = []
+ infosetFilter = _ihatexml.InfosetFilter(preventDoubleDashComments=True)
+
+ def serializeElement(element, indent=0):
+ if not hasattr(element, "tag"):
+ if hasattr(element, "getroot"):
+ # Full tree case
+ rv.append("#document")
+ if element.docinfo.internalDTD:
+ if not (element.docinfo.public_id or
+ element.docinfo.system_url):
+ dtd_str = "<!DOCTYPE %s>" % element.docinfo.root_name
+ else:
+ dtd_str = """<!DOCTYPE %s "%s" "%s">""" % (
+ element.docinfo.root_name,
+ element.docinfo.public_id,
+ element.docinfo.system_url)
+ rv.append("|%s%s" % (' ' * (indent + 2), dtd_str))
+ next_element = element.getroot()
+ while next_element.getprevious() is not None:
+ next_element = next_element.getprevious()
+ while next_element is not None:
+ serializeElement(next_element, indent + 2)
+ next_element = next_element.getnext()
+ elif isinstance(element, str) or isinstance(element, bytes):
+ # Text in a fragment
+ assert isinstance(element, str) or sys.version_info[0] == 2
+ rv.append("|%s\"%s\"" % (' ' * indent, element))
+ else:
+ # Fragment case
+ rv.append("#document-fragment")
+ for next_element in element:
+ serializeElement(next_element, indent + 2)
+ elif element.tag == comment_type:
+ rv.append("|%s<!-- %s -->" % (' ' * indent, element.text))
+ if hasattr(element, "tail") and element.tail:
+ rv.append("|%s\"%s\"" % (' ' * indent, element.tail))
+ else:
+ assert isinstance(element, etree._Element)
+ nsmatch = etree_builders.tag_regexp.match(element.tag)
+ if nsmatch is not None:
+ ns = nsmatch.group(1)
+ tag = nsmatch.group(2)
+ prefix = constants.prefixes[ns]
+ rv.append("|%s<%s %s>" % (' ' * indent, prefix,
+ infosetFilter.fromXmlName(tag)))
+ else:
+ rv.append("|%s<%s>" % (' ' * indent,
+ infosetFilter.fromXmlName(element.tag)))
+
+ if hasattr(element, "attrib"):
+ attributes = []
+ for name, value in element.attrib.items():
+ nsmatch = tag_regexp.match(name)
+ if nsmatch is not None:
+ ns, name = nsmatch.groups()
+ name = infosetFilter.fromXmlName(name)
+ prefix = constants.prefixes[ns]
+ attr_string = "%s %s" % (prefix, name)
+ else:
+ attr_string = infosetFilter.fromXmlName(name)
+ attributes.append((attr_string, value))
+
+ for name, value in sorted(attributes):
+ rv.append('|%s%s="%s"' % (' ' * (indent + 2), name, value))
+
+ if element.text:
+ rv.append("|%s\"%s\"" % (' ' * (indent + 2), element.text))
+ indent += 2
+ for child in element:
+ serializeElement(child, indent)
+ if hasattr(element, "tail") and element.tail:
+ rv.append("|%s\"%s\"" % (' ' * (indent - 2), element.tail))
+ serializeElement(element, 0)
+
+ return "\n".join(rv)
+
+
+def tostring(element):
+ """Serialize an element and its child nodes to a string"""
+ rv = []
+
+ def serializeElement(element):
+ if not hasattr(element, "tag"):
+ if element.docinfo.internalDTD:
+ if element.docinfo.doctype:
+ dtd_str = element.docinfo.doctype
+ else:
+ dtd_str = "<!DOCTYPE %s>" % element.docinfo.root_name
+ rv.append(dtd_str)
+ serializeElement(element.getroot())
+
+ elif element.tag == comment_type:
+ rv.append("<!--%s-->" % (element.text,))
+
+ else:
+ # This is assumed to be an ordinary element
+ if not element.attrib:
+ rv.append("<%s>" % (element.tag,))
+ else:
+ attr = " ".join(["%s=\"%s\"" % (name, value)
+ for name, value in element.attrib.items()])
+ rv.append("<%s %s>" % (element.tag, attr))
+ if element.text:
+ rv.append(element.text)
+
+ for child in element:
+ serializeElement(child)
+
+ rv.append("</%s>" % (element.tag,))
+
+ if hasattr(element, "tail") and element.tail:
+ rv.append(element.tail)
+
+ serializeElement(element)
+
+ return "".join(rv)
+
+
+class TreeBuilder(base.TreeBuilder):
+ documentClass = Document
+ doctypeClass = DocumentType
+ elementClass = None
+ commentClass = None
+ fragmentClass = Document
+ implementation = etree
+
+ def __init__(self, namespaceHTMLElements, fullTree=False):
+ builder = etree_builders.getETreeModule(etree, fullTree=fullTree)
+ infosetFilter = self.infosetFilter = _ihatexml.InfosetFilter(preventDoubleDashComments=True)
+ self.namespaceHTMLElements = namespaceHTMLElements
+
+ class Attributes(MutableMapping):
+ def __init__(self, element):
+ self._element = element
+
+ def _coerceKey(self, key):
+ if isinstance(key, tuple):
+ name = "{%s}%s" % (key[2], infosetFilter.coerceAttribute(key[1]))
+ else:
+ name = infosetFilter.coerceAttribute(key)
+ return name
+
+ def __getitem__(self, key):
+ value = self._element._element.attrib[self._coerceKey(key)]
+ if not PY3 and isinstance(value, binary_type):
+ value = value.decode("ascii")
+ return value
+
+ def __setitem__(self, key, value):
+ self._element._element.attrib[self._coerceKey(key)] = value
+
+ def __delitem__(self, key):
+ del self._element._element.attrib[self._coerceKey(key)]
+
+ def __iter__(self):
+ return iter(self._element._element.attrib)
+
+ def __len__(self):
+ return len(self._element._element.attrib)
+
+ def clear(self):
+ return self._element._element.attrib.clear()
+
+ class Element(builder.Element):
+ def __init__(self, name, namespace):
+ name = infosetFilter.coerceElement(name)
+ builder.Element.__init__(self, name, namespace=namespace)
+ self._attributes = Attributes(self)
+
+ def _setName(self, name):
+ self._name = infosetFilter.coerceElement(name)
+ self._element.tag = self._getETreeTag(
+ self._name, self._namespace)
+
+ def _getName(self):
+ return infosetFilter.fromXmlName(self._name)
+
+ name = property(_getName, _setName)
+
+ def _getAttributes(self):
+ return self._attributes
+
+ def _setAttributes(self, value):
+ attributes = self.attributes
+ attributes.clear()
+ attributes.update(value)
+
+ attributes = property(_getAttributes, _setAttributes)
+
+ def insertText(self, data, insertBefore=None):
+ data = infosetFilter.coerceCharacters(data)
+ builder.Element.insertText(self, data, insertBefore)
+
+ def cloneNode(self):
+ element = type(self)(self.name, self.namespace)
+ if self._element.attrib:
+ element._element.attrib.update(self._element.attrib)
+ return element
+
+ class Comment(builder.Comment):
+ def __init__(self, data):
+ data = infosetFilter.coerceComment(data)
+ builder.Comment.__init__(self, data)
+
+ def _setData(self, data):
+ data = infosetFilter.coerceComment(data)
+ self._element.text = data
+
+ def _getData(self):
+ return self._element.text
+
+ data = property(_getData, _setData)
+
+ self.elementClass = Element
+ self.commentClass = Comment
+ # self.fragmentClass = builder.DocumentFragment
+ base.TreeBuilder.__init__(self, namespaceHTMLElements)
+
+ def reset(self):
+ base.TreeBuilder.reset(self)
+ self.insertComment = self.insertCommentInitial
+ self.initial_comments = []
+ self.doctype = None
+
+ def testSerializer(self, element):
+ return testSerializer(element)
+
+ def getDocument(self):
+ if fullTree:
+ return self.document._elementTree
+ else:
+ return self.document._elementTree.getroot()
+
+ def getFragment(self):
+ fragment = []
+ element = self.openElements[0]._element
+ if element.text:
+ fragment.append(element.text)
+ fragment.extend(list(element))
+ if element.tail:
+ fragment.append(element.tail)
+ return fragment
+
+ def insertDoctype(self, token):
+ name = token["name"]
+ publicId = token["publicId"]
+ systemId = token["systemId"]
+
+ if not name:
+ warnings.warn("lxml cannot represent empty doctype", DataLossWarning)
+ self.doctype = None
+ else:
+ coercedName = self.infosetFilter.coerceElement(name)
+ if coercedName != name:
+ warnings.warn("lxml cannot represent non-xml doctype", DataLossWarning)
+
+ doctype = self.doctypeClass(coercedName, publicId, systemId)
+ self.doctype = doctype
+
+ def insertCommentInitial(self, data, parent=None):
+ assert parent is None or parent is self.document
+ assert self.document._elementTree is None
+ self.initial_comments.append(data)
+
+ def insertCommentMain(self, data, parent=None):
+ if (parent == self.document and
+ self.document._elementTree.getroot()[-1].tag == comment_type):
+ warnings.warn("lxml cannot represent adjacent comments beyond the root elements", DataLossWarning)
+ super(TreeBuilder, self).insertComment(data, parent)
+
+ def insertRoot(self, token):
+ # Because of the way libxml2 works, it doesn't seem to be possible to
+ # alter information like the doctype after the tree has been parsed.
+ # Therefore we need to use the built-in parser to create our initial
+ # tree, after which we can add elements like normal
+ docStr = ""
+ if self.doctype:
+ assert self.doctype.name
+ docStr += "<!DOCTYPE %s" % self.doctype.name
+ if (self.doctype.publicId is not None or
+ self.doctype.systemId is not None):
+ docStr += (' PUBLIC "%s" ' %
+ (self.infosetFilter.coercePubid(self.doctype.publicId or "")))
+ if self.doctype.systemId:
+ sysid = self.doctype.systemId
+ if sysid.find("'") >= 0 and sysid.find('"') >= 0:
+ warnings.warn("DOCTYPE system cannot contain single and double quotes", DataLossWarning)
+ sysid = sysid.replace("'", 'U00027')
+ if sysid.find("'") >= 0:
+ docStr += '"%s"' % sysid
+ else:
+ docStr += "'%s'" % sysid
+ else:
+ docStr += "''"
+ docStr += ">"
+ if self.doctype.name != token["name"]:
+ warnings.warn("lxml cannot represent doctype with a different name to the root element", DataLossWarning)
+ docStr += "<THIS_SHOULD_NEVER_APPEAR_PUBLICLY/>"
+ root = etree.fromstring(docStr)
+
+ # Append the initial comments:
+ for comment_token in self.initial_comments:
+ comment = self.commentClass(comment_token["data"])
+ root.addprevious(comment._element)
+
+ # Create the root document and add the ElementTree to it
+ self.document = self.documentClass()
+ self.document._elementTree = root.getroottree()
+
+ # Give the root element the right name
+ name = token["name"]
+ namespace = token.get("namespace", self.defaultNamespace)
+ if namespace is None:
+ etree_tag = name
+ else:
+ etree_tag = "{%s}%s" % (namespace, name)
+ root.tag = etree_tag
+
+ # Add the root element to the internal child/open data structures
+ root_element = self.elementClass(name, namespace)
+ root_element._element = root
+ self.document._childNodes.append(root_element)
+ self.openElements.append(root_element)
+
+ # Reset to the default insert comment function
+ self.insertComment = self.insertCommentMain
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/__init__.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/__init__.py
new file mode 100644
index 0000000000..b2d3aac313
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/__init__.py
@@ -0,0 +1,154 @@
+"""A collection of modules for iterating through different kinds of
+tree, generating tokens identical to those produced by the tokenizer
+module.
+
+To create a tree walker for a new type of tree, you need to
+implement a tree walker object (called TreeWalker by convention) that
+implements a 'serialize' method which takes a tree as sole argument and
+returns an iterator which generates tokens.
+"""
+
+from __future__ import absolute_import, division, unicode_literals
+
+from .. import constants
+from .._utils import default_etree
+
+__all__ = ["getTreeWalker", "pprint"]
+
+treeWalkerCache = {}
+
+
+def getTreeWalker(treeType, implementation=None, **kwargs):
+ """Get a TreeWalker class for various types of tree with built-in support
+
+ :arg str treeType: the name of the tree type required (case-insensitive).
+ Supported values are:
+
+ * "dom": The xml.dom.minidom DOM implementation
+ * "etree": A generic walker for tree implementations exposing an
+ elementtree-like interface (known to work with ElementTree,
+ cElementTree and lxml.etree).
+ * "lxml": Optimized walker for lxml.etree
+ * "genshi": a Genshi stream
+
+ :arg implementation: A module implementing the tree type e.g.
+ xml.etree.ElementTree or cElementTree (Currently applies to the "etree"
+ tree type only).
+
+ :arg kwargs: keyword arguments passed to the etree walker--for other
+ walkers, this has no effect
+
+ :returns: a TreeWalker class
+
+ """
+
+ treeType = treeType.lower()
+ if treeType not in treeWalkerCache:
+ if treeType == "dom":
+ from . import dom
+ treeWalkerCache[treeType] = dom.TreeWalker
+ elif treeType == "genshi":
+ from . import genshi
+ treeWalkerCache[treeType] = genshi.TreeWalker
+ elif treeType == "lxml":
+ from . import etree_lxml
+ treeWalkerCache[treeType] = etree_lxml.TreeWalker
+ elif treeType == "etree":
+ from . import etree
+ if implementation is None:
+ implementation = default_etree
+ # XXX: NEVER cache here, caching is done in the etree submodule
+ return etree.getETreeModule(implementation, **kwargs).TreeWalker
+ return treeWalkerCache.get(treeType)
+
+
+def concatenateCharacterTokens(tokens):
+ pendingCharacters = []
+ for token in tokens:
+ type = token["type"]
+ if type in ("Characters", "SpaceCharacters"):
+ pendingCharacters.append(token["data"])
+ else:
+ if pendingCharacters:
+ yield {"type": "Characters", "data": "".join(pendingCharacters)}
+ pendingCharacters = []
+ yield token
+ if pendingCharacters:
+ yield {"type": "Characters", "data": "".join(pendingCharacters)}
+
+
+def pprint(walker):
+ """Pretty printer for tree walkers
+
+ Takes a TreeWalker instance and pretty prints the output of walking the tree.
+
+ :arg walker: a TreeWalker instance
+
+ """
+ output = []
+ indent = 0
+ for token in concatenateCharacterTokens(walker):
+ type = token["type"]
+ if type in ("StartTag", "EmptyTag"):
+ # tag name
+ if token["namespace"] and token["namespace"] != constants.namespaces["html"]:
+ if token["namespace"] in constants.prefixes:
+ ns = constants.prefixes[token["namespace"]]
+ else:
+ ns = token["namespace"]
+ name = "%s %s" % (ns, token["name"])
+ else:
+ name = token["name"]
+ output.append("%s<%s>" % (" " * indent, name))
+ indent += 2
+ # attributes (sorted for consistent ordering)
+ attrs = token["data"]
+ for (namespace, localname), value in sorted(attrs.items()):
+ if namespace:
+ if namespace in constants.prefixes:
+ ns = constants.prefixes[namespace]
+ else:
+ ns = namespace
+ name = "%s %s" % (ns, localname)
+ else:
+ name = localname
+ output.append("%s%s=\"%s\"" % (" " * indent, name, value))
+ # self-closing
+ if type == "EmptyTag":
+ indent -= 2
+
+ elif type == "EndTag":
+ indent -= 2
+
+ elif type == "Comment":
+ output.append("%s<!-- %s -->" % (" " * indent, token["data"]))
+
+ elif type == "Doctype":
+ if token["name"]:
+ if token["publicId"]:
+ output.append("""%s<!DOCTYPE %s "%s" "%s">""" %
+ (" " * indent,
+ token["name"],
+ token["publicId"],
+ token["systemId"] if token["systemId"] else ""))
+ elif token["systemId"]:
+ output.append("""%s<!DOCTYPE %s "" "%s">""" %
+ (" " * indent,
+ token["name"],
+ token["systemId"]))
+ else:
+ output.append("%s<!DOCTYPE %s>" % (" " * indent,
+ token["name"]))
+ else:
+ output.append("%s<!DOCTYPE >" % (" " * indent,))
+
+ elif type == "Characters":
+ output.append("%s\"%s\"" % (" " * indent, token["data"]))
+
+ elif type == "SpaceCharacters":
+ assert False, "concatenateCharacterTokens should have got rid of all Space tokens"
+
+ else:
+ raise ValueError("Unknown token type, %s" % type)
+
+ return "\n".join(output)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/base.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/base.py
new file mode 100644
index 0000000000..80c474c4e9
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/base.py
@@ -0,0 +1,252 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from xml.dom import Node
+from ..constants import namespaces, voidElements, spaceCharacters
+
+__all__ = ["DOCUMENT", "DOCTYPE", "TEXT", "ELEMENT", "COMMENT", "ENTITY", "UNKNOWN",
+ "TreeWalker", "NonRecursiveTreeWalker"]
+
+DOCUMENT = Node.DOCUMENT_NODE
+DOCTYPE = Node.DOCUMENT_TYPE_NODE
+TEXT = Node.TEXT_NODE
+ELEMENT = Node.ELEMENT_NODE
+COMMENT = Node.COMMENT_NODE
+ENTITY = Node.ENTITY_NODE
+UNKNOWN = "<#UNKNOWN#>"
+
+spaceCharacters = "".join(spaceCharacters)
+
+
+class TreeWalker(object):
+ """Walks a tree yielding tokens
+
+ Tokens are dicts that all have a ``type`` field specifying the type of the
+ token.
+
+ """
+ def __init__(self, tree):
+ """Creates a TreeWalker
+
+ :arg tree: the tree to walk
+
+ """
+ self.tree = tree
+
+ def __iter__(self):
+ raise NotImplementedError
+
+ def error(self, msg):
+ """Generates an error token with the given message
+
+ :arg msg: the error message
+
+ :returns: SerializeError token
+
+ """
+ return {"type": "SerializeError", "data": msg}
+
+ def emptyTag(self, namespace, name, attrs, hasChildren=False):
+ """Generates an EmptyTag token
+
+ :arg namespace: the namespace of the token--can be ``None``
+
+ :arg name: the name of the element
+
+ :arg attrs: the attributes of the element as a dict
+
+ :arg hasChildren: whether or not to yield a SerializationError because
+ this tag shouldn't have children
+
+ :returns: EmptyTag token
+
+ """
+ yield {"type": "EmptyTag", "name": name,
+ "namespace": namespace,
+ "data": attrs}
+ if hasChildren:
+ yield self.error("Void element has children")
+
+ def startTag(self, namespace, name, attrs):
+ """Generates a StartTag token
+
+ :arg namespace: the namespace of the token--can be ``None``
+
+ :arg name: the name of the element
+
+ :arg attrs: the attributes of the element as a dict
+
+ :returns: StartTag token
+
+ """
+ return {"type": "StartTag",
+ "name": name,
+ "namespace": namespace,
+ "data": attrs}
+
+ def endTag(self, namespace, name):
+ """Generates an EndTag token
+
+ :arg namespace: the namespace of the token--can be ``None``
+
+ :arg name: the name of the element
+
+ :returns: EndTag token
+
+ """
+ return {"type": "EndTag",
+ "name": name,
+ "namespace": namespace}
+
+ def text(self, data):
+ """Generates SpaceCharacters and Characters tokens
+
+ Depending on what's in the data, this generates one or more
+ ``SpaceCharacters`` and ``Characters`` tokens.
+
+ For example:
+
+ >>> from html5lib.treewalkers.base import TreeWalker
+ >>> # Give it an empty tree just so it instantiates
+ >>> walker = TreeWalker([])
+ >>> list(walker.text(''))
+ []
+ >>> list(walker.text(' '))
+ [{u'data': ' ', u'type': u'SpaceCharacters'}]
+ >>> list(walker.text(' abc ')) # doctest: +NORMALIZE_WHITESPACE
+ [{u'data': ' ', u'type': u'SpaceCharacters'},
+ {u'data': u'abc', u'type': u'Characters'},
+ {u'data': u' ', u'type': u'SpaceCharacters'}]
+
+ :arg data: the text data
+
+ :returns: one or more ``SpaceCharacters`` and ``Characters`` tokens
+
+ """
+ data = data
+ middle = data.lstrip(spaceCharacters)
+ left = data[:len(data) - len(middle)]
+ if left:
+ yield {"type": "SpaceCharacters", "data": left}
+ data = middle
+ middle = data.rstrip(spaceCharacters)
+ right = data[len(middle):]
+ if middle:
+ yield {"type": "Characters", "data": middle}
+ if right:
+ yield {"type": "SpaceCharacters", "data": right}
+
+ def comment(self, data):
+ """Generates a Comment token
+
+ :arg data: the comment
+
+ :returns: Comment token
+
+ """
+ return {"type": "Comment", "data": data}
+
+ def doctype(self, name, publicId=None, systemId=None):
+ """Generates a Doctype token
+
+ :arg name:
+
+ :arg publicId:
+
+ :arg systemId:
+
+ :returns: the Doctype token
+
+ """
+ return {"type": "Doctype",
+ "name": name,
+ "publicId": publicId,
+ "systemId": systemId}
+
+ def entity(self, name):
+ """Generates an Entity token
+
+ :arg name: the entity name
+
+ :returns: an Entity token
+
+ """
+ return {"type": "Entity", "name": name}
+
+ def unknown(self, nodeType):
+ """Handles unknown node types"""
+ return self.error("Unknown node type: " + nodeType)
+
+
+class NonRecursiveTreeWalker(TreeWalker):
+ def getNodeDetails(self, node):
+ raise NotImplementedError
+
+ def getFirstChild(self, node):
+ raise NotImplementedError
+
+ def getNextSibling(self, node):
+ raise NotImplementedError
+
+ def getParentNode(self, node):
+ raise NotImplementedError
+
+ def __iter__(self):
+ currentNode = self.tree
+ while currentNode is not None:
+ details = self.getNodeDetails(currentNode)
+ type, details = details[0], details[1:]
+ hasChildren = False
+
+ if type == DOCTYPE:
+ yield self.doctype(*details)
+
+ elif type == TEXT:
+ for token in self.text(*details):
+ yield token
+
+ elif type == ELEMENT:
+ namespace, name, attributes, hasChildren = details
+ if (not namespace or namespace == namespaces["html"]) and name in voidElements:
+ for token in self.emptyTag(namespace, name, attributes,
+ hasChildren):
+ yield token
+ hasChildren = False
+ else:
+ yield self.startTag(namespace, name, attributes)
+
+ elif type == COMMENT:
+ yield self.comment(details[0])
+
+ elif type == ENTITY:
+ yield self.entity(details[0])
+
+ elif type == DOCUMENT:
+ hasChildren = True
+
+ else:
+ yield self.unknown(details[0])
+
+ if hasChildren:
+ firstChild = self.getFirstChild(currentNode)
+ else:
+ firstChild = None
+
+ if firstChild is not None:
+ currentNode = firstChild
+ else:
+ while currentNode is not None:
+ details = self.getNodeDetails(currentNode)
+ type, details = details[0], details[1:]
+ if type == ELEMENT:
+ namespace, name, attributes, hasChildren = details
+ if (namespace and namespace != namespaces["html"]) or name not in voidElements:
+ yield self.endTag(namespace, name)
+ if self.tree is currentNode:
+ currentNode = None
+ break
+ nextSibling = self.getNextSibling(currentNode)
+ if nextSibling is not None:
+ currentNode = nextSibling
+ break
+ else:
+ currentNode = self.getParentNode(currentNode)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/dom.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/dom.py
new file mode 100644
index 0000000000..b0c89b001f
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/dom.py
@@ -0,0 +1,43 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from xml.dom import Node
+
+from . import base
+
+
+class TreeWalker(base.NonRecursiveTreeWalker):
+ def getNodeDetails(self, node):
+ if node.nodeType == Node.DOCUMENT_TYPE_NODE:
+ return base.DOCTYPE, node.name, node.publicId, node.systemId
+
+ elif node.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):
+ return base.TEXT, node.nodeValue
+
+ elif node.nodeType == Node.ELEMENT_NODE:
+ attrs = {}
+ for attr in list(node.attributes.keys()):
+ attr = node.getAttributeNode(attr)
+ if attr.namespaceURI:
+ attrs[(attr.namespaceURI, attr.localName)] = attr.value
+ else:
+ attrs[(None, attr.name)] = attr.value
+ return (base.ELEMENT, node.namespaceURI, node.nodeName,
+ attrs, node.hasChildNodes())
+
+ elif node.nodeType == Node.COMMENT_NODE:
+ return base.COMMENT, node.nodeValue
+
+ elif node.nodeType in (Node.DOCUMENT_NODE, Node.DOCUMENT_FRAGMENT_NODE):
+ return (base.DOCUMENT,)
+
+ else:
+ return base.UNKNOWN, node.nodeType
+
+ def getFirstChild(self, node):
+ return node.firstChild
+
+ def getNextSibling(self, node):
+ return node.nextSibling
+
+ def getParentNode(self, node):
+ return node.parentNode
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/etree.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/etree.py
new file mode 100644
index 0000000000..44653372d6
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/etree.py
@@ -0,0 +1,131 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from collections import OrderedDict
+import re
+
+from six import string_types
+
+from . import base
+from .._utils import moduleFactoryFactory
+
+tag_regexp = re.compile("{([^}]*)}(.*)")
+
+
+def getETreeBuilder(ElementTreeImplementation):
+ ElementTree = ElementTreeImplementation
+ ElementTreeCommentType = ElementTree.Comment("asd").tag
+
+ class TreeWalker(base.NonRecursiveTreeWalker): # pylint:disable=unused-variable
+ """Given the particular ElementTree representation, this implementation,
+ to avoid using recursion, returns "nodes" as tuples with the following
+ content:
+
+ 1. The current element
+
+ 2. The index of the element relative to its parent
+
+ 3. A stack of ancestor elements
+
+ 4. A flag "text", "tail" or None to indicate if the current node is a
+ text node; either the text or tail of the current element (1)
+ """
+ def getNodeDetails(self, node):
+ if isinstance(node, tuple): # It might be the root Element
+ elt, _, _, flag = node
+ if flag in ("text", "tail"):
+ return base.TEXT, getattr(elt, flag)
+ else:
+ node = elt
+
+ if not(hasattr(node, "tag")):
+ node = node.getroot()
+
+ if node.tag in ("DOCUMENT_ROOT", "DOCUMENT_FRAGMENT"):
+ return (base.DOCUMENT,)
+
+ elif node.tag == "<!DOCTYPE>":
+ return (base.DOCTYPE, node.text,
+ node.get("publicId"), node.get("systemId"))
+
+ elif node.tag == ElementTreeCommentType:
+ return base.COMMENT, node.text
+
+ else:
+ assert isinstance(node.tag, string_types), type(node.tag)
+ # This is assumed to be an ordinary element
+ match = tag_regexp.match(node.tag)
+ if match:
+ namespace, tag = match.groups()
+ else:
+ namespace = None
+ tag = node.tag
+ attrs = OrderedDict()
+ for name, value in list(node.attrib.items()):
+ match = tag_regexp.match(name)
+ if match:
+ attrs[(match.group(1), match.group(2))] = value
+ else:
+ attrs[(None, name)] = value
+ return (base.ELEMENT, namespace, tag,
+ attrs, len(node) or node.text)
+
+ def getFirstChild(self, node):
+ if isinstance(node, tuple):
+ element, key, parents, flag = node
+ else:
+ element, key, parents, flag = node, None, [], None
+
+ if flag in ("text", "tail"):
+ return None
+ else:
+ if element.text:
+ return element, key, parents, "text"
+ elif len(element):
+ parents.append(element)
+ return element[0], 0, parents, None
+ else:
+ return None
+
+ def getNextSibling(self, node):
+ if isinstance(node, tuple):
+ element, key, parents, flag = node
+ else:
+ return None
+
+ if flag == "text":
+ if len(element):
+ parents.append(element)
+ return element[0], 0, parents, None
+ else:
+ return None
+ else:
+ if element.tail and flag != "tail":
+ return element, key, parents, "tail"
+ elif key < len(parents[-1]) - 1:
+ return parents[-1][key + 1], key + 1, parents, None
+ else:
+ return None
+
+ def getParentNode(self, node):
+ if isinstance(node, tuple):
+ element, key, parents, flag = node
+ else:
+ return None
+
+ if flag == "text":
+ if not parents:
+ return element
+ else:
+ return element, key, parents, None
+ else:
+ parent = parents.pop()
+ if not parents:
+ return parent
+ else:
+ assert list(parents[-1]).count(parent) == 1
+ return parent, list(parents[-1]).index(parent), parents, None
+
+ return locals()
+
+
+getETreeModule = moduleFactoryFactory(getETreeBuilder)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/etree_lxml.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/etree_lxml.py
new file mode 100644
index 0000000000..a614ac5b3f
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/etree_lxml.py
@@ -0,0 +1,215 @@
+from __future__ import absolute_import, division, unicode_literals
+from six import text_type
+
+from collections import OrderedDict
+
+from lxml import etree
+from ..treebuilders.etree import tag_regexp
+
+from . import base
+
+from .. import _ihatexml
+
+
+def ensure_str(s):
+ if s is None:
+ return None
+ elif isinstance(s, text_type):
+ return s
+ else:
+ return s.decode("ascii", "strict")
+
+
+class Root(object):
+ def __init__(self, et):
+ self.elementtree = et
+ self.children = []
+
+ try:
+ if et.docinfo.internalDTD:
+ self.children.append(Doctype(self,
+ ensure_str(et.docinfo.root_name),
+ ensure_str(et.docinfo.public_id),
+ ensure_str(et.docinfo.system_url)))
+ except AttributeError:
+ pass
+
+ try:
+ node = et.getroot()
+ except AttributeError:
+ node = et
+
+ while node.getprevious() is not None:
+ node = node.getprevious()
+ while node is not None:
+ self.children.append(node)
+ node = node.getnext()
+
+ self.text = None
+ self.tail = None
+
+ def __getitem__(self, key):
+ return self.children[key]
+
+ def getnext(self):
+ return None
+
+ def __len__(self):
+ return 1
+
+
+class Doctype(object):
+ def __init__(self, root_node, name, public_id, system_id):
+ self.root_node = root_node
+ self.name = name
+ self.public_id = public_id
+ self.system_id = system_id
+
+ self.text = None
+ self.tail = None
+
+ def getnext(self):
+ return self.root_node.children[1]
+
+
+class FragmentRoot(Root):
+ def __init__(self, children):
+ self.children = [FragmentWrapper(self, child) for child in children]
+ self.text = self.tail = None
+
+ def getnext(self):
+ return None
+
+
+class FragmentWrapper(object):
+ def __init__(self, fragment_root, obj):
+ self.root_node = fragment_root
+ self.obj = obj
+ if hasattr(self.obj, 'text'):
+ self.text = ensure_str(self.obj.text)
+ else:
+ self.text = None
+ if hasattr(self.obj, 'tail'):
+ self.tail = ensure_str(self.obj.tail)
+ else:
+ self.tail = None
+
+ def __getattr__(self, name):
+ return getattr(self.obj, name)
+
+ def getnext(self):
+ siblings = self.root_node.children
+ idx = siblings.index(self)
+ if idx < len(siblings) - 1:
+ return siblings[idx + 1]
+ else:
+ return None
+
+ def __getitem__(self, key):
+ return self.obj[key]
+
+ def __bool__(self):
+ return bool(self.obj)
+
+ def getparent(self):
+ return None
+
+ def __str__(self):
+ return str(self.obj)
+
+ def __unicode__(self):
+ return str(self.obj)
+
+ def __len__(self):
+ return len(self.obj)
+
+
+class TreeWalker(base.NonRecursiveTreeWalker):
+ def __init__(self, tree):
+ # pylint:disable=redefined-variable-type
+ if isinstance(tree, list):
+ self.fragmentChildren = set(tree)
+ tree = FragmentRoot(tree)
+ else:
+ self.fragmentChildren = set()
+ tree = Root(tree)
+ base.NonRecursiveTreeWalker.__init__(self, tree)
+ self.filter = _ihatexml.InfosetFilter()
+
+ def getNodeDetails(self, node):
+ if isinstance(node, tuple): # Text node
+ node, key = node
+ assert key in ("text", "tail"), "Text nodes are text or tail, found %s" % key
+ return base.TEXT, ensure_str(getattr(node, key))
+
+ elif isinstance(node, Root):
+ return (base.DOCUMENT,)
+
+ elif isinstance(node, Doctype):
+ return base.DOCTYPE, node.name, node.public_id, node.system_id
+
+ elif isinstance(node, FragmentWrapper) and not hasattr(node, "tag"):
+ return base.TEXT, ensure_str(node.obj)
+
+ elif node.tag == etree.Comment:
+ return base.COMMENT, ensure_str(node.text)
+
+ elif node.tag == etree.Entity:
+ return base.ENTITY, ensure_str(node.text)[1:-1] # strip &;
+
+ else:
+ # This is assumed to be an ordinary element
+ match = tag_regexp.match(ensure_str(node.tag))
+ if match:
+ namespace, tag = match.groups()
+ else:
+ namespace = None
+ tag = ensure_str(node.tag)
+ attrs = OrderedDict()
+ for name, value in list(node.attrib.items()):
+ name = ensure_str(name)
+ value = ensure_str(value)
+ match = tag_regexp.match(name)
+ if match:
+ attrs[(match.group(1), match.group(2))] = value
+ else:
+ attrs[(None, name)] = value
+ return (base.ELEMENT, namespace, self.filter.fromXmlName(tag),
+ attrs, len(node) > 0 or node.text)
+
+ def getFirstChild(self, node):
+ assert not isinstance(node, tuple), "Text nodes have no children"
+
+ assert len(node) or node.text, "Node has no children"
+ if node.text:
+ return (node, "text")
+ else:
+ return node[0]
+
+ def getNextSibling(self, node):
+ if isinstance(node, tuple): # Text node
+ node, key = node
+ assert key in ("text", "tail"), "Text nodes are text or tail, found %s" % key
+ if key == "text":
+ # XXX: we cannot use a "bool(node) and node[0] or None" construct here
+ # because node[0] might evaluate to False if it has no child element
+ if len(node):
+ return node[0]
+ else:
+ return None
+ else: # tail
+ return node.getnext()
+
+ return (node, "tail") if node.tail else node.getnext()
+
+ def getParentNode(self, node):
+ if isinstance(node, tuple): # Text node
+ node, key = node
+ assert key in ("text", "tail"), "Text nodes are text or tail, found %s" % key
+ if key == "text":
+ return node
+ # else: fallback to "normal" processing
+ elif node in self.fragmentChildren:
+ return None
+
+ return node.getparent()
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/genshi.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/genshi.py
new file mode 100644
index 0000000000..7483be27d4
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treewalkers/genshi.py
@@ -0,0 +1,69 @@
+from __future__ import absolute_import, division, unicode_literals
+
+from genshi.core import QName
+from genshi.core import START, END, XML_NAMESPACE, DOCTYPE, TEXT
+from genshi.core import START_NS, END_NS, START_CDATA, END_CDATA, PI, COMMENT
+
+from . import base
+
+from ..constants import voidElements, namespaces
+
+
+class TreeWalker(base.TreeWalker):
+ def __iter__(self):
+ # Buffer the events so we can pass in the following one
+ previous = None
+ for event in self.tree:
+ if previous is not None:
+ for token in self.tokens(previous, event):
+ yield token
+ previous = event
+
+ # Don't forget the final event!
+ if previous is not None:
+ for token in self.tokens(previous, None):
+ yield token
+
+ def tokens(self, event, next):
+ kind, data, _ = event
+ if kind == START:
+ tag, attribs = data
+ name = tag.localname
+ namespace = tag.namespace
+ converted_attribs = {}
+ for k, v in attribs:
+ if isinstance(k, QName):
+ converted_attribs[(k.namespace, k.localname)] = v
+ else:
+ converted_attribs[(None, k)] = v
+
+ if namespace == namespaces["html"] and name in voidElements:
+ for token in self.emptyTag(namespace, name, converted_attribs,
+ not next or next[0] != END or
+ next[1] != tag):
+ yield token
+ else:
+ yield self.startTag(namespace, name, converted_attribs)
+
+ elif kind == END:
+ name = data.localname
+ namespace = data.namespace
+ if namespace != namespaces["html"] or name not in voidElements:
+ yield self.endTag(namespace, name)
+
+ elif kind == COMMENT:
+ yield self.comment(data)
+
+ elif kind == TEXT:
+ for token in self.text(data):
+ yield token
+
+ elif kind == DOCTYPE:
+ yield self.doctype(*data)
+
+ elif kind in (XML_NAMESPACE, DOCTYPE, START_NS, END_NS,
+ START_CDATA, END_CDATA, PI):
+ pass
+
+ else:
+ yield self.unknown(kind)
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/parse.py b/testing/web-platform/tests/tools/third_party/html5lib/parse.py
new file mode 100755
index 0000000000..e6806b4607
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/parse.py
@@ -0,0 +1,236 @@
+#!/usr/bin/env python
+"""
+Parse a document to a tree, with optional profiling
+"""
+
+import argparse
+import sys
+import traceback
+
+from html5lib import html5parser
+from html5lib import treebuilders, serializer, treewalkers
+from html5lib import constants
+from html5lib import _utils
+
+
+def parse():
+ parser = get_parser()
+ opts = parser.parse_args()
+ encoding = "utf8"
+
+ try:
+ f = opts.filename
+ # Try opening from the internet
+ if f.startswith('http://'):
+ try:
+ import urllib.request
+ import urllib.parse
+ import urllib.error
+ import cgi
+ f = urllib.request.urlopen(f)
+ contentType = f.headers.get('content-type')
+ if contentType:
+ (mediaType, params) = cgi.parse_header(contentType)
+ encoding = params.get('charset')
+ except Exception:
+ pass
+ elif f == '-':
+ f = sys.stdin
+ if sys.version_info[0] >= 3:
+ encoding = None
+ else:
+ try:
+ # Try opening from file system
+ f = open(f, "rb")
+ except IOError as e:
+ sys.stderr.write("Unable to open file: %s\n" % e)
+ sys.exit(1)
+ except IndexError:
+ sys.stderr.write("No filename provided. Use -h for help\n")
+ sys.exit(1)
+
+ treebuilder = treebuilders.getTreeBuilder(opts.treebuilder)
+
+ p = html5parser.HTMLParser(tree=treebuilder, debug=opts.log)
+
+ if opts.fragment:
+ parseMethod = p.parseFragment
+ else:
+ parseMethod = p.parse
+
+ if opts.profile:
+ import cProfile
+ import pstats
+ cProfile.runctx("run(parseMethod, f, encoding, scripting)", None,
+ {"run": run,
+ "parseMethod": parseMethod,
+ "f": f,
+ "encoding": encoding,
+ "scripting": opts.scripting},
+ "stats.prof")
+ # XXX - We should use a temp file here
+ stats = pstats.Stats('stats.prof')
+ stats.strip_dirs()
+ stats.sort_stats('time')
+ stats.print_stats()
+ elif opts.time:
+ import time
+ t0 = time.time()
+ document = run(parseMethod, f, encoding, opts.scripting)
+ t1 = time.time()
+ if document:
+ printOutput(p, document, opts)
+ t2 = time.time()
+ sys.stderr.write("\n\nRun took: %fs (plus %fs to print the output)" % (t1 - t0, t2 - t1))
+ else:
+ sys.stderr.write("\n\nRun took: %fs" % (t1 - t0))
+ else:
+ document = run(parseMethod, f, encoding, opts.scripting)
+ if document:
+ printOutput(p, document, opts)
+
+
+def run(parseMethod, f, encoding, scripting):
+ try:
+ document = parseMethod(f, override_encoding=encoding, scripting=scripting)
+ except Exception:
+ document = None
+ traceback.print_exc()
+ return document
+
+
+def printOutput(parser, document, opts):
+ if opts.encoding:
+ print("Encoding:", parser.tokenizer.stream.charEncoding)
+
+ for item in parser.log:
+ print(item)
+
+ if document is not None:
+ if opts.xml:
+ tb = opts.treebuilder.lower()
+ if tb == "dom":
+ document.writexml(sys.stdout, encoding="utf-8")
+ elif tb == "lxml":
+ import lxml.etree
+ sys.stdout.write(lxml.etree.tostring(document, encoding="unicode"))
+ elif tb == "etree":
+ sys.stdout.write(_utils.default_etree.tostring(document, encoding="unicode"))
+ elif opts.tree:
+ if not hasattr(document, '__getitem__'):
+ document = [document]
+ for fragment in document:
+ print(parser.tree.testSerializer(fragment))
+ elif opts.html:
+ kwargs = {}
+ for opt in serializer.HTMLSerializer.options:
+ try:
+ kwargs[opt] = getattr(opts, opt)
+ except Exception:
+ pass
+ if not kwargs['quote_char']:
+ del kwargs['quote_char']
+
+ if opts.sanitize:
+ kwargs["sanitize"] = True
+
+ tokens = treewalkers.getTreeWalker(opts.treebuilder)(document)
+ if sys.version_info[0] >= 3:
+ encoding = None
+ else:
+ encoding = "utf-8"
+ for text in serializer.HTMLSerializer(**kwargs).serialize(tokens, encoding=encoding):
+ sys.stdout.write(text)
+ if not text.endswith('\n'):
+ sys.stdout.write('\n')
+ if opts.error:
+ errList = []
+ for pos, errorcode, datavars in parser.errors:
+ errList.append("Line %i Col %i" % pos + " " + constants.E.get(errorcode, 'Unknown error "%s"' % errorcode) % datavars)
+ sys.stdout.write("\nParse errors:\n" + "\n".join(errList) + "\n")
+
+
+def get_parser():
+ parser = argparse.ArgumentParser(description=__doc__)
+
+ parser.add_argument("-p", "--profile", action="store_true",
+ help="Use the hotshot profiler to "
+ "produce a detailed log of the run")
+
+ parser.add_argument("-t", "--time",
+ action="store_true",
+ help="Time the run using time.time (may not be accurate on all platforms, especially for short runs)")
+
+ parser.add_argument("-b", "--treebuilder",
+ default="etree")
+
+ parser.add_argument("-e", "--error", action="store_true",
+ help="Print a list of parse errors")
+
+ parser.add_argument("-f", "--fragment", action="store_true",
+ help="Parse as a fragment")
+
+ parser.add_argument("-s", "--scripting", action="store_true",
+ help="Handle noscript tags as if scripting was enabled")
+
+ parser.add_argument("--tree", action="store_true",
+ help="Output as debug tree")
+
+ parser.add_argument("-x", "--xml", action="store_true",
+ help="Output as xml")
+
+ parser.add_argument("--no-html", action="store_false",
+ dest="html", help="Don't output html")
+
+ parser.add_argument("-c", "--encoding", action="store_true",
+ help="Print character encoding used")
+
+ parser.add_argument("--inject-meta-charset", action="store_true",
+ help="inject <meta charset>")
+
+ parser.add_argument("--strip-whitespace", action="store_true",
+ help="strip whitespace")
+
+ parser.add_argument("--omit-optional-tags", action="store_true",
+ help="omit optional tags")
+
+ parser.add_argument("--quote-attr-values", action="store_true",
+ help="quote attribute values")
+
+ parser.add_argument("--use-best-quote-char", action="store_true",
+ help="use best quote character")
+
+ parser.add_argument("--quote-char",
+ help="quote character")
+
+ parser.add_argument("--no-minimize-boolean-attributes",
+ action="store_false",
+ dest="minimize_boolean_attributes",
+ help="minimize boolean attributes")
+
+ parser.add_argument("--use-trailing-solidus", action="store_true",
+ help="use trailing solidus")
+
+ parser.add_argument("--space-before-trailing-solidus",
+ action="store_true",
+ help="add space before trailing solidus")
+
+ parser.add_argument("--escape-lt-in-attrs", action="store_true",
+ help="escape less than signs in attribute values")
+
+ parser.add_argument("--escape-rcdata", action="store_true",
+ help="escape rcdata element values")
+
+ parser.add_argument("--sanitize", action="store_true",
+ help="sanitize")
+
+ parser.add_argument("-l", "--log", action="store_true",
+ help="log state transitions")
+
+ parser.add_argument("filename")
+
+ return parser
+
+
+if __name__ == "__main__":
+ parse()
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/pytest.ini b/testing/web-platform/tests/tools/third_party/html5lib/pytest.ini
new file mode 100644
index 0000000000..8824977a8f
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/pytest.ini
@@ -0,0 +1,17 @@
+[pytest]
+# Output fails, errors, xpass, and warnings; ignore doctest; make warnings errors
+addopts = -rfEXw -p no:doctest --strict
+
+# Make xpass results be considered fail
+xfail_strict = true
+
+# Document our markers
+markers =
+ DOM: mark a test as a DOM tree test
+ ElementTree: mark a test as a ElementTree tree test
+ cElementTree: mark a test as a cElementTree tree test
+ lxml: mark a test as a lxml tree test
+ genshi: mark a test as a genshi tree test
+ parser: mark a test as a parser test
+ namespaced: mark a test as a namespaced parser test
+ treewalker: mark a test as a treewalker test
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/requirements-install.sh b/testing/web-platform/tests/tools/third_party/html5lib/requirements-install.sh
new file mode 100755
index 0000000000..b7a8d96dd6
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/requirements-install.sh
@@ -0,0 +1,15 @@
+#!/bin/bash -ex
+
+if [[ $SIX_VERSION ]]; then
+ pip install six==$SIX_VERSION
+fi
+
+pip install -r requirements-test.txt
+
+if [[ $USE_OPTIONAL == "true" ]]; then
+ pip install -r requirements-optional.txt
+fi
+
+if [[ $CI == "true" ]]; then
+ pip install codecov
+fi
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/requirements-optional.txt b/testing/web-platform/tests/tools/third_party/html5lib/requirements-optional.txt
new file mode 100644
index 0000000000..2e78c952c1
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/requirements-optional.txt
@@ -0,0 +1,13 @@
+-r requirements.txt
+
+# We support a Genshi treewalker that can be used to serialize Genshi
+# streams.
+genshi
+
+# chardet can be used as a fallback in case we are unable to determine
+# the encoding of a document.
+chardet>=2.2
+
+# lxml is supported with its own treebuilder ("lxml") and otherwise
+# uses the standard ElementTree support
+lxml ; platform_python_implementation == 'CPython'
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/requirements-test.txt b/testing/web-platform/tests/tools/third_party/html5lib/requirements-test.txt
new file mode 100644
index 0000000000..703d0e690f
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/requirements-test.txt
@@ -0,0 +1,10 @@
+-r requirements.txt
+
+tox>=3.15.1,<4
+flake8>=3.8.1,<3.9
+pytest>=4.6.10,<5 ; python_version < '3'
+pytest>=5.4.2,<6 ; python_version >= '3'
+coverage>=5.1,<6
+pytest-expect>=1.1.0,<2
+mock>=3.0.5,<4 ; python_version < '3.6'
+mock>=4.0.2,<5 ; python_version >= '3.6'
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/requirements.txt b/testing/web-platform/tests/tools/third_party/html5lib/requirements.txt
new file mode 100644
index 0000000000..ae7ec3d08b
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/requirements.txt
@@ -0,0 +1,2 @@
+six>=1.9
+webencodings
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/setup.cfg b/testing/web-platform/tests/tools/third_party/html5lib/setup.cfg
new file mode 100644
index 0000000000..0b2bb9c79b
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/setup.cfg
@@ -0,0 +1,11 @@
+[bdist_wheel]
+universal = 1
+
+[pep8]
+ignore = N
+max-line-length = 139
+exclude = .git,__pycache__,.tox,doc
+
+[flake8]
+ignore = N, W504
+max-line-length = 139
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/setup.py b/testing/web-platform/tests/tools/third_party/html5lib/setup.py
new file mode 100644
index 0000000000..f84c128496
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/setup.py
@@ -0,0 +1,127 @@
+from __future__ import print_function
+
+import ast
+import codecs
+import sys
+
+from os.path import join, dirname
+from setuptools import setup, find_packages, __version__ as setuptools_version
+from pkg_resources import parse_version
+
+import pkg_resources
+
+try:
+ import _markerlib.markers
+except ImportError:
+ _markerlib = None
+
+
+# _markerlib.default_environment() obtains its data from _VARS
+# and wraps it in another dict, but _markerlib_evaluate writes
+# to the dict while it is iterating the keys, causing an error
+# on Python 3 only.
+# Replace _markerlib.default_environment to return a custom dict
+# that has all the necessary markers, and ignores any writes.
+
+class Python3MarkerDict(dict):
+
+ def __setitem__(self, key, value):
+ pass
+
+ def pop(self, i=-1):
+ return self[i]
+
+
+if _markerlib and sys.version_info[0] == 3:
+ env = _markerlib.markers._VARS
+ for key in list(env.keys()):
+ new_key = key.replace('.', '_')
+ if new_key != key:
+ env[new_key] = env[key]
+
+ _markerlib.markers._VARS = Python3MarkerDict(env)
+
+ def default_environment():
+ return _markerlib.markers._VARS
+
+ _markerlib.default_environment = default_environment
+
+# Avoid the very buggy pkg_resources.parser, which doesn't consistently
+# recognise the markers needed by this setup.py
+# Change this to setuptools 20.10.0 to support all markers.
+if pkg_resources:
+ if parse_version(setuptools_version) < parse_version('18.5'):
+ MarkerEvaluation = pkg_resources.MarkerEvaluation
+
+ del pkg_resources.parser
+ pkg_resources.evaluate_marker = MarkerEvaluation._markerlib_evaluate
+ MarkerEvaluation.evaluate_marker = MarkerEvaluation._markerlib_evaluate
+
+classifiers = [
+ 'Development Status :: 5 - Production/Stable',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: MIT License',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: Implementation :: CPython',
+ 'Programming Language :: Python :: Implementation :: PyPy',
+ 'Topic :: Software Development :: Libraries :: Python Modules',
+ 'Topic :: Text Processing :: Markup :: HTML'
+]
+
+here = dirname(__file__)
+with codecs.open(join(here, 'README.rst'), 'r', 'utf8') as readme_file:
+ with codecs.open(join(here, 'CHANGES.rst'), 'r', 'utf8') as changes_file:
+ long_description = readme_file.read() + '\n' + changes_file.read()
+
+version = None
+with open(join(here, "html5lib", "__init__.py"), "rb") as init_file:
+ t = ast.parse(init_file.read(), filename="__init__.py", mode="exec")
+ assert isinstance(t, ast.Module)
+ assignments = filter(lambda x: isinstance(x, ast.Assign), t.body)
+ for a in assignments:
+ if (len(a.targets) == 1 and
+ isinstance(a.targets[0], ast.Name) and
+ a.targets[0].id == "__version__" and
+ isinstance(a.value, ast.Str)):
+ version = a.value.s
+
+setup(name='html5lib',
+ version=version,
+ url='https://github.com/html5lib/html5lib-python',
+ license="MIT License",
+ description='HTML parser based on the WHATWG HTML specification',
+ long_description=long_description,
+ classifiers=classifiers,
+ maintainer='James Graham',
+ maintainer_email='james@hoppipolla.co.uk',
+ packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
+ install_requires=[
+ 'six>=1.9',
+ 'webencodings',
+ ],
+ python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
+ extras_require={
+ # A conditional extra will only install these items when the extra is
+ # requested and the condition matches.
+ "lxml:platform_python_implementation == 'CPython'": ["lxml"],
+
+ # Standard extras, will be installed when the extra is requested.
+ "genshi": ["genshi"],
+ "chardet": ["chardet>=2.2"],
+
+ # The all extra combines a standard extra which will be used anytime
+ # the all extra is requested, and it extends it with a conditional
+ # extra that will be installed whenever the condition matches and the
+ # all extra is requested.
+ "all": ["genshi", "chardet>=2.2"],
+ "all:platform_python_implementation == 'CPython'": ["lxml"],
+ },
+ )
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/tox.ini b/testing/web-platform/tests/tools/third_party/html5lib/tox.ini
new file mode 100644
index 0000000000..58758cea13
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/tox.ini
@@ -0,0 +1,20 @@
+[tox]
+envlist = py{27,35,36,37,38,py,py3}-{base,six19,optional}
+
+[testenv]
+deps =
+ optional: -r{toxinidir}/requirements-optional.txt
+ -r{toxinidir}/requirements-test.txt
+ doc: Sphinx
+
+passenv =
+ PYTEST_COMMAND
+ COVERAGE_RUN_OPTIONS
+commands =
+ six19: pip install six==1.9
+ {env:PYTEST_COMMAND:{envbindir}/py.test} {posargs}
+ flake8 {toxinidir}
+
+[testenv:doc]
+changedir = doc
+commands = sphinx-build -b html . _build
diff --git a/testing/web-platform/tests/tools/third_party/html5lib/utils/entities.py b/testing/web-platform/tests/tools/third_party/html5lib/utils/entities.py
new file mode 100644
index 0000000000..6e8ca45806
--- /dev/null
+++ b/testing/web-platform/tests/tools/third_party/html5lib/utils/entities.py
@@ -0,0 +1,101 @@
+import json
+
+import html5lib
+
+
+def parse(path="html5ents.xml"):
+ return html5lib.parse(open(path), treebuilder="lxml")
+
+
+def entity_table(tree):
+ return {entity_name("".join(tr[0].xpath(".//text()"))):
+ entity_characters(tr[1].text)
+ for tr in tree.xpath("//h:tbody/h:tr",
+ namespaces={"h": "http://www.w3.org/1999/xhtml"})}
+
+
+def entity_name(inp):
+ return inp.strip()
+
+
+def entity_characters(inp):
+ return "".join(codepoint_to_character(item)
+ for item in inp.split()
+ if item)
+
+
+def codepoint_to_character(inp):
+ return ("\\U000" + inp[2:]).decode("unicode-escape")
+
+
+def make_tests_json(entities):
+ test_list = make_test_list(entities)
+ tests_json = {"tests":
+ [make_test(*item) for item in test_list]
+ }
+ return tests_json
+
+
+def make_test(name, characters, good):
+ return {
+ "description": test_description(name, good),
+ "input": "&%s" % name,
+ "output": test_expected(name, characters, good)
+ }
+
+
+def test_description(name, good):
+ with_semicolon = name.endswith(";")
+ semicolon_text = {True: "with a semi-colon",
+ False: "without a semi-colon"}[with_semicolon]
+ if good:
+ text = "Named entity: %s %s" % (name, semicolon_text)
+ else:
+ text = "Bad named entity: %s %s" % (name, semicolon_text)
+ return text
+
+
+def test_expected(name, characters, good):
+ rv = []
+ if not good or not name.endswith(";"):
+ rv.append("ParseError")
+ rv.append(["Character", characters])
+ return rv
+
+
+def make_test_list(entities):
+ tests = []
+ for entity_name, characters in entities.items():
+ if entity_name.endswith(";") and not subentity_exists(entity_name, entities):
+ tests.append((entity_name[:-1], "&" + entity_name[:-1], False))
+ tests.append((entity_name, characters, True))
+ return sorted(tests)
+
+
+def subentity_exists(entity_name, entities):
+ for i in range(1, len(entity_name)):
+ if entity_name[:-i] in entities:
+ return True
+ return False
+
+
+def make_entities_code(entities):
+ entities_text = "\n".join(" \"%s\": u\"%s\"," % (
+ name, entities[name].encode(
+ "unicode-escape").replace("\"", "\\\""))
+ for name in sorted(entities.keys()))
+ return """entities = {
+%s
+}""" % entities_text
+
+
+def main():
+ entities = entity_table(parse())
+ tests_json = make_tests_json(entities)
+ json.dump(tests_json, open("namedEntities.test", "w"), indent=4)
+ code = make_entities_code(entities)
+ open("entities_constants.py", "w").write(code)
+
+
+if __name__ == "__main__":
+ main()