<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[200072] trunk/LayoutTests</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/200072">200072</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-04-25 21:22:58 -0700 (Mon, 25 Apr 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Update template element tests
https://bugs.webkit.org/show_bug.cgi?id=154996

Reviewed by Daniel Bates.

LayoutTests/imported/w3c:

Reimported W3C tests for template elements as of d5a4c5bdf8a1837b4fcf50bbd2efd4150ddafa99.
Also moved the parser tests from html-templates to web-platform-tests/html/syntax to match the upstream directory structure.

* html-templates: Removed.
* html-templates/parsing-html-templates: Removed.
* html-templates/parsing-html-templates/additions-to-foster-parenting: Removed.
* html-templates/parsing-html-templates/additions-to-foster-parenting/template-is-a-foster-parent-element-expected.txt: Removed.
* html-templates/parsing-html-templates/additions-to-foster-parenting/template-is-a-foster-parent-element.html: Removed.
* html-templates/parsing-html-templates/additions-to-foster-parenting/template-is-not-a-foster-parent-element-expected.txt: Removed.
* html-templates/parsing-html-templates/additions-to-foster-parenting/template-is-not-a-foster-parent-element.html: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags-expected.txt: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags.html: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-body-token-expected.txt: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-body-token.html: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-frameset-token-expected.txt: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-frameset-token.html: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-head-token-expected.txt: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-head-token.html: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-html-token-expected.txt: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-html-token.html: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/start-tag-body-expected.txt: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/start-tag-body.html: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/start-tag-html-expected.txt: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/start-tag-html.html: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one-expected.txt: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one.html: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-frameset-insertion-mode: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-frameset-insertion-mode/end-tag-frameset-expected.txt: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-frameset-insertion-mode/end-tag-frameset.html: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-head-insertion-mode: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags-expected.txt: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags.html: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one-expected.txt: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one.html: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-table-insertion-mode: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-table-insertion-mode/end-tag-table-expected.txt: Removed.
* html-templates/parsing-html-templates/additions-to-the-in-table-insertion-mode/end-tag-table.html: Removed.
* html-templates/parsing-html-templates/appending-to-a-template: Removed.
* html-templates/parsing-html-templates/appending-to-a-template/template-child-nodes-expected.txt: Removed.
* html-templates/parsing-html-templates/appending-to-a-template/template-child-nodes.html: Removed.
* html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context: Removed.
* html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context-expected.txt: Removed.
* html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context.html: Removed.
* html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context-expected.txt: Removed.
* html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context.html: Removed.
* html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context-expected.txt: Removed.
* html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context.html: Removed.
* html-templates/parsing-html-templates/creating-an-element-for-the-token: Removed.
* html-templates/parsing-html-templates/creating-an-element-for-the-token/template-owner-document-expected.txt: Removed.
* html-templates/parsing-html-templates/creating-an-element-for-the-token/template-owner-document.html: Removed.
* html-templates/resources: Removed.
* html-templates/resources/end-template-tag-in-body.html: Removed.
* html-templates/resources/end-template-tag-in-head.html: Removed.
* html-templates/resources/frameset-end-tag.html: Removed.
* html-templates/resources/head-template-contents-div-no-end-tag.html: Removed.
* html-templates/resources/head-template-contents-table-no-end-tag.html: Removed.
* html-templates/resources/html-start-tag.html: Removed.
* html-templates/resources/template-child-nodes-div.xhtml: Removed.
* html-templates/resources/template-child-nodes-nested.xhtml: Removed.
* html-templates/resources/template-contents-attribute.html: Removed.
* html-templates/resources/template-contents-body.html: Removed.
* html-templates/resources/template-contents-div-no-end-tag.html: Removed.
* html-templates/resources/template-contents-empty.html: Removed.
* html-templates/resources/template-contents-frameset.html: Removed.
* html-templates/resources/template-contents-head.html: Removed.
* html-templates/resources/template-contents-html.html: Removed.
* html-templates/resources/template-contents-nested.html: Removed.
* html-templates/resources/template-contents-table-no-end-tag.html: Removed.
* html-templates/resources/template-contents-text.html: Removed.
* html-templates/resources/template-contents.html: Removed.
* html-templates/resources/template-descendant-body.html: Removed.
* html-templates/resources/template-descendant-frameset.html: Removed.
* html-templates/resources/template-descendant-head.html: Removed.
* html-templates/resources/two-templates.html: Removed.
* html-templates/testcommon.js: Removed.
* web-platform-tests/html/syntax: Added.
* web-platform-tests/html/syntax/parsing: Added.
* web-platform-tests/html/syntax/parsing/template: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-a-foster-parent-element-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-a-foster-parent-element.html: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-not-a-foster-parent-element-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-not-a-foster-parent-element.html: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/w3c-import.log: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags.html: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-body-token-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-body-token.html: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-frameset-token-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-frameset-token.html: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-head-token-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-head-token.html: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-html-token-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-html-token.html: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-body-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-body.html: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-html-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-html.html: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one.html: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/w3c-import.log: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset.html: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/w3c-import.log: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags.html: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one.html: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/w3c-import.log: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/end-tag-table-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/end-tag-table.html: Added.
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/w3c-import.log: Added.
* web-platform-tests/html/syntax/parsing/template/appending-to-a-template: Added.
* web-platform-tests/html/syntax/parsing/template/appending-to-a-template/template-child-nodes-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/appending-to-a-template/template-child-nodes.html: Added.
* web-platform-tests/html/syntax/parsing/template/appending-to-a-template/w3c-import.log: Added.
* web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context: Added.
* web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context.html: Added.
* web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context.html: Added.
* web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context.html: Added.
* web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/w3c-import.log: Added.
* web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token: Added.
* web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document-expected.txt: Added.
* web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html: Added.
* web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/w3c-import.log: Added.

LayoutTests:

