<!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>[189537] trunk</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/189537">189537</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-09-09 01:49:19 -0700 (Wed, 09 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>HTMLTableElement.tHead / tFoot / caption should be nullable
https://bugs.webkit.org/show_bug.cgi?id=148991

Reviewed by Ryosuke Niwa.

Source/WebCore:

According to the specification, HTMLTableElement.tHead / tFoot / caption
should be nullable:
https://html.spec.whatwg.org/multipage/tables.html#htmltableelement

Upon assigning null, we are supposed to remove the existing tHead / tFoot
/ caption element. However, we had a bug causing us to throw an exception
after removing the element. This is because we would try to insert a null
element and ContainerNode::insertBefore() throws when doing so.

Also, as per the specification, setting tHead / tFoot to something else
than a thead / tfoot element should throw a HierarchyRequestError:
https://html.spec.whatwg.org/multipage/tables.html#dom-table-thead
https://html.spec.whatwg.org/multipage/tables.html#dom-table-tfoot

Previously, WebKit did not check the tag and was happy inserting the
element as long as it was an HTMLTableSectionElement. This means that
you could set a tfoot by assigning table.tHead.

This patch corrects both bugs and adds test coverage for it.

Test: fast/dom/HTMLTableElement/nullable-attributes.html

* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::setCaption):
Only call insertBefore() if newCaption is not null as insertBefore()
will throw an exception otherwise.

(WebCore::HTMLTableElement::setTHead):
- Throw a HierarchyRequestError if the HTMLTableSectionElement is not
  null or a &lt;thead&gt; element, as per the specification.
- Only call insertBefore() if newHead is not null as insertBefore()
  will throw an exception otherwise.

(WebCore::HTMLTableElement::setTFoot):
- Throw a HierarchyRequestError if the HTMLTableSectionElement is not
  null or a &lt;tfoot&gt; element, as per the specification.
- Only call insertBefore() if newFoot is not null as insertBefore()
  will throw an exception otherwise.

* html/HTMLTableElement.idl:
Use [StrictTypeChecking] for these 3 attributes so that the bindings
will throw a TypeError if the JS tries to assign a value with the
wrong type. When the implementation is called with null, we now know
this is because the JS assigned null (and not an invalid value).
This is important as assigning null is valid since those attributes
are nullable.

LayoutTests:

Add new test that covers the behavior of the following HTMLTableElement
attributes: caption / tHead / tFoot.