* platform/mac/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/</li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/</li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/</li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstofosterparentingtemplateisafosterparentelementexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-a-foster-parent-element-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstofosterparentingtemplateisafosterparentelementhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-a-foster-parent-element.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstofosterparentingtemplateisnotafosterparentelementexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-not-a-foster-parent-element-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstofosterparentingtemplateisnotafosterparentelementhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-not-a-foster-parent-element.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstofosterparentingw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/w3c-import.log</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodegeneratingofimpliedendtagsexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodegeneratingofimpliedendtagshtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignorebodytokenexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-body-token-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignorebodytokenhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-body-token.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignoreframesettokenexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-frameset-token-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignoreframesettokenhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-frameset-token.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignoreheadtokenexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-head-token-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignoreheadtokenhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-head-token.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignorehtmltokenexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-html-token-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignorehtmltokenhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-html-token.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodestarttagbodyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-body-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodestarttagbodyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-body.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodestarttaghtmlexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-html-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodestarttaghtmlhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-html.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodetemplateendtagwithoutstartoneexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodetemplateendtagwithoutstartonehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodew3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/w3c-import.log</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinframesetinsertionmodeendtagframesetexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinframesetinsertionmodeendtagframesethtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinframesetinsertionmodew3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/w3c-import.log</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinheadinsertionmodegeneratingofimpliedendtagsexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinheadinsertionmodegeneratingofimpliedendtagshtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinheadinsertionmodetemplateendtagwithoutstartoneexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinheadinsertionmodetemplateendtagwithoutstartonehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinheadinsertionmodew3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/w3c-import.log</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheintableinsertionmodeendtagtableexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/end-tag-table-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheintableinsertionmodeendtagtablehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/end-tag-table.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheintableinsertionmodew3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/w3c-import.log</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/appending-to-a-template/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateappendingtoatemplatetemplatechildnodesexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/appending-to-a-template/template-child-nodes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateappendingtoatemplatetemplatechildnodeshtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/appending-to-a-template/template-child-nodes.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateappendingtoatemplatew3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/appending-to-a-template/w3c-import.log</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateclearingthestackbacktoagivencontextclearingstackbacktoatablebodycontextexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateclearingthestackbacktoagivencontextclearingstackbacktoatablebodycontexthtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateclearingthestackbacktoagivencontextclearingstackbacktoatablecontextexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateclearingthestackbacktoagivencontextclearingstackbacktoatablecontexthtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateclearingthestackbacktoagivencontextclearingstackbacktoatablerowcontextexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateclearingthestackbacktoagivencontextclearingstackbacktoatablerowcontexthtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateclearingthestackbacktoagivencontextw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/w3c-import.log</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplatecreatinganelementforthetokentemplateownerdocumentexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplatecreatinganelementforthetokentemplateownerdocumenthtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplatecreatinganelementforthetokenw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/w3c-import.log</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li>trunk/LayoutTests/imported/w3c/html-templates/</li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (200071 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-04-26 04:08:22 UTC (rev 200071)
+++ trunk/LayoutTests/ChangeLog        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2016-04-25  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        Update template element tests
+        https://bugs.webkit.org/show_bug.cgi?id=154996
+
+        Reviewed by Daniel Bates.
+
+        * platform/mac/TestExpectations:
+
</ins><span class="cx"> 2016-04-25  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Cloning a textarea does not clone the textarea's value
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (200071 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-04-26 04:08:22 UTC (rev 200071)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -1,3 +1,144 @@
</span><ins>+2016-04-25  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        Update template element tests
+        https://bugs.webkit.org/show_bug.cgi?id=154996
+
+        Reviewed by Daniel Bates.
+
+        Reimported W3C tests for template elements as of d5a4c5bdf8a1837b4fcf50bbd2efd4150ddafa99.
+        Also moved the parser tests from html-templates to web-platform-tests/html/syntax to match the upstream directory structure.
+
+        * html-templates: Removed.
+        * html-templates/parsing-html-templates: Removed.
+        * html-templates/parsing-html-templates/additions-to-foster-parenting: Removed.
+        * html-templates/parsing-html-templates/additions-to-foster-parenting/template-is-a-foster-parent-element-expected.txt: Removed.
+        * html-templates/parsing-html-templates/additions-to-foster-parenting/template-is-a-foster-parent-element.html: Removed.
+        * html-templates/parsing-html-templates/additions-to-foster-parenting/template-is-not-a-foster-parent-element-expected.txt: Removed.
+        * html-templates/parsing-html-templates/additions-to-foster-parenting/template-is-not-a-foster-parent-element.html: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags-expected.txt: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags.html: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-body-token-expected.txt: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-body-token.html: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-frameset-token-expected.txt: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-frameset-token.html: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-head-token-expected.txt: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-head-token.html: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-html-token-expected.txt: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/ignore-html-token.html: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/start-tag-body-expected.txt: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/start-tag-body.html: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/start-tag-html-expected.txt: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/start-tag-html.html: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one-expected.txt: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one.html: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-frameset-insertion-mode: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-frameset-insertion-mode/end-tag-frameset-expected.txt: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-frameset-insertion-mode/end-tag-frameset.html: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-head-insertion-mode: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags-expected.txt: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags.html: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one-expected.txt: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one.html: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-table-insertion-mode: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-table-insertion-mode/end-tag-table-expected.txt: Removed.
+        * html-templates/parsing-html-templates/additions-to-the-in-table-insertion-mode/end-tag-table.html: Removed.
+        * html-templates/parsing-html-templates/appending-to-a-template: Removed.
+        * html-templates/parsing-html-templates/appending-to-a-template/template-child-nodes-expected.txt: Removed.
+        * html-templates/parsing-html-templates/appending-to-a-template/template-child-nodes.html: Removed.
+        * html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context: Removed.
+        * html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context-expected.txt: Removed.
+        * html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context.html: Removed.
+        * html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context-expected.txt: Removed.
+        * html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context.html: Removed.
+        * html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context-expected.txt: Removed.
+        * html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context.html: Removed.
+        * html-templates/parsing-html-templates/creating-an-element-for-the-token: Removed.
+        * html-templates/parsing-html-templates/creating-an-element-for-the-token/template-owner-document-expected.txt: Removed.
+        * html-templates/parsing-html-templates/creating-an-element-for-the-token/template-owner-document.html: Removed.
+        * html-templates/resources: Removed.
+        * html-templates/resources/end-template-tag-in-body.html: Removed.
+        * html-templates/resources/end-template-tag-in-head.html: Removed.
+        * html-templates/resources/frameset-end-tag.html: Removed.
+        * html-templates/resources/head-template-contents-div-no-end-tag.html: Removed.
+        * html-templates/resources/head-template-contents-table-no-end-tag.html: Removed.
+        * html-templates/resources/html-start-tag.html: Removed.
+        * html-templates/resources/template-child-nodes-div.xhtml: Removed.
+        * html-templates/resources/template-child-nodes-nested.xhtml: Removed.
+        * html-templates/resources/template-contents-attribute.html: Removed.
+        * html-templates/resources/template-contents-body.html: Removed.
+        * html-templates/resources/template-contents-div-no-end-tag.html: Removed.
+        * html-templates/resources/template-contents-empty.html: Removed.
+        * html-templates/resources/template-contents-frameset.html: Removed.
+        * html-templates/resources/template-contents-head.html: Removed.
+        * html-templates/resources/template-contents-html.html: Removed.
+        * html-templates/resources/template-contents-nested.html: Removed.
+        * html-templates/resources/template-contents-table-no-end-tag.html: Removed.
+        * html-templates/resources/template-contents-text.html: Removed.
+        * html-templates/resources/template-contents.html: Removed.
+        * html-templates/resources/template-descendant-body.html: Removed.
+        * html-templates/resources/template-descendant-frameset.html: Removed.
+        * html-templates/resources/template-descendant-head.html: Removed.
+        * html-templates/resources/two-templates.html: Removed.
+        * html-templates/testcommon.js: Removed.
+        * web-platform-tests/html/syntax: Added.
+        * web-platform-tests/html/syntax/parsing: Added.
+        * web-platform-tests/html/syntax/parsing/template: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-a-foster-parent-element-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-a-foster-parent-element.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-not-a-foster-parent-element-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-not-a-foster-parent-element.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/w3c-import.log: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-body-token-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-body-token.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-frameset-token-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-frameset-token.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-head-token-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-head-token.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-html-token-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-html-token.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-body-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-body.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-html-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-html.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/w3c-import.log: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/w3c-import.log: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/w3c-import.log: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/end-tag-table-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/end-tag-table.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/w3c-import.log: Added.
+        * web-platform-tests/html/syntax/parsing/template/appending-to-a-template: Added.
+        * web-platform-tests/html/syntax/parsing/template/appending-to-a-template/template-child-nodes-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/appending-to-a-template/template-child-nodes.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/appending-to-a-template/w3c-import.log: Added.
+        * web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context: Added.
+        * web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/w3c-import.log: Added.
+        * web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token: Added.
+        * web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document-expected.txt: Added.
+        * web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html: Added.
+        * web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/w3c-import.log: Added.
+
</ins><span class="cx"> 2016-04-24  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, revert part of r199970 that shouldn't have been committed.
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstofosterparentingtemplateisafosterparentelementexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-a-foster-parent-element-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-a-foster-parent-element-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-a-foster-parent-element-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+
+PASS Template is a foster parent element. Test &lt;table&gt; immediately below &lt;template&gt; 
+PASS Template is a foster parent element. Test &lt;template&gt; element without &lt;table&gt; 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstofosterparentingtemplateisafosterparentelementhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-a-foster-parent-element.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-a-foster-parent-element.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-a-foster-parent-element.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: Template is a foster parent element&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;The last template element with either no table element is below it, or a table element immediately below it, in the stack of open elements is the foster parent element (NOT the template's parent!)&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#foster-parent-addition&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.body.innerHTML = '' +
+    '&lt;div id=&quot;tmplParent&quot;&gt;' +
+        '&lt;template id=&quot;tmpl1&quot;&gt;' +
+            '&lt;table id=&quot;tbl&quot;&gt;' +
+                '&lt;tr&gt;&lt;td&gt;Cell 1&lt;/td&gt;&lt;/tr&gt;' +
+            // Misplaced &lt;div&gt;. It should be foster parented
+            '&lt;div id=&quot;orphanDiv&quot;&gt;Orphan div content&lt;/div&gt;' +
+                '&lt;tr&gt;&lt;td&gt;Cell 2&lt;/td&gt;&lt;/tr&gt;' +
+            '&lt;/table&gt;' +
+        '&lt;/template&gt;' +
+    '&lt;/div&gt;';
+
+    var template = doc.querySelector('#tmpl1');
+    var div = template.content.querySelector('#orphanDiv');
+
+    assert_equals(div.parentNode, template.content, 'Wrong foster parent element');
+
+}, 'Template is a foster parent element. Test &lt;table&gt; immediately below &lt;template&gt;');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.body.innerHTML = '' +
+    '&lt;div id=&quot;tmplParent&quot;&gt;' +
+        '&lt;template id=&quot;tmpl1&quot;&gt;' +
+                '&lt;tr&gt;&lt;td&gt;Cell 1&lt;/td&gt;&lt;/tr&gt;' +
+            // Misplaced &lt;div&gt;. It should be foster parented
+            '&lt;div id=&quot;orphanDiv&quot;&gt;Orphan div content&lt;/div&gt;' +
+                '&lt;tr&gt;&lt;td&gt;Cell 2&lt;/td&gt;&lt;/tr&gt;' +
+        '&lt;/template&gt;' +
+    '&lt;/div&gt;';
+
+    var template = doc.querySelector('#tmpl1');
+    var div = template.content.querySelector('#orphanDiv');
+
+    assert_equals(div.parentNode, template.content, 'Wrong foster parent element');
+
+}, 'Template is a foster parent element. Test &lt;template&gt; element without &lt;table&gt;');
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstofosterparentingtemplateisnotafosterparentelementexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-not-a-foster-parent-element-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-not-a-foster-parent-element-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-not-a-foster-parent-element-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+
+PASS Template is not a foster parent element. Test the case when &lt;template&gt; is higher in stack of open elements 
+PASS Template is not a foster parent element. Test the case when &lt;template&gt; is lower in stack of open elements 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstofosterparentingtemplateisnotafosterparentelementhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-not-a-foster-parent-element.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-not-a-foster-parent-element.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-not-a-foster-parent-element.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,70 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: Template is not a foster parent element&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;When template element shouldn't be a foster parent then regular rules of foster parenting should be applied&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#foster-parent-addition&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.body.innerHTML = '' +
+    '&lt;div id=&quot;tmplParent&quot;&gt;' +
+        '&lt;template id=&quot;tmpl1&quot;&gt;' +
+            '&lt;div id=&quot;fosterParent&quot;&gt;' +
+                '&lt;table id=&quot;tbl&quot;&gt;' +
+                    '&lt;tr&gt;&lt;td&gt;Cell 1&lt;/td&gt;&lt;/tr&gt;' +
+                // Misplaced &lt;div&gt;. It should be foster parented
+                '&lt;div id=&quot;orphanDiv&quot;&gt;Orphan div content&lt;/div&gt;' +
+                    '&lt;tr&gt;&lt;td&gt;Cell 2&lt;/td&gt;&lt;/tr&gt;' +
+                '&lt;/table&gt;' +
+            '&lt;/div&gt;' +
+        '&lt;/template&gt;' +
+    '&lt;/div&gt;';
+
+    var template = doc.querySelector('#tmpl1');
+    var fosterParent = template.content.querySelector('#fosterParent');
+    var div = template.content.querySelector('#orphanDiv');
+
+    assert_equals(div.parentNode, fosterParent, 'Wrong foster parent element');
+
+}, 'Template is not a foster parent element. '
+    + 'Test the case when &lt;template&gt; is higher in stack of open elements');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.body.innerHTML = '' +
+            '&lt;div id=&quot;fosterParent&quot;&gt;' +
+                '&lt;table id=&quot;tbl&quot;&gt;' +
+                    '&lt;tr&gt;&lt;td&gt;&lt;template id=&quot;tmpl1&quot;&gt;Template content&lt;/template&gt;&lt;/td&gt;&lt;/tr&gt;' +
+                // Misplaced &lt;div&gt;. It should be foster parented
+                '&lt;div id=&quot;orphanDiv&quot;&gt;Orphan div content&lt;/div&gt;' +
+                    '&lt;tr&gt;&lt;td&gt;Cell 2&lt;/td&gt;&lt;/tr&gt;' +
+                '&lt;/table&gt;' +
+            '&lt;/div&gt;' +
+    '&lt;/div&gt;';
+
+    var t = doc.querySelector('#tmpl1');
+    var fosterParent = doc.querySelector('#fosterParent');
+    var div = doc.querySelector('#orphanDiv');
+
+    assert_equals(div.parentNode, fosterParent, 'Wrong foster parent element');
+
+}, 'Template is not a foster parent element. '
+    + 'Test the case when &lt;template&gt; is lower in stack of open elements');
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstofosterparentingw3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/w3c-import.log (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/w3c-import.log                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/w3c-import.log        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the W3C CSS or WPT github:
+        https://github.com/w3c/csswg-test
+        https://github.com/w3c/web-platform-tests
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport.
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-a-foster-parent-element.html
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-foster-parenting/template-is-not-a-foster-parent-element.html
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodegeneratingofimpliedendtagsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+
+PASS Generating of implied end tags. Test table elements 
+PASS Generating of implied end tags. Test div element 
+PASS Generating of implied end tags. Test some text and DIV element 
+PASS Generating of implied end tags. Test wrong end tag 
+PASS Generating of implied end tags. Test table elements. Loading of HTML document from a file 
+PASS Generating of implied end tags. Test div element. Loading of HTML document from a file 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodegeneratingofimpliedendtagshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,136 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: 'In body' insertion mode: when template end tag is met, implied end tags should be generated&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Aleksei Yu. Semenov&quot; href=&quot;a.semenov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;'In body' insertion mode: when template end tag is met, implied end tags should be generated&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-body-addition&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    //No end &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; tags. Should be added implicitly
+    doc.body.innerHTML = '&lt;template id=&quot;tpl&quot;&gt;'
+        + '&lt;table id=&quot;tbl&quot;&gt;&lt;tr id=&quot;tr&quot;&gt;&lt;td id=&quot;td&quot;&gt;&lt;/template&gt;';
+
+    var template = doc.querySelector('#tpl');
+
+    assert_not_equals(template, null, 'Template element must be parsed');
+
+    assert_equals(doc.querySelector('#tbl'), null, 'Table element should not be available');
+    assert_equals(doc.querySelector('#tr'), null, 'TR element should not be available');
+    assert_equals(doc.querySelector('#td'), null, 'TD element should not be available');
+
+    assert_not_equals(template.content.querySelector('#tbl'), null,
+            'Template should contain table element');
+    assert_not_equals(template.content.querySelector('#tr'), null,
+            'Template should contain TR element');
+    assert_not_equals(template.content.querySelector('#td'), null,
+            'Template should contain TD element');
+
+}, 'Generating of implied end tags. Test table elements');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    //No end &lt;/div&gt; tag. Should be added implicitly
+    doc.body.innerHTML = '&lt;template id=&quot;tpl&quot;&gt;&lt;div id=&quot;dv&quot;&gt;Div content&lt;/template&gt;';
+
+    var template = doc.querySelector('#tpl');
+
+    assert_not_equals(template, null, 'Template element must be parsed');
+
+    assert_equals(doc.querySelector('#dv'), null, 'DIV element should not be available');
+
+    assert_not_equals(template.content.querySelector('#dv'), null,
+            'Template should contain DIV element');
+
+}, 'Generating of implied end tags. Test div element');
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    //No end &lt;/div&gt; tag. Should be added implicitly after text content
+    doc.body.innerHTML = '&lt;template id=&quot;tpl&quot;&gt;Template text&lt;div id=&quot;dv&quot;&gt;Div content&lt;/template&gt;';
+
+    var template = doc.querySelector('#tpl');
+
+    assert_not_equals(template, null, 'Template element must be parsed');
+
+    assert_equals(doc.querySelector('#dv'), null, 'DIV element should not be available');
+
+    var div = template.content.querySelector('#dv');
+
+    assert_not_equals( div, null, 'Template should contain DIV element');
+    assert_equals(div.textContent, 'Div content', 'Wrong template content inner text');
+
+}, 'Generating of implied end tags. Test some text and DIV element');
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    // Wrong end tag. Correct end tag must be added implicitly, wrong one ignored
+    doc.body.innerHTML = '&lt;template id=&quot;tpl&quot;&gt;&lt;div id=&quot;dv&quot;&gt;Div content&lt;/span&gt;&lt;/template&gt;';
+
+    var template = doc.querySelector('#tpl');
+
+    assert_not_equals(template, null, 'Template element must be parsed');
+
+    assert_equals(template.content.childNodes.length, 1,
+            'Wrong number of template\'s children');
+
+    assert_equals(doc.querySelector('#dv'), null, 'DIV element should not be available');
+
+    assert_not_equals(template.content.querySelector('#dv'), null,
+            'Template should contain DIV element');
+    assert_equals(template.content.querySelector('#dv').textContent,
+            'Div content', 'Wrong template content inner text');
+
+}, 'Generating of implied end tags. Test wrong end tag');
+
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/template-contents-table-no-end-tag.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.body.querySelector('template');
+
+    assert_not_equals(template, null, 'Template element must be parsed');
+
+    assert_not_equals(template.content.querySelector('table'), null,
+            'Template should contain table element');
+    assert_not_equals(template.content.querySelector('tr'), null,
+            'Template should contain TR element');
+    assert_not_equals(template.content.querySelector('td'), null,
+            'Template should contain TD element');
+
+}, 'Generating of implied end tags. Test table elements. Loading of HTML document from a file');
+
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/template-contents-div-no-end-tag.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.body.querySelector('template');
+
+    assert_not_equals(template, null, 'Template element must be parsed');
+
+    var div = template.content.querySelector('div');
+    assert_not_equals(div, null, 'Template should contain div element');
+    assert_equals(div.textContent, 'Hello, template\n    ', 'Invalid div contents');
+
+}, 'Generating of implied end tags. Test div element. Loading of HTML document from a file');
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignorebodytokenexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-body-token-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-body-token-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-body-token-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+
+PASS Ignore BODY token. Test empty BODY element assigned to template innerHTML 
+PASS Ignore BODY token. Test not empty BODY element assigned to template innerHTML 
+PASS Ignore BODY token. Test BODY element and some valid element after BODY tag assigned to template innerHTML 
+PASS Ignore BODY token. Test BODY element and some valid element before BODY tag assigned to template innerHTML 
+PASS Ignore BODY token. Test template with not empty BODY element inside assigned to another template's innerHTML 
+PASS Ignore BODY token. Test loading a HTML file with BODY tag inside template 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignorebodytokenhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-body-token.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-body-token.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-body-token.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,132 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: In body insertion mode: parser should ignore BODY token&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Aleksei Yu. Semenov&quot; href=&quot;mailto:a.semenov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-body-addition&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-body-addition&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+/*
+ * According to http://www.w3.org/TR/2013/WD-html-templates-20130214/#template-contents-insertion-mode
+ * when parser is in &quot;template content&quot; mode and meets &lt;body&gt; tag it should be switched to
+ * &quot;in body&quot; insertion mode.
+ * According to http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-body-addition
+ * this token (BODY) should be ignored
+ */
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;body&gt;&lt;/body&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 0,
+            'Template cannot contain BODY element');
+
+}, 'Ignore BODY token. Test empty BODY element assigned to template innerHTML');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;body&gt;&lt;div&gt;Some content&lt;/div&gt;&lt;/body&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 1,
+            'Wrong number of template content children');
+    assert_equals(template.content.firstChild.nodeName, 'DIV',
+            'Template should contain children of ignored BODY element');
+
+}, 'Ignore BODY token. Test not empty BODY element assigned to template innerHTML');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;body&gt;&lt;div &lt;div id=&quot;div1&quot;&gt;Some content&lt;/div&gt;&lt;/body&gt;&lt;div id=&quot;div2&quot;&gt;Some valid content&lt;/div&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 2,
+            'Wrong number of template content children');
+    assert_not_equals(template.content.querySelector('#div1'), null,
+            'Template should contain children of the ignored BODY element');
+    assert_not_equals(template.content.querySelector('#div2'), null,
+            'Template should contain valid element');
+
+}, 'Ignore BODY token. '
+        + 'Test BODY element and some valid element after BODY tag assigned to template innerHTML');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;div id=&quot;div1&quot;&gt;Some valid content&lt;/div&gt;&lt;body&gt;&lt;div id=&quot;div2&quot;&gt;Some content&lt;/div&gt;&lt;/body&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 2,
+            'Template cannot contain BODY element');
+    assert_not_equals(template.content.querySelector('#div1'), null,
+            'Template should contain valid element');
+    assert_not_equals(template.content.querySelector('#div2'), null,
+            'Template should contain children of the ignored BODY element');
+
+}, 'Ignore BODY token. '
+        + 'Test BODY element and some valid element before BODY tag assigned to template innerHTML');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;template id=&quot;t2&quot;&gt;&lt;body&gt;&lt;span&gt;Body!&lt;span&gt;&lt;/body&gt;&lt;/template&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 1,
+            'Template should contain nested template');
+    assert_not_equals(template.content.querySelector('#t2'), null,
+            'Template should contain nested element');
+
+    var nestedTemplate = template.content.querySelector('#t2');
+
+    assert_equals(nestedTemplate.content.childNodes.length, 1,
+            'Template cannot contain BODY element');
+    assert_equals(nestedTemplate.content.firstChild.nodeName, 'SPAN',
+            'Template cannot contain BODY element');
+
+}, 'Ignore BODY token. '
+    + 'Test template with not empty BODY element inside assigned to another '
+    + 'template\'s innerHTML');
+
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/template-contents-body.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.body.querySelector('template');
+
+    assert_equals(template.content.childNodes.length, 0,
+            'Template cannot contain BODY element');
+
+}, 'Ignore BODY token. '
+    + 'Test loading a HTML file with BODY tag inside template');
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignoreframesettokenexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-frameset-token-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-frameset-token-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-frameset-token-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+
+PASS Ignore frameset token. Test FRAMESET element assigned to template innerHTML 
+PASS Ignore frameset token. Test FRAMESET element and some valid element before it, assigned to the template's innerHTML 
+PASS Ignore frameset token. Test FRAMESET element and some valid element after it, assigned to the template's innerHTML 
+PASS Ignore frameset token. Test FRAMESET tag inside template tag assigned to another template's innerHTML 
+PASS Ignore frameset token. Test loading a HTML file with FRAMESET tag inside template 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignoreframesettokenhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-frameset-token.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-frameset-token.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-frameset-token.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,125 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: In body insertion mode: parser should ignore FRAMESET token&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Aleksei Yu. Semenov&quot; href=&quot;mailto:a.semenov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;If parser is in 'in body' insertion mode and meets HTML token it should be ignored&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-body-addition&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+/*
+ * According to http://www.w3.org/TR/2013/WD-html-templates-20130214/#template-contents-insertion-mode
+ * when parser is in &quot;template content&quot; mode and meets &lt;frameset&gt; tag it should be switched to
+ * &quot;in body&quot; insertion mode.
+ * According to https://html.spec.whatwg.org/multipage/#parsing-main-inbody
+ * this token (FRAMESET) should be ignored
+ */
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;frameset cols=&quot;25%,*,25%&quot;&gt;'
+        + '&lt;frame src=&quot;frame_a.htm&quot;&gt;'
+        + '&lt;frame src=&quot;frame_b.htm&quot;&gt;' + '&lt;frame src=&quot;frame_c.htm&quot;&gt;'
+        + '&lt;/frameset&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 0,
+            'Template cannot contain FRAMESET element');
+
+}, 'Ignore frameset token. Test FRAMESET element assigned to template innerHTML');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;div id=&quot;div1&quot;&gt;Some text&lt;/div&gt;'
+        + '&lt;frameset cols=&quot;25%,*,25%&quot;&gt;'
+        + '&lt;frame src=&quot;frame_a.htm&quot;&gt;'
+        + '&lt;frame src=&quot;frame_b.htm&quot;&gt;'
+        + '&lt;frame src=&quot;frame_c.htm&quot;&gt;'
+        + '&lt;/frameset&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 1,
+            'Template cannot contain FRAMESET element');
+    assert_not_equals(template.content.querySelector('#div1'), null,
+            'Template should contain valid element');
+
+}, 'Ignore frameset token. '
+    + 'Test FRAMESET element and some valid element before it, assigned '
+    + 'to the template\'s innerHTML');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;frameset cols=&quot;25%,*,25%&quot;&gt;'
+        + '&lt;frame src=&quot;frame_a.htm&quot;&gt;'
+        + '&lt;frame src=&quot;frame_b.htm&quot;&gt;'
+        + '&lt;frame src=&quot;frame_c.htm&quot;&gt;'
+        + '&lt;/frameset&gt;&lt;div id=&quot;div1&quot;&gt;Some text&lt;/div&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 1,
+            'Template cannot contain FRAMESET element');
+    assert_not_equals(template.content.querySelector('#div1'), null,
+            'Template should contain valid element');
+
+}, 'Ignore frameset token. '
+    + 'Test FRAMESET element and some valid element after it, assigned '
+    + 'to the template\'s innerHTML');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;template id=&quot;t2&quot;&gt;'
+        + '&lt;frameset cols=&quot;25%,*,25%&quot;&gt;'
+        + '&lt;frame src=&quot;frame_a.htm&quot;&gt;'
+        + '&lt;frame src=&quot;frame_b.htm&quot;&gt;'
+        + '&lt;frame src=&quot;frame_c.htm&quot;&gt;'
+        + '&lt;/frameset&gt;&lt;/template&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 1,
+            'Template should contain nested template');
+    assert_not_equals(template.content.querySelector('#t2'), null,
+            'Template should contain nested element');
+
+    var nestedTemplate = template.content.querySelector('#t2');
+
+    assert_equals(nestedTemplate.content.childNodes.length, 0,
+            'Template cannot contain FRAMESET element');
+
+}, 'Ignore frameset token. '
+    + 'Test FRAMESET tag inside template tag assigned to another template\'s innerHTML');
+
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/template-contents-frameset.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.body.querySelector('template');
+
+    assert_equals(template.content.childNodes.length, 0,
+            'Template cannot contain FRAMESET element');
+}, 'Ignore frameset token. Test loading a HTML file with FRAMESET tag inside template');
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignoreheadtokenexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-head-token-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-head-token-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-head-token-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+
+PASS Ignore HEAD token. Test empty HEAD element assigned to template innerHTML 
+PASS Ignore HEAD token. Test not empty HEAD element assigned to template innerHTML 
+PASS Ignore HEAD token. Test HEAD element and some valid element before it, assigned to template innerHTML 
+PASS Ignore HEAD token. Test HEAD element and some valid element after it, assigned to template innerHTML 
+PASS Ignore HEAD token. Test HEAD tag inside template tag assigned to another template's innerHTML 
+PASS Ignore HEAD token. Test loading a HTML file with HEAD tag inside template 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignoreheadtokenhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-head-token.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-head-token.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-head-token.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,129 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: In body insertion mode: parser should ignore HEAD token&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Aleksei Yu. Semenov&quot; href=&quot;mailto:a.semenov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;If parser is in 'in body' insertion mode and meets HEAD token it should be ignored&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-body-addition&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+/*
+ * According to http://www.w3.org/TR/2013/WD-html-templates-20130214/#template-contents-insertion-mode
+ * when parser is in &quot;template content&quot; mode and meets &lt;head&gt; tag it should be switched to
+ * &quot;in body&quot; insertion mode.
+ * According to https://html.spec.whatwg.org/multipage/#parsing-main-inbody
+ * this token (HEAD) should be ignored
+ */
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;head&gt;&lt;/head&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 0,
+            'Template cannot contain HEAD element');
+
+}, 'Ignore HEAD token. Test empty HEAD element assigned to template innerHTML');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;head&gt;&lt;title&gt;test&lt;/title&gt;&lt;/head&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 1,
+            'Wrong number of template content children');
+    assert_equals(template.content.firstChild.nodeName, 'TITLE',
+            'Template should contain children of ignored HEAD element');
+
+}, 'Ignore HEAD token. Test not empty HEAD element assigned to template innerHTML');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;div id=&quot;div1&quot;&gt;Some text&lt;/div&gt;&lt;head&gt;&lt;title&gt;test&lt;/title&gt;&lt;/head&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 2,
+            'Wrong number of template content children');
+    assert_not_equals(template.content.querySelector('#div1'), null,
+            'Template should contain valid element');
+    assert_equals(template.content.lastChild.tagName, 'TITLE',
+            'Template should contain children of ignored HEAD element');
+
+}, 'Ignore HEAD token. '
+    + 'Test HEAD element and some valid element before it, assigned to template innerHTML');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;head&gt;&lt;title&gt;test&lt;/title&gt;&lt;/head&gt;&lt;div id=&quot;div1&quot;&gt;Some text&lt;/div&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 2,
+            'Wrong number of template content children');
+    assert_equals(template.content.firstChild.tagName, 'TITLE',
+            'Template should contain children of ignored HEAD element');
+    assert_not_equals(template.content.querySelector('#div1'), null,
+            'Template should contain valid element');
+
+}, 'Ignore HEAD token. '
+    + 'Test HEAD element and some valid element after it, assigned to template innerHTML');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;template id=&quot;t2&quot;&gt;&lt;head&gt;&lt;title&gt;test&lt;/title&gt;&lt;/head&gt;&lt;/template&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 1,
+            'Template should contain nested template');
+    assert_not_equals(template.content.querySelector('#t2'), null,
+            'Template should contain nested element');
+
+    var nestedTemplate = template.content.querySelector('#t2');
+
+    assert_equals(nestedTemplate.content.childNodes.length, 1,
+            'Wrong number of template content children');
+    assert_equals(nestedTemplate.content.firstChild.tagName, 'TITLE',
+            'Template should contain children of ignored HEAD element');
+
+}, 'Ignore HEAD token. '
+    + 'Test HEAD tag inside template tag assigned to another template\'s innerHTML');
+
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/template-contents-head.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.body.querySelector('template');
+
+    assert_equals(template.content.childNodes.length, 0,
+            'Template cannot contain HEAD element');
+
+}, 'Ignore HEAD token. Test loading a HTML file with HEAD tag inside template');
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignorehtmltokenexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-html-token-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-html-token-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-html-token-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+
+PASS Ignore HTML token. Test HTML element assigned to template innerHTML 
+PASS Ignore HTML token.Test HTML element and some valid element before it, assigned to template innerHTML 
+PASS Ignore HTML token. Test HEAD element and some valid element after it, assigned to template innerHTML 
+PASS Ignore HTML token. Test HTML tag inside template tag assigned to another template's innerHTML 
+PASS Ignore HTML token. Test some valid element inside HTML element 
+PASS Ignore HTML token. Test valid element inside HTML and BODY elements 
+PASS Ignore HTML token. Test valid element inside and between HTML and BODY elements 
+PASS Ignore HTML token. Test loading a HTML file with HTML tag inside template 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodeignorehtmltokenhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-html-token.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-html-token.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-html-token.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,158 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: In body insertion mode: parser should ignore HTML token&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Aleksei Yu. Semenov&quot; href=&quot;mailto:a.semenov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;If parser is in 'in body' insertion mode and meets HTML token it should be ignored&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-body-addition&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+/*
+ * According to http://www.w3.org/TR/2013/WD-html-templates-20130214/#template-contents-insertion-mode
+ * when parser is in &quot;template content&quot; mode and meets &lt;html&gt; tag it should be switched to
+ * &quot;in body&quot; insertion mode.
+ * According to https://html.spec.whatwg.org/multipage/#parsing-main-inbody
+ * this token (HTML) should be ignored
+ */
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 0,
+            'Template cannot contain HTML element');
+
+}, 'Ignore HTML token. Test HTML element assigned to template innerHTML');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;div id=&quot;div1&quot;&gt;Some text&lt;/div&gt;&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 1,
+            'Template cannot contain HTML element');
+    assert_not_equals(template.content.querySelector('#div1'), null,
+            'Template should contain valid element');
+
+}, 'Ignore HTML token.'
+    + 'Test HTML element and some valid element before it, assigned to template innerHTML');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;&lt;div id=&quot;div1&quot;&gt;Some text&lt;/div&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 1,
+            'Template cannot contain HTML element');
+    assert_not_equals(template.content.querySelector('#div1'), null,
+            'Template should contain valid element');
+
+}, 'Ignore HTML token. '
+    + 'Test HEAD element and some valid element after it, assigned to template innerHTML');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;template id=&quot;t2&quot;&gt;&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;&lt;/template&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 1,
+            'Template should contain nested template');
+    assert_not_equals(template.content.querySelector('#t2'), null,
+            'Template should contain nested element');
+
+    var nestedTemplate = template.content.querySelector('#t2');
+
+    assert_equals(nestedTemplate.content.childNodes.length, 0,
+            'Template cannot contain HTML element');
+
+}, 'Ignore HTML token. '
+    + 'Test HTML tag inside template tag assigned to another template\'s innerHTML');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;html&gt;&lt;div id=&quot;div1&quot;&gt;Some text&lt;/div&gt;&lt;/html&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 1,
+            'Template cannot contain HTML element');
+    assert_not_equals(template.content.querySelector('#div1'), null,
+            'Template should contain a valid element');
+
+}, 'Ignore HTML token. Test some valid element inside HTML element');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;html&gt;&lt;body&gt;&lt;div id=&quot;div1&quot;&gt;Some text&lt;/div&gt;&lt;body&gt;&lt;/html&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 1,
+            'Template cannot contain HTML element');
+    assert_not_equals(template.content.querySelector('#div1'), null,
+            'Template should contain valid element');
+
+}, 'Ignore HTML token. Test valid element inside HTML and BODY elements');
+
+
+test(function() {
+    var doc = newHTMLDocument();
+    var template = doc.createElement('template');
+
+    template.innerHTML = '&lt;html&gt;&lt;span id=&quot;span1&quot;&gt;Span&lt;/span&gt;&lt;body&gt;&lt;div id=&quot;div1&quot;&gt;Some text&lt;/div&gt;&lt;body&gt;&lt;/html&gt;';
+
+    doc.body.appendChild(template);
+
+    assert_equals(template.content.childNodes.length, 2,
+            'Template cannot contain HTML element');
+    assert_not_equals(template.content.querySelector('#div1'), null,
+            'Template should contain valid DIV element');
+
+    assert_not_equals(template.content.querySelector('#span1'), null,
+            'Template should contain valid SPAN element');
+
+}, 'Ignore HTML token. Test valid element inside and between HTML and BODY elements');
+
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/template-contents-html.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.body.querySelector('template');
+
+    assert_equals(template.content.childNodes.length, 0,
+            'Template cannot contain HTML element');
+
+}, 'Ignore HTML token. Test loading a HTML file with HTML tag inside template');
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodestarttagbodyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-body-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-body-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-body-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+
+PASS In body insertion mode: Template contains a start tag whose tag name is body.Test &lt;body&gt; tag only 
+PASS In body insertion mode: Template contains a start tag whose tag name is body. Test &lt;body&gt; tag containing some text 
+PASS In body insertion mode: Template contains a start tag whose tag name is body. Test &lt;body&gt; tag containing some other elements 
+PASS In body insertion mode: Template contains a start tag whose tag name is body. Test nested template tag containing &lt;body&gt; tag with some other elements 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodestarttagbodyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-body.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-body.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-body.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,97 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: In body insertion mode: Template contains a start tag whose tag name is body&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;If the stack of open elements has a template element in html scope then ignore &lt;body&gt; the token. (fragment or template contents case)&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-body-addition&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.body.innerHTML = '&lt;template id=&quot;tmpl&quot;&gt;&lt;body&gt;&lt;/template&gt;';
+
+    var template = doc.querySelector('#tmpl');
+
+    assert_equals(template.content.childNodes.length, 0, 'Element must be ignored');
+
+}, 'In body insertion mode: Template contains a start tag whose tag name is body.'
+    + 'Test &lt;body&gt; tag only');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.body.innerHTML = '&lt;template id=&quot;tmpl&quot;&gt;&lt;body&gt;Body text content&lt;/body&gt;&lt;/template&gt;';
+
+    var template = doc.querySelector('#tmpl');
+
+    assert_equals(template.content.querySelector('body'), null,
+            '&lt;body&gt; element must be ignored');
+    assert_equals(template.content.childNodes.length, 1, 'Text shouldn\'t be ignored');
+    assert_equals(template.content.firstChild.nodeType, Node.TEXT_NODE,
+            'Text shouldn\'t be ignored');
+
+}, 'In body insertion mode: Template contains a start tag whose tag name is body. '
+    + 'Test &lt;body&gt; tag containing some text');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.body.innerHTML = '&lt;template id=&quot;tmpl&quot;&gt;&lt;body&gt;'
+        + '&lt;div id=&quot;div1&quot;&gt;DIV 1&lt;/div&gt;'
+        + '&lt;div id=&quot;div2&quot;&gt;DIV 2&lt;/div&gt;'
+        + '&lt;/body&gt;&lt;/template&gt;';
+
+    var template = doc.querySelector('#tmpl');
+
+    assert_equals(template.content.querySelector('body'), null,
+            '&lt;body&gt; element must be ignored');
+    assert_equals(template.content.childNodes.length, 2,
+            'Only body tag should be ignored');
+    assert_not_equals(template.content.querySelector('#div1'), null,
+            'Children of &lt;body tag shouldn\'t be ignored');
+    assert_not_equals(template.content.querySelector('#div2'), null,
+            'Children of &lt;body tag shouldn\'t be ignored');
+
+}, 'In body insertion mode: Template contains a start tag whose tag name is body. '
+    + 'Test &lt;body&gt; tag containing some other elements');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.body.innerHTML = '&lt;template id=&quot;tmpl1&quot;&gt;&lt;template id=&quot;tmpl2&quot;&gt;&lt;body&gt;'
+        + '&lt;div id=&quot;div1&quot;&gt;DIV 1&lt;/div&gt;'
+        + '&lt;div id=&quot;div2&quot;&gt;DIV 2&lt;/div&gt;'
+        + '&lt;/body&gt;&lt;/template&gt;&lt;/template&gt;';
+
+    var template = doc.querySelector('#tmpl1').content.querySelector('#tmpl2');
+
+    assert_equals(template.content.querySelector('body'), null,
+            '&lt;body&gt; element must be ignored');
+    assert_equals(template.content.childNodes.length, 2,
+            'Only body tag should be ignored');
+    assert_not_equals(template.content.querySelector('#div1'), null,
+            'Children of &lt;body tag shouldn\'t be ignored');
+    assert_not_equals(template.content.querySelector('#div2'), null,
+            'Children of &lt;body tag shouldn\'t be ignored');
+
+}, 'In body insertion mode: Template contains a start tag whose tag name is body. '
+    + 'Test nested template tag containing &lt;body&gt; tag with some other elements');
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodestarttaghtmlexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-html-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-html-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-html-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS In body insertion mode: html start tag should add only absent attributes 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodestarttaghtmlhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-html.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-html.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-html.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: In body insertion mode: A start tag whose tag name is html&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;If HTML parser is in 'in body' insertion mode and meets HTML start tag, then for each attribute on the token, check to see if the attribute is already present on the top element of the stack of open elements. If it is not, add the attribute and its corresponding value to that element&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-body-addition&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+// test &lt;template&gt;&lt;html class=&quot;htmlClass&quot;&gt;&lt;/html&gt;&lt;/template&gt;&lt;html id=&quot;htmlId&quot; tabindex=&quot;5&quot;&gt;
+// id attribute should be added to root &lt;html&gt; element
+// tabindex attribute should not be modified
+//class attribute should be ignored
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/html-start-tag.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.body.querySelector('template');
+
+    var html = doc.documentElement;
+
+    assert_equals(html.getAttribute('tabindex'), '5', 'Attribute should be accessible');
+    assert_equals(html.getAttribute('id'), 'htmlId',
+            'Attribute \'id\' should be added and accessible');
+    assert_false(html.hasAttribute('class'), 'Attribute \'class\' should be ignored');
+    assert_equals(template.content.childNodes.length, 0, 'Template should not contain HTML element');
+
+
+}, 'In body insertion mode: html start tag should add only absent attributes');
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodetemplateendtagwithoutstartoneexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+
+PASS &lt;/template&gt; tag in HTML body without start one should be ignored 
+PASS &lt;/template&gt; tag in HTML body without start one should be ignored. Test valid &lt;template&gt; element and &lt;/template&gt; tag after it 
+PASS &lt;/template&gt; tag in HTML body without start one should be ignored. Test valid &lt;template&gt; element and &lt;/template&gt; tag before it 
+PASS &lt;/template&gt; tag in HTML body without start one should be ignored. Test valid &lt;template&gt; element, &lt;title&gt; element and &lt;/template&gt; tag before them 
+PASS &lt;/template&gt; tag in HTML body without start one should be ignored. Test valid &lt;template&gt; element, &lt;title&gt; element and &lt;/template&gt; tag after them 
+PASS &lt;/template&gt; tag in HTML body without start one should be ignored. Test HTML document loaded from file 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodetemplateendtagwithoutstartonehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,102 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: 'In body' insertion mode: Template end tag without start one. Element should be ignored&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Aleksei Yu. Semenov&quot; href=&quot;a.semenov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;If parser in 'in body' insertion mode meets template end tag and if the stack of open elements has no template element in html scope, then this is a parse error; ignore the token&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-body-addition&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.body.innerHTML = '&lt;/template&gt;';
+
+    assert_equals(doc.body.childNodes.length, 0, 'Element must be ignored');
+
+}, '&lt;/template&gt; tag in HTML body without start one should be ignored');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.body.innerHTML = '&lt;template id=&quot;tmpl&quot;&gt;&lt;/template&gt;&lt;/template&gt;';
+
+    assert_equals(doc.body.childNodes.length, 1, 'Element must be ignored');
+    assert_not_equals(doc.querySelector('#tmpl'), null,
+            'Element should present it document body');
+
+}, '&lt;/template&gt; tag in HTML body without start one should be ignored. '
+    + 'Test valid &lt;template&gt; element and &lt;/template&gt; tag after it');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.body.innerHTML = '&lt;/template&gt;&lt;template id=&quot;tmpl&quot;&gt;&lt;/template&gt;';
+
+    assert_equals(doc.body.childNodes.length, 1, 'Element must be ignored');
+    assert_not_equals(doc.querySelector('#tmpl'), null,
+            'Element should present it document body');
+
+}, '&lt;/template&gt; tag in HTML body without start one should be ignored. '
+    + 'Test valid &lt;template&gt; element and &lt;/template&gt; tag before it');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.body.innerHTML = '&lt;/template&gt;&lt;template id=&quot;tmpl&quot;&gt;&lt;/template&gt;&lt;title&gt;&lt;/title&gt;';
+
+    assert_equals(doc.body.childNodes.length, 2, 'Element must be ignored');
+    assert_not_equals(doc.querySelector('#tmpl'), null,
+            'Valid element should present it document body');
+    assert_not_equals(doc.querySelector('title'), null,
+            'Valid title element should present it document body');
+
+}, '&lt;/template&gt; tag in HTML body without start one should be ignored. '
+    + 'Test valid &lt;template&gt; element, &lt;title&gt; element and &lt;/template&gt; tag before them');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.body.innerHTML = '&lt;template id=&quot;tmpl&quot;&gt;&lt;/template&gt;&lt;title&gt;&lt;/title&gt;&lt;/template&gt;';
+
+    assert_equals(doc.body.childNodes.length, 2, 'Element must be ignored');
+    assert_not_equals(doc.querySelector('#tmpl'), null,
+            'Valid element should present it document body');
+    assert_not_equals(doc.querySelector('title'), null,
+            'Valid title element should present it document body');
+
+}, '&lt;/template&gt; tag in HTML body without start one should be ignored. '
+    + 'Test valid &lt;template&gt; element, &lt;title&gt; element and &lt;/template&gt; tag after them');
+
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/end-template-tag-in-body.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    assert_equals(doc.body.querySelector('template'), null,
+            '&lt;/template&gt; must be ignored');
+    assert_not_equals(doc.body.querySelector('div'), null,
+            'Valid element should present it document body');
+
+}, '&lt;/template&gt; tag in HTML body without start one should be ignored. '
+    + 'Test HTML document loaded from file');
+
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinbodyinsertionmodew3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/w3c-import.log (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/w3c-import.log                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/w3c-import.log        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the W3C CSS or WPT github:
+        https://github.com/w3c/csswg-test
+        https://github.com/w3c/web-platform-tests
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport.
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/generating-of-implied-end-tags.html
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-body-token.html
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-frameset-token.html
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-head-token.html
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/ignore-html-token.html
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-body.html
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-html.html
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/template-end-tag-without-start-one.html
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinframesetinsertionmodeendtagframesetexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+FAIL &lt;template&gt; tag should be ignored in &quot;in frameset&quot; insertion mode assert_equals: Wrong number of frameset children elements expected 0 but got 1
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinframesetinsertionmodeendtagframesethtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: additions to 'in frameset' insertion mode&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;If parser is in 'in frameset' insertion mode then a start tag or an end tag whose name is 'template' is a parsing error&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;https://www.w3.org/TR/2015/WD-html51-20151008/syntax.html#parsing-main-inframeset&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/frameset-end-tag.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var frameset = doc.querySelector('frameset');
+    assert_equals(frameset.children.length, 0, 'Wrong number of frameset children elements');
+
+}, '&lt;template&gt; tag should be ignored in &quot;in frameset&quot; insertion mode');
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinframesetinsertionmodew3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/w3c-import.log (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/w3c-import.log                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/w3c-import.log        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the W3C CSS or WPT github:
+        https://github.com/w3c/csswg-test
+        https://github.com/w3c/web-platform-tests
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport.
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset.html
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinheadinsertionmodegeneratingofimpliedendtagsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+
+PASS Generating of implied end tags. Test table elements 
+PASS Generating of implied end tags. Test DIV element 
+PASS Generating of implied end tags. Test some text and DIV element 
+PASS Generating of implied end tags. Test wrong end tag 
+PASS Generating of implied end tags. Test table elements. Load HTML document from file 
+PASS Generating of implied end tags. Test div element. Load HTML document from file 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinheadinsertionmodegeneratingofimpliedendtagshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,137 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: When template end tag is met, implied end tags should be generated&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Aleksei Yu. Semenov&quot; href=&quot;a.semenov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;When template end tag is met, implied end tags should be generated&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-head-addition&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    //No end &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; tags. Should be added implicitly
+    doc.head.innerHTML = '&lt;template id=&quot;tpl&quot;&gt;'
+        + '&lt;table id=&quot;tbl&quot;&gt;&lt;tr id=&quot;tr&quot;&gt;&lt;td id=&quot;td&quot;&gt;&lt;/template&gt;';
+
+    var template = doc.querySelector('#tpl');
+
+    assert_not_equals(template, null, 'Template element must be parsed');
+
+    assert_equals(doc.querySelector('#tbl'), null, 'Table element should not be available');
+    assert_equals(doc.querySelector('#tr'), null, 'TR element should not be available');
+    assert_equals(doc.querySelector('#td'), null, 'TD element should not be available');
+
+    assert_not_equals(template.content.querySelector('#tbl'), null,
+            'Template should contain table element');
+    assert_not_equals(template.content.querySelector('#tr'), null,
+            'Template should contain TR element');
+    assert_not_equals(template.content.querySelector('#td'), null,
+            'Template should contain TD element');
+
+}, 'Generating of implied end tags. Test table elements');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    //No end &lt;/div&gt; tag. Should be added implicitly
+    doc.head.innerHTML = '&lt;template id=&quot;tpl&quot;&gt;&lt;div id=&quot;dv&quot;&gt;Div content&lt;/template&gt;';
+
+    var template = doc.querySelector('#tpl');
+
+    assert_not_equals(template, null, 'Template element must be parsed');
+
+    assert_equals(doc.querySelector('#dv'), null, 'DIV element should not be available');
+
+    assert_not_equals(template.content.querySelector('#dv'), null,
+            'Template should contain DIV element');
+
+}, 'Generating of implied end tags. Test DIV element');
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    //No end &lt;/div&gt; tag. Should be added implicitly after text content
+    doc.head.innerHTML = '&lt;template id=&quot;tpl&quot;&gt;Template text&lt;div id=&quot;dv&quot;&gt;Div content&lt;/template&gt;';
+
+    var template = doc.querySelector('#tpl');
+
+    assert_not_equals(template, null, 'Template element must be parsed');
+
+    assert_equals(doc.querySelector('#dv'), null, 'DIV element should not be available');
+
+    var div = template.content.querySelector('#dv');
+
+    assert_not_equals( div, null, 'Template should contain DIV element');
+    assert_equals(div.textContent, 'Div content', 'Wrong template content inner text');
+
+}, 'Generating of implied end tags. Test some text and DIV element');
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    // Wrong end tag. Correct end tag must be added implicitly, wrong one ignored
+    doc.head.innerHTML = '&lt;template id=&quot;tpl&quot;&gt;&lt;div id=&quot;dv&quot;&gt;Div content&lt;/span&gt;&lt;/template&gt;';
+
+    var template = doc.querySelector('#tpl');
+
+    assert_not_equals(template, null, 'Template element must be parsed');
+
+    assert_equals(template.content.childNodes.length, 1,
+            'Wrong number of template\'s children');
+
+    assert_equals(doc.querySelector('#dv'), null, 'DIV element should not be available');
+
+    assert_not_equals(template.content.querySelector('#dv'), null,
+            'Template should contain DIV element');
+    assert_equals(template.content.querySelector('#dv').textContent,
+            'Div content', 'Wrong template content inner text');
+
+}, 'Generating of implied end tags. Test wrong end tag');
+
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/head-template-contents-table-no-end-tag.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.head.querySelector('template');
+
+    assert_not_equals(template, null,
+            'Template element must be parsed');
+
+    assert_not_equals(template.content.querySelector('table'), null,
+            'Template should contain table element');
+    assert_not_equals(template.content.querySelector('tr'), null,
+            'Template should contain TR element');
+    assert_not_equals(template.content.querySelector('td'), null,
+            'Template should contain TD element');
+
+}, 'Generating of implied end tags. Test table elements. Load HTML document from file');
+
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/head-template-contents-div-no-end-tag.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.head.querySelector('template');
+
+    assert_not_equals(template, null, 'Template element must be parsed');
+
+    var div = template.content.querySelector('div');
+    assert_not_equals(div, null, 'Template should contain div element');
+    assert_equals(div.textContent, 'Hello, template\n    ', 'Invalid div contents');
+
+}, 'Generating of implied end tags. Test div element. Load HTML document from file');
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinheadinsertionmodetemplateendtagwithoutstartoneexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+
+PASS &lt;/template&gt; tag in HTML head without start one should be ignored 
+PASS &lt;/template&gt; tag in HTML head without start one should be ignored. Test valid &lt;template&gt; element and &lt;/template&gt; tag after it 
+PASS &lt;/template&gt; tag in HTML head without start one should be ignored. Test valid &lt;template&gt; element and &lt;/template&gt; tag before it 
+PASS &lt;/template&gt; tag in HTML head without start one should be ignored. Test valid &lt;template&gt; element, &lt;title&gt; element and &lt;/template&gt; tag before them 
+PASS &lt;/template&gt; tag in HTML head without start one should be ignored. Test valid &lt;template&gt; element, &lt;title&gt; element and &lt;/template&gt; tag after them 
+PASS &lt;/template&gt; tag in HTML head without start one should be ignored. Test HTML document loaded from file 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinheadinsertionmodetemplateendtagwithoutstartonehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,101 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: Template end tag without start one. Element should be ignored&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Aleksei Yu. Semenov&quot; href=&quot;a.semenov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;If parser in 'in head' insertion mode meets template end tag and if the stack of open elements has no template element in html scope, then this is a parse error; ignore the token&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-head-addition&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.head.innerHTML = '&lt;/template&gt;';
+
+    assert_equals(doc.head.childNodes.length, 0, 'Element must be ignored');
+
+}, '&lt;/template&gt; tag in HTML head without start one should be ignored');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.head.innerHTML = '&lt;template id=&quot;tmpl&quot;&gt;&lt;/template&gt;&lt;/template&gt;';
+
+    assert_equals(doc.head.childNodes.length, 1, 'Element must be ignored');
+    assert_not_equals(doc.querySelector('#tmpl'), null,
+            'Element should present it document head');
+
+}, '&lt;/template&gt; tag in HTML head without start one should be ignored. '
+    + 'Test valid &lt;template&gt; element and &lt;/template&gt; tag after it');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.head.innerHTML = '&lt;/template&gt;&lt;template id=&quot;tmpl&quot;&gt;&lt;/template&gt;';
+
+    assert_equals(doc.head.childNodes.length, 1, 'Element must be ignored');
+    assert_not_equals(doc.querySelector('#tmpl'), null,
+            'Element should present it document head');
+
+}, '&lt;/template&gt; tag in HTML head without start one should be ignored. '
+    + 'Test valid &lt;template&gt; element and &lt;/template&gt; tag before it');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.head.innerHTML = '&lt;/template&gt;&lt;template id=&quot;tmpl&quot;&gt;&lt;/template&gt;&lt;title&gt;&lt;/title&gt;';
+
+    assert_equals(doc.head.childNodes.length, 2, 'Element must be ignored');
+    assert_not_equals(doc.querySelector('#tmpl'), null,
+            'Valid element should present it document head');
+    assert_not_equals(doc.querySelector('title'), null,
+            'Valid title element should present it document head');
+
+}, '&lt;/template&gt; tag in HTML head without start one should be ignored. '
+    + 'Test valid &lt;template&gt; element, &lt;title&gt; element and &lt;/template&gt; tag before them');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.head.innerHTML = '&lt;template id=&quot;tmpl&quot;&gt;&lt;/template&gt;&lt;title&gt;&lt;/title&gt;&lt;/template&gt;';
+
+    assert_equals(doc.head.childNodes.length, 2, 'Element must be ignored');
+    assert_not_equals(doc.querySelector('#tmpl'), null,
+            'Valid element should present it document head');
+    assert_not_equals(doc.querySelector('title'), null,
+            'Valid title element should present it document head');
+
+}, '&lt;/template&gt; tag in HTML head without start one should be ignored. '
+    + 'Test valid &lt;template&gt; element, &lt;title&gt; element and &lt;/template&gt; tag after them');
+
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/end-template-tag-in-head.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    assert_equals(doc.head.querySelector('template'), null, '&lt;/template&gt; must be ignored');
+    assert_not_equals(doc.head.querySelector('title'), null,
+            'Valid element should present it document head');
+
+}, '&lt;/template&gt; tag in HTML head without start one should be ignored. '
+    + 'Test HTML document loaded from file');
+
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinheadinsertionmodew3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/w3c-import.log (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/w3c-import.log                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/w3c-import.log        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the W3C CSS or WPT github:
+        https://github.com/w3c/csswg-test
+        https://github.com/w3c/web-platform-tests
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport.
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/generating-of-implied-end-tags.html
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one.html
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheintableinsertionmodeendtagtableexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/end-tag-table-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/end-tag-table-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/end-tag-table-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS In table insertion mode. Ignore &lt;/table&gt; token 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheintableinsertionmodeendtagtablehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/end-tag-table.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/end-tag-table.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/end-tag-table.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: 'In table' insertion mode: ignore TABLE end tag&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;If parser is in 'in table' insertion mode and end tag table is met the ignore this token&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-table-addition&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+
+test(function () {
+    var doc = newHTMLDocument();
+
+    doc.body.innerHTML = '&lt;table id=&quot;table&quot;&gt;'
+        + '&lt;template id=&quot;template&quot;&gt;'
+        + '&lt;/table&gt;'
+        + '&lt;/template&gt;'
+        + '&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;'
+        + '&lt;/table&gt;';
+
+    var table = doc.querySelector('#table');
+    var template = table.querySelector('#template');
+
+    assert_equals(table.childNodes.length, 2, 'Wrong number of table children');
+    assert_not_equals(template, null, 'Template element must be parsed');
+    assert_equals(table.rows.length, 1, 'Wrong number of table rows');
+    assert_equals(template.childNodes.length, 0, 'Wrong number of the template child nodes');
+    assert_equals(template.content.childNodes.length, 0,
+            'Wrong number of the template child nodes');
+
+
+}, 'In table insertion mode. Ignore &lt;/table&gt; token');
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheintableinsertionmodew3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/w3c-import.log (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/w3c-import.log                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/w3c-import.log        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the W3C CSS or WPT github:
+        https://github.com/w3c/csswg-test
+        https://github.com/w3c/web-platform-tests
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport.
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-table-insertion-mode/end-tag-table.html
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateappendingtoatemplatetemplatechildnodesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/appending-to-a-template/template-child-nodes-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/appending-to-a-template/template-child-nodes-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/appending-to-a-template/template-child-nodes-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+
+PASS Template child nodes must be appended to template content node 
+PASS Template child nodes must be appended to template content. Test nested template 
+PASS Template child nodes must be appended to template content node. Load HTML document from a file 
+PASS Template child nodes must be appended to nested template content node. Load HTML document from a file 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateappendingtoatemplatetemplatechildnodeshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/appending-to-a-template/template-child-nodes.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/appending-to-a-template/template-child-nodes.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/appending-to-a-template/template-child-nodes.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,116 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: HTML parser appends child nodes only to the template contents node&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Aleksei Yu. Semenov&quot; href=&quot;mailto:a.semenov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;HTML parser must append template's child nodes only to the template contents node.&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#appending-to-a-template&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+
+test(function () {
+    var doc = newHTMLDocument();
+    doc.body.innerHTML = '&lt;template id=&quot;tmpl1&quot;&gt;' +
+        '&lt;div id=&quot;div1&quot;&gt;This is div inside template&lt;/div&gt;' +
+        '&lt;div id=&quot;div2&quot;&gt;This is another div inside template&lt;/div&gt;' +
+        '&lt;/template&gt;';
+
+    var template = doc.querySelector('#tmpl1');
+
+    assert_equals(template.childNodes.length, 0, 'Wrong number of template child nodes');
+    assert_equals(template.content.childNodes.length, 2,
+            'Wrong number of template content child nodes');
+
+    assert_not_equals(template.content.querySelector('#div1'), null,
+            'Element is absent in the template content');
+    assert_not_equals(template.content.querySelector('#div2'), null,
+            'Element is absent in the template content');
+
+}, 'Template child nodes must be appended to template content node');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+    doc.body.innerHTML = '&lt;template id=&quot;tmpl1&quot;&gt;' +
+        '&lt;div id=&quot;div1&quot;&gt;This is div inside template&lt;/div&gt;' +
+        '&lt;div id=&quot;div2&quot;&gt;This is another div inside template&lt;/div&gt;' +
+        '&lt;template id=&quot;tmpl2&quot;&gt;' +
+        '&lt;div id=&quot;div3&quot;&gt;This is div inside nested template&lt;/div&gt;' +
+        '&lt;div id=&quot;div4&quot;&gt;This is another div inside nested template&lt;/div&gt;' +
+        '&lt;/template&gt;' +
+        '&lt;/template&gt;';
+
+    var template = doc.querySelector('#tmpl1');
+
+    assert_equals(template.childNodes.length, 0,
+            'Wrong number of template child nodes');
+    assert_equals(template.content.childNodes.length, 3,
+            'Wrong number of template content child nodes');
+
+    assert_not_equals(template.content.querySelector('#div1'), null,
+            'Element is absent in the template content');
+    assert_not_equals(template.content.querySelector('#div2'), null,
+            'Element is absent in the template content');
+
+    var nestedTemplate = template.content.querySelector('#tmpl2');
+
+    assert_equals(nestedTemplate.childNodes.length, 0,
+            'Wrong number of template child nodes');
+    assert_equals(nestedTemplate.content.childNodes.length, 2,
+            'Wrong number of nested template content child nodes');
+
+    assert_not_equals(nestedTemplate.content.querySelector('#div3'), null,
+            'Element is absent in the template content');
+    assert_not_equals(nestedTemplate.content.querySelector('#div4'), null,
+            'Element is absent in the template content');
+
+}, 'Template child nodes must be appended to template content. Test nested template');
+
+
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/template-contents.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.querySelector('template');
+
+    assert_equals(template.childNodes.length, 0, 'Wrong number of template child nodes');
+
+    assert_not_equals(template.content.querySelector('div'), null,
+            'Element is absent in the template content');
+
+}, 'Template child nodes must be appended to template content node. '
+    + 'Load HTML document from a file');
+
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/template-contents-nested.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.querySelector('template');
+
+    assert_equals(template.childNodes.length, 0, 'Wrong number of template child nodes');
+
+    var nestedTemplate = template.content.querySelector('template');
+
+    assert_not_equals(nestedTemplate, null,
+            'Element is absent in the template content');
+
+    assert_equals(nestedTemplate.childNodes.length, 0,
+            'Wrong number of template child nodes');
+
+    assert_not_equals(nestedTemplate.content.querySelector('div'), null,
+            'Element is absent in the template content');
+
+}, 'Template child nodes must be appended to nested template content node. '
+    + 'Load HTML document from a file');
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateappendingtoatemplatew3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/appending-to-a-template/w3c-import.log (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/appending-to-a-template/w3c-import.log                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/appending-to-a-template/w3c-import.log        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the W3C CSS or WPT github:
+        https://github.com/w3c/csswg-test
+        https://github.com/w3c/web-platform-tests
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport.
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/appending-to-a-template/template-child-nodes.html
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateclearingthestackbacktoagivencontextclearingstackbacktoatablebodycontextexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+
+PASS Clearing stack back to a table body context. Test &lt;tr&gt; in &lt;tbody&gt; 
+PASS Clearing stack back to a table body context. Test &lt;tr&gt; in &lt;thead&gt; 
+PASS Clearing stack back to a table body context. Test &lt;tr&gt; in &lt;tfoot&gt; 
+PASS Clearing stack back to a table body context. Test &lt;/tbody&gt; 
+PASS Clearing stack back to a table body context. Test &lt;/thead&gt; 
+PASS Clearing stack back to a table body context. Test &lt;/tfoot&gt; 
+PASS Clearing stack back to a table body context. Test &lt;caption&gt; in &lt;tbody&gt; 
+PASS Clearing stack back to a table body context. Test &lt;caption&gt; in &lt;tfoot&gt; 
+PASS Clearing stack back to a table body context. Test &lt;caption&gt; in &lt;thead&gt; 
+PASS Clearing stack back to a table body context. Test &lt;col&gt; in &lt;tbody&gt; 
+PASS Clearing stack back to a table body context. Test &lt;col&gt; in &lt;tfoot&gt; 
+PASS Clearing stack back to a table body context. Test &lt;col&gt; in &lt;thead&gt; 
+PASS Clearing stack back to a table body context. Test &lt;colgroup&gt; in &lt;tbody&gt; 
+PASS Clearing stack back to a table body context. Test &lt;colgroup&gt; in &lt;tfoot&gt; 
+PASS Clearing stack back to a table body context. Test &lt;colgroup&gt; in &lt;thead&gt; 
+PASS Clearing stack back to a table body context. Test &lt;tbody&gt; in &lt;tbody&gt; 
+PASS Clearing stack back to a table body context. Test &lt;tbody&gt; in &lt;tfoot&gt; 
+PASS Clearing stack back to a table body context. Test &lt;tbody&gt; in &lt;thead&gt; 
+PASS Clearing stack back to a table body context. Test &lt;tfoot&gt; in &lt;tbody&gt; 
+PASS Clearing stack back to a table body context. Test &lt;tfoot&gt; in &lt;tfoot&gt; 
+PASS Clearing stack back to a table body context. Test &lt;tfoot&gt; in &lt;thead&gt; 
+PASS Clearing stack back to a table body context. Test &lt;thead&gt; in &lt;tbody&gt; 
+PASS Clearing stack back to a table body context. Test &lt;thead&gt; in &lt;tfoot&gt; 
+PASS Clearing stack back to a table body context. Test &lt;thead&gt; in &lt;thead&gt; 
+PASS Clearing stack back to a table body context. Test &lt;/table&gt; in &lt;tbody&gt; 
+PASS Clearing stack back to a table body context. Test &lt;/table&gt; in &lt;tfoot&gt; 
+PASS Clearing stack back to a table body context. Test &lt;/table&gt; in &lt;thead&gt; 
+PASS Clearing stack back to a table body context. Test &lt;/tbody&gt; in &lt;thead&gt; 
+PASS Clearing stack back to a table body context. Test &lt;/tbody&gt; in &lt;tfoot&gt; 
+PASS Clearing stack back to a table body context. Test &lt;/thead&gt; in &lt;tbody&gt; 
+PASS Clearing stack back to a table body context. Test &lt;/thead&gt; in &lt;tfoot&gt; 
+PASS Clearing stack back to a table body context. Test &lt;/tfoot&gt; in &lt;thead&gt; 
+PASS Clearing stack back to a table body context. Test &lt;/tfoot&gt; in &lt;tbody&gt; 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateclearingthestackbacktoagivencontextclearingstackbacktoatablebodycontexthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,182 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: Clearing stack back to a table body context&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;Clearing the stack back to a table body context must be aborted if the current node is template&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#clearing-the-stack&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+function doTest(doc, tagToTest, templateInnerHTML, id, tagName, bodiesNum, footerIsNull,
+        footerId, headerIsNull, headerId) {
+
+    doc.body.innerHTML = '' +
+        '&lt;table id=&quot;tbl&quot;&gt;' +
+        '&lt;' + tagToTest + '&gt;' +
+        '&lt;template id=&quot;tmpl1&quot;&gt;' +
+        // When parser meets &lt;tr&gt;, &lt;/tbody&gt;, &lt;/tfoot&gt;, &lt;/thead&gt;, &lt;caption&gt;, &lt;col&gt;,
+        // &lt;colgroup&gt;, &lt;tbody&gt;, &lt;tfoot&gt;, &lt;thead&gt;, &lt;/table&gt;
+        // stack must be cleared back to table body context. But &lt;template&gt; tag should
+        // abort this
+        templateInnerHTML +
+        '&lt;/template&gt;' +
+        '&lt;tr id=&quot;tr&quot;&gt;' +
+        '&lt;td id=&quot;td&quot;&gt;' +
+        '&lt;/td&gt;' +
+        '&lt;/tr&gt;' +
+        '&lt;/' + tagToTest + '&gt;' +
+        '&lt;/table&gt;';
+
+    var table = doc.querySelector('#tbl');
+    var tr = doc.querySelector('#tr');
+    var td = doc.querySelector('#td');
+    var template = doc.querySelector('#tmpl1');
+
+    assert_equals(table.rows.length, 1, 'Wrong number of table rows');
+    assert_equals(table.rows[0].cells.length, 1, 'Wrong number of table cells');
+    if (id !== null) {
+        assert_not_equals(template.content.querySelector('#' + id), null,
+                'Element should present in the template content');
+    }
+    if (tagName !== null) {
+        assert_equals(template.content.querySelector('#' + id).tagName, tagName,
+                'Wrong element in the template content');
+    }
+
+    assert_equals(table.caption, null, 'Table should have no caption');
+
+    if (bodiesNum) {
+        assert_equals(table.tBodies.length, bodiesNum, 'Table should have '
+                + bodiesNum + ' body');
+    }
+    if (footerIsNull) {
+        assert_equals(table.tFoot, null, 'Table should have no footer');
+    }
+    if (footerId) {
+        assert_not_equals(table.tFoot.id, footerId,
+                'Table should have no footer with id=&quot;' + footerId + '&quot;');
+    }
+    if (headerIsNull) {
+        assert_equals(table.tHead, null, 'Table should have no header');
+    }
+    if (headerId) {
+        assert_not_equals(table.tHead.id, headerId,
+                'Table should have no header with id=&quot;' + headerId + '&quot;');
+    }
+}
+
+
+
+var doc = newHTMLDocument();
+var parameters = [
+    ['Clearing stack back to a table body context. Test &lt;tr&gt; in &lt;tbody&gt;',
+     doc, 'tbody', '&lt;tr id=&quot;tr1&quot;&gt;&lt;td&gt;Cell content&lt;/td&gt;&lt;/tr&gt;', 'tr1', 'TR'],
+
+    ['Clearing stack back to a table body context. Test &lt;tr&gt; in &lt;thead&gt;',
+     doc, 'thead', '&lt;tr id=&quot;tr2&quot;&gt;&lt;td&gt;Cell content&lt;/td&gt;&lt;/tr&gt;', 'tr2', 'TR'],
+
+    ['Clearing stack back to a table body context. Test &lt;tr&gt; in &lt;tfoot&gt;',
+     doc, 'tfoot', '&lt;tr id=&quot;tr3&quot;&gt;&lt;td&gt;Cell content&lt;/td&gt;&lt;/tr&gt;', 'tr3', 'TR'],
+
+    ['Clearing stack back to a table body context. Test &lt;/tbody&gt;',
+     doc, 'tbody', '&lt;/tbody&gt;', null, null],
+
+    ['Clearing stack back to a table body context. Test &lt;/thead&gt;',
+     doc, 'thead', '&lt;/thead&gt;', null, null],
+
+    ['Clearing stack back to a table body context. Test &lt;/tfoot&gt;',
+     doc, 'tfoot', '&lt;/tfoot&gt;', null, null],
+
+    ['Clearing stack back to a table body context. Test &lt;caption&gt; in &lt;tbody&gt;',
+     doc, 'tbody', '&lt;caption id=&quot;caption1&quot;&gt;Table Caption&lt;/caption&gt;', 'caption1', 'CAPTION'],
+
+    ['Clearing stack back to a table body context. Test &lt;caption&gt; in &lt;tfoot&gt;',
+     doc, 'tfoot', '&lt;caption id=&quot;caption2&quot;&gt;Table Caption&lt;/caption&gt;', 'caption2', 'CAPTION'],
+
+    ['Clearing stack back to a table body context. Test &lt;caption&gt; in &lt;thead&gt;',
+     doc, 'thead', '&lt;caption id=&quot;caption3&quot;&gt;Table Caption&lt;/caption&gt;', 'caption3', 'CAPTION'],
+
+    ['Clearing stack back to a table body context. Test &lt;col&gt; in &lt;tbody&gt;',
+     doc, 'tbody', '&lt;col id=&quot;col1&quot; width=&quot;150&quot;/&gt;', 'col1', 'COL'],
+
+    ['Clearing stack back to a table body context. Test &lt;col&gt; in &lt;tfoot&gt;',
+     doc, 'tfoot', '&lt;col id=&quot;col2&quot; width=&quot;150&quot;/&gt;', 'col2', 'COL'],
+
+    ['Clearing stack back to a table body context. Test &lt;col&gt; in &lt;thead&gt;',
+     doc, 'thead', '&lt;col id=&quot;col3&quot; width=&quot;150&quot;/&gt;', 'col3', 'COL'],
+
+    ['Clearing stack back to a table body context. Test &lt;colgroup&gt; in &lt;tbody&gt;',
+     doc, 'tbody', '&lt;colgroup id=&quot;colgroup1&quot; width=&quot;150&quot;/&gt;', 'colgroup1', 'COLGROUP'],
+
+    ['Clearing stack back to a table body context. Test &lt;colgroup&gt; in &lt;tfoot&gt;',
+     doc, 'tfoot', '&lt;colgroup id=&quot;colgroup2&quot; width=&quot;150&quot;/&gt;', 'colgroup2', 'COLGROUP'],
+
+    ['Clearing stack back to a table body context. Test &lt;colgroup&gt; in &lt;thead&gt;',
+     doc, 'thead', '&lt;colgroup id=&quot;colgroup3&quot; width=&quot;150&quot;/&gt;', 'colgroup3', 'COLGROUP'],
+
+    ['Clearing stack back to a table body context. Test &lt;tbody&gt; in &lt;tbody&gt;',
+     doc, 'tbody', '&lt;tbody id=&quot;tbody1&quot;&gt;&lt;/tbody&gt;', 'tbody1', 'TBODY', 1],
+
+    ['Clearing stack back to a table body context. Test &lt;tbody&gt; in &lt;tfoot&gt;',
+     doc, 'tfoot', '&lt;tbody id=&quot;tbody2&quot;&gt;&lt;/tbody&gt;', 'tbody2', 'TBODY', 0],
+
+    ['Clearing stack back to a table body context. Test &lt;tbody&gt; in &lt;thead&gt;',
+     doc, 'thead', '&lt;tbody id=&quot;tbody3&quot;&gt;&lt;/tbody&gt;', 'tbody3', 'TBODY', 0],
+
+    ['Clearing stack back to a table body context. Test &lt;tfoot&gt; in &lt;tbody&gt;',
+     doc, 'tbody', '&lt;tfoot id=&quot;tfoot1&quot;&gt;&lt;/tfoot&gt;', 'tfoot1', 'TFOOT', null, true],
+
+    ['Clearing stack back to a table body context. Test &lt;tfoot&gt; in &lt;tfoot&gt;',
+     doc, 'tfoot', '&lt;tfoot id=&quot;tfoot2&quot;&gt;&lt;/tfoot&gt;', 'tfoot2', 'TFOOT', null, false, 'tfoot2'],
+
+    ['Clearing stack back to a table body context. Test &lt;tfoot&gt; in &lt;thead&gt;',
+     doc, 'thead', '&lt;tfoot id=&quot;tfoot3&quot;&gt;&lt;/tfoot&gt;', 'tfoot3', 'TFOOT', null, true],
+
+    ['Clearing stack back to a table body context. Test &lt;thead&gt; in &lt;tbody&gt;',
+     doc, 'tbody', '&lt;thead id=&quot;thead1&quot;&gt;&lt;/thead&gt;', 'thead1', 'THEAD', null, false, null, true],
+
+    ['Clearing stack back to a table body context. Test &lt;thead&gt; in &lt;tfoot&gt;',
+     doc, 'tfoot', '&lt;thead id=&quot;thead2&quot;&gt;&lt;/thead&gt;', 'thead2', 'THEAD', null, false, null, true],
+
+    ['Clearing stack back to a table body context. Test &lt;thead&gt; in &lt;thead&gt;',
+     doc, 'thead', '&lt;thead id=&quot;thead3&quot;&gt;&lt;/thead&gt;', 'thead3', 'THEAD', null, false, null, false, 'thead3'],
+
+    ['Clearing stack back to a table body context. Test &lt;/table&gt; in &lt;tbody&gt;',
+     doc, 'tbody', '&lt;/table&gt;', null, null, null, false, null, true],
+
+    ['Clearing stack back to a table body context. Test &lt;/table&gt; in &lt;tfoot&gt;',
+     doc, 'tfoot', '&lt;/table&gt;', null, null, null, false, null, true],
+
+    ['Clearing stack back to a table body context. Test &lt;/table&gt; in &lt;thead&gt;',
+     doc, 'thead', '&lt;/table&gt;', null, null],
+
+    ['Clearing stack back to a table body context. Test &lt;/tbody&gt; in &lt;thead&gt;',
+     doc, 'thead', '&lt;/tbody&gt;', null, null],
+
+    ['Clearing stack back to a table body context. Test &lt;/tbody&gt; in &lt;tfoot&gt;',
+     doc, 'tfoot', '&lt;/tbody&gt;', null, null],
+
+    ['Clearing stack back to a table body context. Test &lt;/thead&gt; in &lt;tbody&gt;',
+     doc, 'tbody', '&lt;/thead&gt;', null, null],
+
+    ['Clearing stack back to a table body context. Test &lt;/thead&gt; in &lt;tfoot&gt;',
+     doc, 'tfoot', '&lt;/thead&gt;', null, null],
+
+    ['Clearing stack back to a table body context. Test &lt;/tfoot&gt; in &lt;thead&gt;',
+     doc, 'thead', '&lt;/tfoot&gt;', null, null],
+
+    ['Clearing stack back to a table body context. Test &lt;/tfoot&gt; in &lt;tbody&gt;',
+     doc, 'tbody', '&lt;/tfoot&gt;', null, null]
+];
+
+generate_tests(doTest, parameters, 'Clearing stack back to a table body context.');
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateclearingthestackbacktoagivencontextclearingstackbacktoatablecontextexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+
+PASS Clearing stack back to a table context. Test &lt;caption&gt; 
+PASS Clearing stack back to a table context. Test &lt;colgroup&gt; 
+PASS Clearing stack back to a table context. Test &lt;tbody&gt; 
+PASS Clearing stack back to a table context. Test &lt;tfoot&gt; 
+PASS Clearing stack back to a table context. Test &lt;thead&gt; 
+PASS Clearing stack back to a table context. Test &lt;col&gt; 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateclearingthestackbacktoagivencontextclearingstackbacktoatablecontexthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: Clearing stack back to a table context&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;Clearing the stack back to a table context must be aborted if the current node is template&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#clearing-the-stack&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+function doTest(doc, templateInnerHTML, id, tagName, bodiesNum, footerIsNull,
+        headerIsNull) {
+
+    doc.body.innerHTML = '' +
+        '&lt;table id=&quot;tbl&quot;&gt;' +
+        '&lt;template id=&quot;tmpl1&quot;&gt;' +
+        // When parser meets &lt;caption&gt;, &lt;colgroup&gt;, &lt;tbody&gt;, &lt;tfoot&gt;, &lt;thead&gt;, &lt;col&gt;
+        // stack must be cleared back to table context.
+        //But &lt;template&gt; tag should abort this process
+        templateInnerHTML +
+        '&lt;/template&gt;' +
+        '&lt;tr id=&quot;tr&quot;&gt;' +
+        '&lt;td id=&quot;td&quot;&gt;' +
+        '&lt;/td&gt;' +
+        '&lt;/tr&gt;' +
+        '&lt;/table&gt;';
+
+    var table = doc.querySelector('#tbl');
+    var tr = doc.querySelector('#tr');
+    var td = doc.querySelector('#td');
+    var template = doc.querySelector('#tmpl1');
+
+    assert_equals(table.rows.length, 1, 'Wrong number of table rows');
+    assert_equals(table.rows[0].cells.length, 1, 'Wrong number of table cells');
+    assert_equals(template.parentNode, table, 'Wrong template parent');
+    assert_not_equals(template.content.querySelector('#' + id), null,
+                'Element should present in the template content');
+    assert_equals(doc.querySelector('#tbl').caption, null, 'Table should have no caption');
+    assert_equals(template.content.querySelector('#' + id).tagName, tagName,
+                'Wrong element in the template content');
+    if (bodiesNum) {
+        assert_equals(table.tBodies.length, bodiesNum, 'Table should have '
+                + bodiesNum + ' body');
+    }
+    if (footerIsNull) {
+        assert_equals(table.tFoot, null, 'Table should have no footer');
+    }
+    if (headerIsNull) {
+        assert_equals(table.tHead, null, 'Table should have no header');
+    }
+}
+
+
+var doc = newHTMLDocument();
+var parameters = [
+    ['Clearing stack back to a table context. Test &lt;caption&gt;',
+     doc, '&lt;caption id=&quot;caption1&quot;&gt;Table caption&lt;/caption&gt;', 'caption1', 'CAPTION'],
+
+    ['Clearing stack back to a table context. Test &lt;colgroup&gt;',
+     doc, '&lt;colgroup id=&quot;colgroup1&quot; width=&quot;100%&quot;/&gt;', 'colgroup1', 'COLGROUP'],
+
+    ['Clearing stack back to a table context. Test &lt;tbody&gt;',
+     doc, '&lt;tbody id=&quot;tbody1&quot;&gt;&lt;/tbody&gt;', 'tbody1', 'TBODY', 1],
+
+    ['Clearing stack back to a table context. Test &lt;tfoot&gt;',
+     doc, '&lt;tfoot id=&quot;tfoot1&quot;&gt;&lt;/tfoot&gt;', 'tfoot1', 'TFOOT', null, true],
+
+    ['Clearing stack back to a table context. Test &lt;thead&gt;',
+     doc, '&lt;thead id=&quot;thead1&quot;&gt;&lt;/thead&gt;', 'thead1', 'THEAD', null, false, true],
+
+    ['Clearing stack back to a table context. Test &lt;col&gt;',
+     doc, '&lt;col id=&quot;col1&quot; width=&quot;100%&quot;/&gt;', 'col1', 'COL']
+];
+
+generate_tests(doTest, parameters, 'Clearing stack back to a table body context.');
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateclearingthestackbacktoagivencontextclearingstackbacktoatablerowcontextexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+
+PASS Clearing stack back to a table row context. Test &lt;th&gt; 
+PASS Clearing stack back to a table row context. Test &lt;td&gt; 
+PASS Clearing stack back to a table row context. Test &lt;/tr&gt; 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateclearingthestackbacktoagivencontextclearingstackbacktoatablerowcontexthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: Clearing stack back to a table row context&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;Clearing the stack back to a table row context must be aborted if the current node is template&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#clearing-the-stack&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+function doTest(doc, templateInnerHTML, id, tagName, elementId) {
+
+    doc.body.innerHTML = '' +
+        '&lt;table id=&quot;tbl&quot;&gt;' +
+        '&lt;tr id=&quot;tr&quot;&gt;' +
+        '&lt;template id=&quot;tmpl1&quot;&gt;' +
+        // When parser meets &lt;th&gt;, &lt;td&gt;, &lt;/tr&gt;, stack must be cleared
+        // back to table row context.
+        // But &lt;template&gt; tag should abort this
+        templateInnerHTML +
+        '&lt;/template&gt;' +
+        '&lt;td id=&quot;td&quot;&gt;' +
+        '&lt;/td&gt;' +
+        '&lt;/tr&gt;' +
+        '&lt;/table&gt;';
+
+    var table = doc.querySelector('#tbl');
+    var tr = doc.querySelector('#tr');
+    var td = doc.querySelector('#td');
+    var template = doc.querySelector('#tmpl1');
+
+    assert_equals(table.rows.length, 1, 'Wrong number of table rows');
+    assert_equals(table.rows[0].cells.length, 1, 'Wrong number of table cells');
+    assert_equals(template.parentNode, tr, 'Wrong template parent');
+    if (id !== null) {
+        assert_not_equals(template.content.querySelector('#' + id), null,
+                    'Element should present in the template content');
+    }
+    if (tagName !== null) {
+        assert_equals(template.content.querySelector('#' + id).tagName, tagName,
+                'Wrong element in the template content');
+    }
+    if (elementId) {
+        assert_equals(doc.querySelector('#' + elementId), null,
+                'Table should have no element with ID ' + elementId);
+    }
+}
+
+
+var doc = newHTMLDocument();
+var parameters = [
+    ['Clearing stack back to a table row context. Test &lt;th&gt;',
+     doc, '&lt;th id=&quot;th1&quot;&gt;Table header&lt;/th&gt;', 'th1', 'TH', 'th1'],
+
+    ['Clearing stack back to a table row context. Test &lt;td&gt;',
+     doc, '&lt;td id=&quot;td1&quot;&gt;Table cell&lt;/td&gt;', 'td1', 'TD', 'td1'],
+
+     ['Clearing stack back to a table row context. Test &lt;/tr&gt;',
+      doc, '&lt;/tr&gt;', null, null]
+];
+
+generate_tests(doTest, parameters, 'Clearing stack back to a table body context.');
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateclearingthestackbacktoagivencontextw3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/w3c-import.log (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/w3c-import.log                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/w3c-import.log        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the W3C CSS or WPT github:
+        https://github.com/w3c/csswg-test
+        https://github.com/w3c/web-platform-tests
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport.
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-body-context.html
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-context.html
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context.html
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplatecreatinganelementforthetokentemplateownerdocumentexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document-expected.txt (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document-expected.txt        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,217 @@
</span><ins>+
+PASS Test ownerDocument property of the element in a template. Current DOCUMENT has no browsing context. Test template element inside the div 
+PASS Test ownerDocument property of the element in a template. Current DOCUMENT has no browsing context. Test template element in the root of the body 
+PASS Test ownerDocument property of the element in a template. Current DOCUMENT has no browsing context. Test template element in the root of the head 
+PASS Test ownerDocument property of the element in a nested template 
+PASS Test ownerDocument property of the element in a template. Load HTML document from a file, current DOCUMENT has browsing context 
+PASS Test ownerDocument property of the element in a nested template. Load HTML document from a file, current DOCUMENT has browsing context 
+PASS Test ownerDocument property of two elements in a template. Load HTML document from a file, current DOCUMENT has browsing context 
+PASS Test ownerDocument for the element a in the template 
+PASS Test ownerDocument for the element abbr in the template 
+PASS Test ownerDocument for the element address in the template 
+PASS Test ownerDocument for the element area in the template 
+PASS Test ownerDocument for the element article in the template 
+PASS Test ownerDocument for the element aside in the template 
+PASS Test ownerDocument for the element audio in the template 
+PASS Test ownerDocument for the element b in the template 
+PASS Test ownerDocument for the element base in the template 
+PASS Test ownerDocument for the element bdi in the template 
+PASS Test ownerDocument for the element bdo in the template 
+PASS Test ownerDocument for the element blockquote in the template 
+PASS Test ownerDocument for the element br in the template 
+PASS Test ownerDocument for the element button in the template 
+PASS Test ownerDocument for the element canvas in the template 
+PASS Test ownerDocument for the element caption in the template 
+PASS Test ownerDocument for the element cite in the template 
+PASS Test ownerDocument for the element code in the template 
+PASS Test ownerDocument for the element col in the template 
+PASS Test ownerDocument for the element colgroup in the template 
+PASS Test ownerDocument for the element command in the template 
+PASS Test ownerDocument for the element datalist in the template 
+PASS Test ownerDocument for the element dd in the template 
+PASS Test ownerDocument for the element del in the template 
+PASS Test ownerDocument for the element details in the template 
+PASS Test ownerDocument for the element dfn in the template 
+PASS Test ownerDocument for the element dialog in the template 
+PASS Test ownerDocument for the element div in the template 
+PASS Test ownerDocument for the element dl in the template 
+PASS Test ownerDocument for the element dt in the template 
+PASS Test ownerDocument for the element em in the template 
+PASS Test ownerDocument for the element embed in the template 
+PASS Test ownerDocument for the element fieldset in the template 
+PASS Test ownerDocument for the element figcaption in the template 
+PASS Test ownerDocument for the element figure in the template 
+PASS Test ownerDocument for the element footer in the template 
+PASS Test ownerDocument for the element form in the template 
+PASS Test ownerDocument for the element h1 in the template 
+PASS Test ownerDocument for the element h2 in the template 
+PASS Test ownerDocument for the element h3 in the template 
+PASS Test ownerDocument for the element h4 in the template 
+PASS Test ownerDocument for the element h5 in the template 
+PASS Test ownerDocument for the element h6 in the template 
+PASS Test ownerDocument for the element header in the template 
+PASS Test ownerDocument for the element hgroup in the template 
+PASS Test ownerDocument for the element hr in the template 
+PASS Test ownerDocument for the element i in the template 
+PASS Test ownerDocument for the element iframe in the template 
+PASS Test ownerDocument for the element img in the template 
+PASS Test ownerDocument for the element input in the template 
+PASS Test ownerDocument for the element ins in the template 
+PASS Test ownerDocument for the element kbd in the template 
+PASS Test ownerDocument for the element keygen in the template 
+PASS Test ownerDocument for the element label in the template 
+PASS Test ownerDocument for the element legend in the template 
+PASS Test ownerDocument for the element li in the template 
+PASS Test ownerDocument for the element link in the template 
+PASS Test ownerDocument for the element map in the template 
+PASS Test ownerDocument for the element mark in the template 
+PASS Test ownerDocument for the element menu in the template 
+PASS Test ownerDocument for the element meta in the template 
+PASS Test ownerDocument for the element meter in the template 
+PASS Test ownerDocument for the element nav in the template 
+PASS Test ownerDocument for the element noscript in the template 
+PASS Test ownerDocument for the element object in the template 
+PASS Test ownerDocument for the element ol in the template 
+PASS Test ownerDocument for the element optgroup in the template 
+PASS Test ownerDocument for the element option in the template 
+PASS Test ownerDocument for the element output in the template 
+PASS Test ownerDocument for the element p in the template 
+PASS Test ownerDocument for the element param in the template 
+PASS Test ownerDocument for the element pre in the template 
+PASS Test ownerDocument for the element progress in the template 
+PASS Test ownerDocument for the element q in the template 
+PASS Test ownerDocument for the element rp in the template 
+PASS Test ownerDocument for the element rt in the template 
+PASS Test ownerDocument for the element ruby in the template 
+PASS Test ownerDocument for the element s in the template 
+PASS Test ownerDocument for the element samp in the template 
+PASS Test ownerDocument for the element script in the template 
+PASS Test ownerDocument for the element section in the template 
+PASS Test ownerDocument for the element select in the template 
+PASS Test ownerDocument for the element small in the template 
+PASS Test ownerDocument for the element source in the template 
+PASS Test ownerDocument for the element span in the template 
+PASS Test ownerDocument for the element strong in the template 
+PASS Test ownerDocument for the element style in the template 
+PASS Test ownerDocument for the element sub in the template 
+PASS Test ownerDocument for the element table in the template 
+PASS Test ownerDocument for the element tbody in the template 
+PASS Test ownerDocument for the element td in the template 
+PASS Test ownerDocument for the element textarea in the template 
+PASS Test ownerDocument for the element tfoot in the template 
+PASS Test ownerDocument for the element th in the template 
+PASS Test ownerDocument for the element thead in the template 
+PASS Test ownerDocument for the element time in the template 
+PASS Test ownerDocument for the element title in the template 
+PASS Test ownerDocument for the element tr in the template 
+PASS Test ownerDocument for the element track in the template 
+PASS Test ownerDocument for the element u in the template 
+PASS Test ownerDocument for the element ul in the template 
+PASS Test ownerDocument for the element var in the template 
+PASS Test ownerDocument for the element video in the template 
+PASS Test ownerDocument for the element wbr in the template 
+PASS Test ownerDocument for the element a in the template. Document has browsing context 
+PASS Test ownerDocument for the element abbr in the template. Document has browsing context 
+PASS Test ownerDocument for the element address in the template. Document has browsing context 
+PASS Test ownerDocument for the element area in the template. Document has browsing context 
+PASS Test ownerDocument for the element article in the template. Document has browsing context 
+PASS Test ownerDocument for the element aside in the template. Document has browsing context 
+PASS Test ownerDocument for the element audio in the template. Document has browsing context 
+PASS Test ownerDocument for the element b in the template. Document has browsing context 
+PASS Test ownerDocument for the element base in the template. Document has browsing context 
+PASS Test ownerDocument for the element bdi in the template. Document has browsing context 
+PASS Test ownerDocument for the element bdo in the template. Document has browsing context 
+PASS Test ownerDocument for the element blockquote in the template. Document has browsing context 
+PASS Test ownerDocument for the element br in the template. Document has browsing context 
+PASS Test ownerDocument for the element button in the template. Document has browsing context 
+PASS Test ownerDocument for the element canvas in the template. Document has browsing context 
+PASS Test ownerDocument for the element caption in the template. Document has browsing context 
+PASS Test ownerDocument for the element cite in the template. Document has browsing context 
+PASS Test ownerDocument for the element code in the template. Document has browsing context 
+PASS Test ownerDocument for the element col in the template. Document has browsing context 
+PASS Test ownerDocument for the element colgroup in the template. Document has browsing context 
+PASS Test ownerDocument for the element command in the template. Document has browsing context 
+PASS Test ownerDocument for the element datalist in the template. Document has browsing context 
+PASS Test ownerDocument for the element dd in the template. Document has browsing context 
+PASS Test ownerDocument for the element del in the template. Document has browsing context 
+PASS Test ownerDocument for the element details in the template. Document has browsing context 
+PASS Test ownerDocument for the element dfn in the template. Document has browsing context 
+PASS Test ownerDocument for the element dialog in the template. Document has browsing context 
+PASS Test ownerDocument for the element div in the template. Document has browsing context 
+PASS Test ownerDocument for the element dl in the template. Document has browsing context 
+PASS Test ownerDocument for the element dt in the template. Document has browsing context 
+PASS Test ownerDocument for the element em in the template. Document has browsing context 
+PASS Test ownerDocument for the element embed in the template. Document has browsing context 
+PASS Test ownerDocument for the element fieldset in the template. Document has browsing context 
+PASS Test ownerDocument for the element figcaption in the template. Document has browsing context 
+PASS Test ownerDocument for the element figure in the template. Document has browsing context 
+PASS Test ownerDocument for the element footer in the template. Document has browsing context 
+PASS Test ownerDocument for the element form in the template. Document has browsing context 
+PASS Test ownerDocument for the element h1 in the template. Document has browsing context 
+PASS Test ownerDocument for the element h2 in the template. Document has browsing context 
+PASS Test ownerDocument for the element h3 in the template. Document has browsing context 
+PASS Test ownerDocument for the element h4 in the template. Document has browsing context 
+PASS Test ownerDocument for the element h5 in the template. Document has browsing context 
+PASS Test ownerDocument for the element h6 in the template. Document has browsing context 
+PASS Test ownerDocument for the element header in the template. Document has browsing context 
+PASS Test ownerDocument for the element hgroup in the template. Document has browsing context 
+PASS Test ownerDocument for the element hr in the template. Document has browsing context 
+PASS Test ownerDocument for the element i in the template. Document has browsing context 
+PASS Test ownerDocument for the element iframe in the template. Document has browsing context 
+PASS Test ownerDocument for the element img in the template. Document has browsing context 
+PASS Test ownerDocument for the element input in the template. Document has browsing context 
+PASS Test ownerDocument for the element ins in the template. Document has browsing context 
+PASS Test ownerDocument for the element kbd in the template. Document has browsing context 
+PASS Test ownerDocument for the element keygen in the template. Document has browsing context 
+PASS Test ownerDocument for the element label in the template. Document has browsing context 
+PASS Test ownerDocument for the element legend in the template. Document has browsing context 
+PASS Test ownerDocument for the element li in the template. Document has browsing context 
+PASS Test ownerDocument for the element link in the template. Document has browsing context 
+PASS Test ownerDocument for the element map in the template. Document has browsing context 
+PASS Test ownerDocument for the element mark in the template. Document has browsing context 
+PASS Test ownerDocument for the element menu in the template. Document has browsing context 
+PASS Test ownerDocument for the element meta in the template. Document has browsing context 
+PASS Test ownerDocument for the element meter in the template. Document has browsing context 
+PASS Test ownerDocument for the element nav in the template. Document has browsing context 
+PASS Test ownerDocument for the element noscript in the template. Document has browsing context 
+PASS Test ownerDocument for the element object in the template. Document has browsing context 
+PASS Test ownerDocument for the element ol in the template. Document has browsing context 
+PASS Test ownerDocument for the element optgroup in the template. Document has browsing context 
+PASS Test ownerDocument for the element option in the template. Document has browsing context 
+PASS Test ownerDocument for the element output in the template. Document has browsing context 
+PASS Test ownerDocument for the element p in the template. Document has browsing context 
+PASS Test ownerDocument for the element param in the template. Document has browsing context 
+PASS Test ownerDocument for the element pre in the template. Document has browsing context 
+PASS Test ownerDocument for the element progress in the template. Document has browsing context 
+PASS Test ownerDocument for the element q in the template. Document has browsing context 
+PASS Test ownerDocument for the element rp in the template. Document has browsing context 
+PASS Test ownerDocument for the element rt in the template. Document has browsing context 
+PASS Test ownerDocument for the element ruby in the template. Document has browsing context 
+PASS Test ownerDocument for the element s in the template. Document has browsing context 
+PASS Test ownerDocument for the element samp in the template. Document has browsing context 
+PASS Test ownerDocument for the element script in the template. Document has browsing context 
+PASS Test ownerDocument for the element section in the template. Document has browsing context 
+PASS Test ownerDocument for the element select in the template. Document has browsing context 
+PASS Test ownerDocument for the element small in the template. Document has browsing context 
+PASS Test ownerDocument for the element source in the template. Document has browsing context 
+PASS Test ownerDocument for the element span in the template. Document has browsing context 
+PASS Test ownerDocument for the element strong in the template. Document has browsing context 
+PASS Test ownerDocument for the element style in the template. Document has browsing context 
+PASS Test ownerDocument for the element sub in the template. Document has browsing context 
+PASS Test ownerDocument for the element table in the template. Document has browsing context 
+PASS Test ownerDocument for the element tbody in the template. Document has browsing context 
+PASS Test ownerDocument for the element td in the template. Document has browsing context 
+PASS Test ownerDocument for the element textarea in the template. Document has browsing context 
+PASS Test ownerDocument for the element tfoot in the template. Document has browsing context 
+PASS Test ownerDocument for the element th in the template. Document has browsing context 
+PASS Test ownerDocument for the element thead in the template. Document has browsing context 
+PASS Test ownerDocument for the element time in the template. Document has browsing context 
+PASS Test ownerDocument for the element title in the template. Document has browsing context 
+PASS Test ownerDocument for the element tr in the template. Document has browsing context 
+PASS Test ownerDocument for the element track in the template. Document has browsing context 
+PASS Test ownerDocument for the element u in the template. Document has browsing context 
+PASS Test ownerDocument for the element ul in the template. Document has browsing context 
+PASS Test ownerDocument for the element var in the template. Document has browsing context 
+PASS Test ownerDocument for the element video in the template. Document has browsing context 
+PASS Test ownerDocument for the element wbr in the template. Document has browsing context 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplatecreatinganelementforthetokentemplateownerdocumenthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,221 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;HTML Templates: ownerDocument property of the element in template&lt;/title&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Sergey G. Grekhov&quot; href=&quot;mailto:sgrekhov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;author&quot; title=&quot;Aleksei Yu. Semenov&quot; href=&quot;mailto:a.semenov@unipro.ru&quot;&gt;
+&lt;meta name=&quot;assert&quot; content=&quot;ownerDocument property of the element appended to template must be set to the template contents owner of the ownerDocument of the template element&quot;&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://www.w3.org/TR/2013/WD-html-templates-20130214/#creating-an-element-for-a-token&quot;&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharness.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../../../../../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;/html/resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+
+test(function () {
+    var doc = newHTMLDocument();
+    doc.body.innerHTML = '&lt;div&gt;&lt;template id=&quot;tmpl1&quot;&gt;&lt;div id=&quot;div&quot;&gt;DIV&lt;/div&gt;&lt;/template&gt;&lt;/div&gt;';
+
+    var template = doc.querySelector('#tmpl1');
+
+    var div = template.content.querySelector('#div');
+
+    assert_equals(div.ownerDocument, template.content.ownerDocument,
+            'Wrong ownerDocument of the element in template');
+
+}, 'Test ownerDocument property of the element in a template. '
+    + 'Current DOCUMENT has no browsing context. Test template element inside the div');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+    doc.body.innerHTML = '&lt;template id=&quot;tmpl1&quot;&gt;&lt;div id=&quot;div&quot;&gt;DIV&lt;/div&gt;&lt;/template&gt;';
+
+    var template = doc.querySelector('#tmpl1');
+
+    var div = template.content.querySelector('#div');
+
+    assert_equals(div.ownerDocument, template.content.ownerDocument,
+            'Wrong ownerDocument of the element in template');
+
+}, 'Test ownerDocument property of the element in a template. '
+    + 'Current DOCUMENT has no browsing context. Test template element '
+    + 'in the root of the body');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+    doc.head.innerHTML = '&lt;template id=&quot;tmpl1&quot;&gt;&lt;div id=&quot;div&quot;&gt;DIV&lt;/div&gt;&lt;/template&gt;';
+
+    var template = doc.querySelector('#tmpl1');
+
+    var div = template.content.querySelector('#div');
+
+    assert_equals(div.ownerDocument, template.content.ownerDocument,
+            'Wrong ownerDocument of the element in template');
+
+}, 'Test ownerDocument property of the element in a template. '
+    + 'Current DOCUMENT has no browsing context. Test template element '
+    + 'in the root of the head');
+
+
+
+test(function () {
+    var doc = newHTMLDocument();
+    doc.body.innerHTML = '&lt;template id=&quot;tmpl1&quot;&gt;'
+        + '&lt;template id=&quot;tmpl2&quot;&gt;&lt;div id=&quot;div&quot;&gt;DIV&lt;/div&gt;&lt;/template&gt;&lt;/template&gt;';
+
+    var template = doc.querySelector('#tmpl1');
+
+    var nestedTemplate = template.content.querySelector('#tmpl2');
+
+    assert_equals(nestedTemplate.ownerDocument, template.content.ownerDocument,
+            'Wrong nested template owner document');
+
+    var div = nestedTemplate.content.querySelector('#div');
+
+    assert_equals(div.ownerDocument, nestedTemplate.content.ownerDocument,
+            'Wrong div ownerDocument');
+
+}, 'Test ownerDocument property of the element in a nested template');
+
+
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/template-contents.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.querySelector('template');
+
+    var div = template.content.querySelector('div');
+
+    assert_equals(div.ownerDocument, template.content.ownerDocument,
+            'Wrong ownerDocument of the element in template');
+
+}, 'Test ownerDocument property of the element in a template. '
+   + 'Load HTML document from a file, current DOCUMENT has browsing context');
+
+
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/template-contents-nested.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template = doc.querySelector('template');
+
+    var nestedTemplate = template.content.querySelector('template');
+
+    assert_equals(nestedTemplate.ownerDocument, template.content.ownerDocument,
+            'Wrong nested template owner document');
+
+    var div = nestedTemplate.content.querySelector('div');
+
+    assert_equals(div.ownerDocument, nestedTemplate.content.ownerDocument,
+            'Wrong div ownerDocument');
+
+}, 'Test ownerDocument property of the element in a nested template. '
+    + 'Load HTML document from a file, current DOCUMENT has browsing context');
+
+
+
+testInIFrame('/html/semantics/scripting-1/the-template-element/resources/two-templates.html', function(context) {
+    var doc = context.iframes[0].contentDocument;
+
+    var template1 = doc.querySelector('#template1');
+    var div1 = template1.content.querySelector('div');
+    var template2 = doc.querySelector('#template2');
+    var div2 = template2.content.querySelector('div');
+
+    assert_equals(div1.ownerDocument, template1.content.ownerDocument,
+            'Wrong ownerDocument of the element in template');
+    assert_equals(div2.ownerDocument, template2.content.ownerDocument,
+            'Wrong ownerDocument of the element in template');
+    assert_equals(div1.ownerDocument, div2.ownerDocument,
+            'Different elements in the same document should share the same template contents owner');
+
+}, 'Test ownerDocument property of two elements in a template. '
+    + 'Load HTML document from a file, current DOCUMENT has browsing context');
+
+
+var parameters = [];
+
+HTML5_ELEMENTS.forEach(function(value) {
+    if (value !== 'body' &amp;&amp; value !== 'html' &amp;&amp; value !== 'head' &amp;&amp; value !== 'frameset') {
+
+        var doc = newHTMLDocument();
+
+        if (isVoidElement(value)) {
+            doc.body.innerHTML = '&lt;template&gt;&lt;' + value + '/&gt;&lt;/template&gt;';
+        } else {
+            doc.body.innerHTML = '&lt;template&gt;&lt;' + value + '&gt;&lt;/' + value + '&gt;&lt;/template&gt;';
+        }
+
+        var template = doc.querySelector('template');
+        var element = template.content.querySelector(value);
+
+        doc.body.appendChild(template);
+
+        parameters.push([
+                'Test ownerDocument for the element ' + value + ' in the template',
+                element,
+                template
+            ]);
+    }
+});
+
+function compare_owners(element, template) {
+    assert_equals(element.ownerDocument, template.content.ownerDocument)
+}
+
+generate_tests(compare_owners, parameters,
+        'Test ownerDocument property of all HTML5 elements in a template. '
+            + 'Current DOCUMENT has no browsing context.');
+
+var context = newContext();
+parameters = [];
+
+try {
+
+    HTML5_ELEMENTS.forEach(function(value) {
+
+        if (value !== 'body' &amp;&amp; value !== 'html' &amp;&amp; value !== 'head' &amp;&amp; value !== 'frameset') {
+
+            var doc = newRenderedHTMLDocument(context);
+
+            if (isVoidElement(value)) {
+                doc.body.innerHTML = '&lt;template&gt;&lt;' + value + '/&gt;&lt;/template&gt;';
+            } else {
+                doc.body.innerHTML = '&lt;template&gt;&lt;' + value + '&gt;&lt;/' + value + '&gt;&lt;/template&gt;';
+            }
+
+            var template = doc.querySelector('template');
+            var element = template.content.querySelector(value);
+
+            doc.body.appendChild(template);
+
+            parameters.push([
+                    'Test ownerDocument for the element ' + value + ' in the template. '
+                        + 'Document has browsing context',
+                    element,
+                    template
+                ]);
+        }
+    });
+    generate_tests(compare_owners, parameters,
+            'Test ownerDocument property of all HTML5 elements in a template. '
+                + 'Current DOCUMENT has browsing context.');
+
+} finally {
+    try {
+        cleanContext(context);
+    } catch (e) {
+        //do nothing
+    }
+}
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplatecreatinganelementforthetokenw3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/w3c-import.log (0 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/w3c-import.log                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/w3c-import.log        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the W3C CSS or WPT github:
+        https://github.com/w3c/csswg-test
+        https://github.com/w3c/web-platform-tests
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport.
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (200071 => 200072)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations        2016-04-26 04:08:22 UTC (rev 200071)
+++ trunk/LayoutTests/platform/mac/TestExpectations        2016-04-26 04:22:58 UTC (rev 200072)
</span><span class="lines">@@ -1271,7 +1271,7 @@
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/140217 http/tests/navigation/forward-and-cancel.html [ Pass Failure ]
</span><span class="cx"> 
</span><del>-webkit.org/b/151469 imported/w3c/html-templates/parsing-html-templates/creating-an-element-for-the-token/template-owner-document.html [ Pass Crash ]
</del><ins>+webkit.org/b/151469 imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html [ Pass Crash ]
</ins><span class="cx"> 
</span><span class="cx"> webkit.org/b/152009 [ Debug ElCapitan ] fast/canvas/canvas-too-large-to-draw.html [ Skip ]
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>