* fast/dom/HTMLTableElement/nullable-attributes-expected.txt: Added.
* fast/dom/HTMLTableElement/nullable-attributes.html: Added.
* fast/dom/setter-type-enforcement-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomsettertypeenforcementexpectedtxt">trunk/LayoutTests/fast/dom/setter-type-enforcement-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTableElementcpp">trunk/Source/WebCore/html/HTMLTableElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTableElementidl">trunk/Source/WebCore/html/HTMLTableElement.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomHTMLTableElementnullableattributesexpectedtxt">trunk/LayoutTests/fast/dom/HTMLTableElement/nullable-attributes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLTableElementnullableattributeshtml">trunk/LayoutTests/fast/dom/HTMLTableElement/nullable-attributes.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (189536 => 189537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-09 07:37:14 UTC (rev 189536)
+++ trunk/LayoutTests/ChangeLog        2015-09-09 08:49:19 UTC (rev 189537)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-09-09  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        HTMLTableElement.tHead / tFoot / caption should be nullable
+        https://bugs.webkit.org/show_bug.cgi?id=148991
+
+        Reviewed by Ryosuke Niwa.
+
+        Add new test that covers the behavior of the following HTMLTableElement
+        attributes: caption / tHead / tFoot.
+
+        * fast/dom/HTMLTableElement/nullable-attributes-expected.txt: Added.
+        * fast/dom/HTMLTableElement/nullable-attributes.html: Added.
+        * fast/dom/setter-type-enforcement-expected.txt:
+
</ins><span class="cx"> 2015-06-26  Sergio Villar Senin  &lt;svillar@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         min-width/height should default to auto for flexbox items
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLTableElementnullableattributesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLTableElement/nullable-attributes-expected.txt (0 => 189537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLTableElement/nullable-attributes-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLTableElement/nullable-attributes-expected.txt        2015-09-09 08:49:19 UTC (rev 189537)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+Tests that HTMLTableElement.caption / tHead / tFoot are nullable and behave according to specification.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS table.__proto__ is HTMLTableElement.prototype
+PASS caption.__proto__ is HTMLTableCaptionElement.prototype
+PASS thead.__proto__ is HTMLTableSectionElement.prototype
+PASS tfoot.__proto__ is HTMLTableSectionElement.prototype
+
+* HTMLTableElement.caption
+PASS table.caption is null
+table.caption = caption
+PASS table.caption is caption
+PASS table.caption = document.body threw exception TypeError: The HTMLTableElement.caption attribute must be an instance of HTMLTableCaptionElement.
+PASS table.caption is caption
+table.caption = null
+PASS table.caption is null
+table.caption = caption
+PASS table.caption is caption
+table.caption = undefined
+PASS table.caption is null
+
+* HTMLTableElement.tHead
+PASS table.tHead is null
+table.tHead = thead
+PASS table.tHead is thead
+PASS table.tHead = document.body threw exception TypeError: The HTMLTableElement.tHead attribute must be an instance of HTMLTableSectionElement.
+PASS table.tHead is thead
+PASS table.tHead = tfoot threw exception Error: HierarchyRequestError: DOM Exception 3.
+PASS table.tHead is thead
+table.tHead = null
+PASS table.tHead is null
+table.tHead = thead
+PASS table.tHead is thead
+table.tHead = undefined
+PASS table.tHead is null
+
+* HTMLTableElement.tFoot
+PASS table.tFoot is null
+table.tFoot = tfoot
+PASS table.tFoot is tfoot
+PASS table.tFoot = document.body threw exception TypeError: The HTMLTableElement.tFoot attribute must be an instance of HTMLTableSectionElement.
+PASS table.tFoot is tfoot
+PASS table.tFoot = thead threw exception Error: HierarchyRequestError: DOM Exception 3.
+PASS table.tFoot is tfoot
+table.tFoot = null
+PASS table.tFoot is null
+table.tFoot = tfoot
+PASS table.tFoot is tfoot
+table.tFoot = undefined
+PASS table.tFoot is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLTableElementnullableattributeshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLTableElement/nullable-attributes.html (0 => 189537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLTableElement/nullable-attributes.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLTableElement/nullable-attributes.html        2015-09-09 08:49:19 UTC (rev 189537)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+description(&quot;Tests that HTMLTableElement.caption / tHead / tFoot are nullable and behave according to specification.&quot;);
+
+var table = document.createElement(&quot;table&quot;);
+shouldBe(&quot;table.__proto__&quot;, &quot;HTMLTableElement.prototype&quot;);
+var caption = document.createElement(&quot;caption&quot;);
+shouldBe(&quot;caption.__proto__&quot;, &quot;HTMLTableCaptionElement.prototype&quot;);
+var thead = document.createElement(&quot;thead&quot;);
+shouldBe(&quot;thead.__proto__&quot;, &quot;HTMLTableSectionElement.prototype&quot;);
+var tfoot = document.createElement(&quot;tFoot&quot;);
+shouldBe(&quot;tfoot.__proto__&quot;, &quot;HTMLTableSectionElement.prototype&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;* HTMLTableElement.caption&quot;);
+shouldBeNull(&quot;table.caption&quot;);
+evalAndLog(&quot;table.caption = caption&quot;);
+shouldBe(&quot;table.caption&quot;, &quot;caption&quot;);
+shouldThrow(&quot;table.caption = document.body&quot;, &quot;'TypeError: The HTMLTableElement.caption attribute must be an instance of HTMLTableCaptionElement'&quot;);
+shouldBe(&quot;table.caption&quot;, &quot;caption&quot;);
+evalAndLog(&quot;table.caption = null&quot;);
+shouldBeNull(&quot;table.caption&quot;);
+evalAndLog(&quot;table.caption = caption&quot;);
+shouldBe(&quot;table.caption&quot;, &quot;caption&quot;);
+evalAndLog(&quot;table.caption = undefined&quot;); // undefined is converted to null for nullable attributes.
+shouldBeNull(&quot;table.caption&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;* HTMLTableElement.tHead&quot;);
+shouldBeNull(&quot;table.tHead&quot;);
+evalAndLog(&quot;table.tHead = thead&quot;);
+shouldBe(&quot;table.tHead&quot;, &quot;thead&quot;);
+shouldThrow(&quot;table.tHead = document.body&quot;, &quot;'TypeError: The HTMLTableElement.tHead attribute must be an instance of HTMLTableSectionElement'&quot;);
+shouldBe(&quot;table.tHead&quot;, &quot;thead&quot;);
+shouldThrow(&quot;table.tHead = tfoot&quot;, &quot;'Error: HierarchyRequestError: DOM Exception 3'&quot;);
+shouldBe(&quot;table.tHead&quot;, &quot;thead&quot;);
+evalAndLog(&quot;table.tHead = null&quot;);
+shouldBeNull(&quot;table.tHead&quot;);
+evalAndLog(&quot;table.tHead = thead&quot;);
+shouldBe(&quot;table.tHead&quot;, &quot;thead&quot;);
+evalAndLog(&quot;table.tHead = undefined&quot;); // undefined is converted to null for nullable attributes.
+shouldBeNull(&quot;table.tHead&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;* HTMLTableElement.tFoot&quot;);
+shouldBeNull(&quot;table.tFoot&quot;);
+evalAndLog(&quot;table.tFoot = tfoot&quot;);
+shouldBe(&quot;table.tFoot&quot;, &quot;tfoot&quot;);
+shouldThrow(&quot;table.tFoot = document.body&quot;, &quot;'TypeError: The HTMLTableElement.tFoot attribute must be an instance of HTMLTableSectionElement'&quot;);
+shouldBe(&quot;table.tFoot&quot;, &quot;tfoot&quot;);
+shouldThrow(&quot;table.tFoot = thead&quot;, &quot;'Error: HierarchyRequestError: DOM Exception 3'&quot;);
+shouldBe(&quot;table.tFoot&quot;, &quot;tfoot&quot;);
+evalAndLog(&quot;table.tFoot = null&quot;);
+shouldBeNull(&quot;table.tFoot&quot;);
+evalAndLog(&quot;table.tFoot = tfoot&quot;);
+shouldBe(&quot;table.tFoot&quot;, &quot;tfoot&quot;);
+evalAndLog(&quot;table.tFoot = undefined&quot;); // undefined is converted to null for nullable attributes.
+shouldBeNull(&quot;table.tFoot&quot;);
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomsettertypeenforcementexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/setter-type-enforcement-expected.txt (189536 => 189537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/setter-type-enforcement-expected.txt        2015-09-09 07:37:14 UTC (rev 189536)
+++ trunk/LayoutTests/fast/dom/setter-type-enforcement-expected.txt        2015-09-09 08:49:19 UTC (rev 189537)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> PASS document.body = nodelist; threw exception Error: HierarchyRequestError: DOM Exception 3.
</span><del>-PASS table.tHead = nodelist; threw exception Error: NotFoundError: DOM Exception 8.
</del><ins>+PASS table.tHead = nodelist; threw exception TypeError: The HTMLTableElement.tHead attribute must be an instance of HTMLTableSectionElement.
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (189536 => 189537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-09-09 07:37:14 UTC (rev 189536)
+++ trunk/Source/WebCore/ChangeLog        2015-09-09 08:49:19 UTC (rev 189537)
</span><span class="lines">@@ -1,3 +1,57 @@
</span><ins>+2015-09-09  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        HTMLTableElement.tHead / tFoot / caption should be nullable
+        https://bugs.webkit.org/show_bug.cgi?id=148991
+
+        Reviewed by Ryosuke Niwa.
+
+        According to the specification, HTMLTableElement.tHead / tFoot / caption
+        should be nullable:
+        https://html.spec.whatwg.org/multipage/tables.html#htmltableelement
+
+        Upon assigning null, we are supposed to remove the existing tHead / tFoot
+        / caption element. However, we had a bug causing us to throw an exception
+        after removing the element. This is because we would try to insert a null
+        element and ContainerNode::insertBefore() throws when doing so.
+
+        Also, as per the specification, setting tHead / tFoot to something else
+        than a thead / tfoot element should throw a HierarchyRequestError:
+        https://html.spec.whatwg.org/multipage/tables.html#dom-table-thead
+        https://html.spec.whatwg.org/multipage/tables.html#dom-table-tfoot
+
+        Previously, WebKit did not check the tag and was happy inserting the
+        element as long as it was an HTMLTableSectionElement. This means that
+        you could set a tfoot by assigning table.tHead.
+
+        This patch corrects both bugs and adds test coverage for it.
+
+        Test: fast/dom/HTMLTableElement/nullable-attributes.html
+
+        * html/HTMLTableElement.cpp:
+        (WebCore::HTMLTableElement::setCaption):
+        Only call insertBefore() if newCaption is not null as insertBefore()
+        will throw an exception otherwise.
+
+        (WebCore::HTMLTableElement::setTHead):
+        - Throw a HierarchyRequestError if the HTMLTableSectionElement is not
+          null or a &lt;thead&gt; element, as per the specification.
+        - Only call insertBefore() if newHead is not null as insertBefore()
+          will throw an exception otherwise.
+
+        (WebCore::HTMLTableElement::setTFoot):
+        - Throw a HierarchyRequestError if the HTMLTableSectionElement is not
+          null or a &lt;tfoot&gt; element, as per the specification.
+        - Only call insertBefore() if newFoot is not null as insertBefore()
+          will throw an exception otherwise.
+
+        * html/HTMLTableElement.idl:
+        Use [StrictTypeChecking] for these 3 attributes so that the bindings
+        will throw a TypeError if the JS tries to assign a value with the
+        wrong type. When the implementation is called with null, we now know
+        this is because the JS assigned null (and not an invalid value).
+        This is important as assigning null is valid since those attributes
+        are nullable.
+
</ins><span class="cx"> 2015-06-26  Sergio Villar Senin  &lt;svillar@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         min-width/height should default to auto for flexbox items
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTableElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTableElement.cpp (189536 => 189537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTableElement.cpp        2015-09-09 07:37:14 UTC (rev 189536)
+++ trunk/Source/WebCore/html/HTMLTableElement.cpp        2015-09-09 08:49:19 UTC (rev 189537)
</span><span class="lines">@@ -80,7 +80,8 @@
</span><span class="cx"> void HTMLTableElement::setCaption(PassRefPtr&lt;HTMLTableCaptionElement&gt; newCaption, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><span class="cx">     deleteCaption();
</span><del>-    insertBefore(newCaption, firstChild(), ec);
</del><ins>+    if (newCaption)
+        insertBefore(newCaption, firstChild(), ec);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> HTMLTableSectionElement* HTMLTableElement::tHead() const
</span><span class="lines">@@ -94,8 +95,16 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLTableElement::setTHead(PassRefPtr&lt;HTMLTableSectionElement&gt; newHead, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><ins>+    if (newHead &amp;&amp; !newHead-&gt;hasTagName(theadTag)) {
+        ec = HIERARCHY_REQUEST_ERR;
+        return;
+    }
+
</ins><span class="cx">     deleteTHead();
</span><span class="cx"> 
</span><ins>+    if (!newHead)
+        return;
+
</ins><span class="cx">     Node* child;
</span><span class="cx">     for (child = firstChild(); child; child = child-&gt;nextSibling())
</span><span class="cx">         if (child-&gt;isElementNode() &amp;&amp; !child-&gt;hasTagName(captionTag) &amp;&amp; !child-&gt;hasTagName(colgroupTag))
</span><span class="lines">@@ -115,8 +124,16 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLTableElement::setTFoot(PassRefPtr&lt;HTMLTableSectionElement&gt; newFoot, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><ins>+    if (newFoot &amp;&amp; !newFoot-&gt;hasTagName(tfootTag)) {
+        ec = HIERARCHY_REQUEST_ERR;
+        return;
+    }
+
</ins><span class="cx">     deleteTFoot();
</span><span class="cx"> 
</span><ins>+    if (!newFoot)
+        return;
+
</ins><span class="cx">     Node* child;
</span><span class="cx">     for (child = firstChild(); child; child = child-&gt;nextSibling())
</span><span class="cx">         if (child-&gt;isElementNode() &amp;&amp; !child-&gt;hasTagName(captionTag) &amp;&amp; !child-&gt;hasTagName(colgroupTag) &amp;&amp; !child-&gt;hasTagName(theadTag))
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTableElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTableElement.idl (189536 => 189537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTableElement.idl        2015-09-09 07:37:14 UTC (rev 189536)
+++ trunk/Source/WebCore/html/HTMLTableElement.idl        2015-09-09 08:49:19 UTC (rev 189537)
</span><span class="lines">@@ -19,9 +19,9 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> interface HTMLTableElement : HTMLElement {
</span><del>-    [SetterRaisesException] attribute HTMLTableCaptionElement caption;
-    [SetterRaisesException] attribute HTMLTableSectionElement tHead;
-    [SetterRaisesException] attribute HTMLTableSectionElement tFoot;
</del><ins>+    [SetterRaisesException, StrictTypeChecking] attribute HTMLTableCaptionElement caption;
+    [SetterRaisesException, StrictTypeChecking] attribute HTMLTableSectionElement tHead;
+    [SetterRaisesException, StrictTypeChecking] attribute HTMLTableSectionElement tFoot;
</ins><span class="cx"> 
</span><span class="cx">     readonly attribute HTMLCollection rows;
</span><span class="cx">     readonly attribute HTMLCollection tBodies;
</span></span></pre>
</div>
</div>

</body>
</html>