<!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>[203394] 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/203394">203394</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-07-18 21:45:53 -0700 (Mon, 18 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>input.formEnctype / formMethod and button.formEnctype / formMethod / type should treat null as &quot;null&quot;
https://bugs.webkit.org/show_bug.cgi?id=159908

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline now that more checks are passing.

* web-platform-tests/html/dom/reflection-forms-expected.txt:

Source/WebCore:

input.formEnctype / formMethod and button.formEnctype / formMethod / type
should treat null as &quot;null&quot; String:
- https://html.spec.whatwg.org/multipage/forms.html#htmlinputelement
- https://html.spec.whatwg.org/multipage/forms.html#htmlbuttonelement

In WebKit, we would treat null as a null String which would end up
removing the corresponding attribute. This does not match the
specification. Firefox and Chrome match the specification here.

Tests:
- fast/dom/HTMLButtonElement/null-handling.html
- fast/dom/HTMLInputElement/null-handling.html

* html/HTMLButtonElement.idl:
* html/HTMLInputElement.idl:

LayoutTests:

Add layout test coverage.

* fast/dom/HTMLButtonElement/change-type-expected.txt:
* fast/dom/HTMLButtonElement/change-type.html:
* fast/dom/HTMLButtonElement/null-handling-expected.txt: Added.
* fast/dom/HTMLButtonElement/null-handling.html: Added.
* fast/dom/HTMLInputElement/null-handling-expected.txt: Added.
* fast/dom/HTMLInputElement/null-handling.html: Added.
* fast/forms/submit-form-attributes-expected.txt:
* fast/forms/submit-form-attributes.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLButtonElementchangetypeexpectedtxt">trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLButtonElementchangetypehtml">trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type.html</a></li>
<li><a href="#trunkLayoutTestsfastformssubmitformattributesexpectedtxt">trunk/LayoutTests/fast/forms/submit-form-attributes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformssubmitformattributeshtml">trunk/LayoutTests/fast/forms/submit-form-attributes.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmldomreflectionformsexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorimportedw3cwebplatformtestshtmldomreflectionformsexpectedtxt">trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLButtonElementidl">trunk/Source/WebCore/html/HTMLButtonElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLInputElementidl">trunk/Source/WebCore/html/HTMLInputElement.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomHTMLButtonElementnullhandlingexpectedtxt">trunk/LayoutTests/fast/dom/HTMLButtonElement/null-handling-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLButtonElementnullhandlinghtml">trunk/LayoutTests/fast/dom/HTMLButtonElement/null-handling.html</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLInputElementnullhandlingexpectedtxt">trunk/LayoutTests/fast/dom/HTMLInputElement/null-handling-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLInputElementnullhandlinghtml">trunk/LayoutTests/fast/dom/HTMLInputElement/null-handling.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (203393 => 203394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/ChangeLog        2016-07-19 04:45:53 UTC (rev 203394)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2016-07-18  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        input.formEnctype / formMethod and button.formEnctype / formMethod / type should treat null as &quot;null&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=159908
+
+        Reviewed by Alex Christensen.
+
+        Add layout test coverage.
+
+        * fast/dom/HTMLButtonElement/change-type-expected.txt:
+        * fast/dom/HTMLButtonElement/change-type.html:
+        * fast/dom/HTMLButtonElement/null-handling-expected.txt: Added.
+        * fast/dom/HTMLButtonElement/null-handling.html: Added.
+        * fast/dom/HTMLInputElement/null-handling-expected.txt: Added.
+        * fast/dom/HTMLInputElement/null-handling.html: Added.
+        * fast/forms/submit-form-attributes-expected.txt:
+        * fast/forms/submit-form-attributes.html:
+
</ins><span class="cx"> 2016-07-18  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Make builtin TypeErrors consistent
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLButtonElementchangetypeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type-expected.txt (203393 => 203394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type-expected.txt        2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type-expected.txt        2016-07-19 04:45:53 UTC (rev 203394)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx"> PASS btn.type = ' b u t t o n '; btn.type is 'submit'
</span><span class="cx"> PASS btn.getAttribute('type') is ' b u t t o n '
</span><span class="cx"> PASS btn.type = null; btn.type is 'submit'
</span><del>-PASS btn.getAttribute('type') is null
</del><ins>+PASS btn.getAttribute('type') is &quot;null&quot;
</ins><span class="cx"> PASS btn.type = undefined; btn.type is 'submit'
</span><span class="cx"> PASS btn.getAttribute('type') is 'undefined'
</span><span class="cx"> PASS btn.type = 'reset'; txt.value = 'hello'; btn.click(); txt.value is ''
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLButtonElementchangetypehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type.html (203393 => 203394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type.html        2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type.html        2016-07-19 04:45:53 UTC (rev 203394)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">     shouldBe(&quot;btn.getAttribute('type')&quot;, &quot;' b u t t o n '&quot;);
</span><span class="cx">     
</span><span class="cx">     shouldBe(&quot;btn.type = null; btn.type&quot;, &quot;'submit'&quot;);
</span><del>-    shouldBe(&quot;btn.getAttribute('type')&quot;, &quot;null&quot;);
</del><ins>+    shouldBeEqualToString(&quot;btn.getAttribute('type')&quot;, &quot;null&quot;);
</ins><span class="cx">     
</span><span class="cx">     shouldBe(&quot;btn.type = undefined; btn.type&quot;, &quot;'submit'&quot;);
</span><span class="cx">     shouldBe(&quot;btn.getAttribute('type')&quot;, &quot;'undefined'&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLButtonElementnullhandlingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLButtonElement/null-handling-expected.txt (0 => 203394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLButtonElement/null-handling-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLButtonElement/null-handling-expected.txt        2016-07-19 04:45:53 UTC (rev 203394)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+Tests null handling of several HTMLButtonElement attributes
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS button.getAttribute('formMethod') is null
+PASS button.getAttribute('formEnctype') is null
+PASS button.getAttribute('type') is null
+button.formMethod = null
+PASS button.getAttribute('formMethod') is &quot;null&quot;
+button.formEnctype = null
+PASS button.getAttribute('formEnctype') is &quot;null&quot;
+button.type = null
+PASS button.getAttribute('type') is &quot;null&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLButtonElementnullhandlinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLButtonElement/null-handling.html (0 => 203394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLButtonElement/null-handling.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLButtonElement/null-handling.html        2016-07-19 04:45:53 UTC (rev 203394)
</span><span class="lines">@@ -0,0 +1,21 @@
</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 null handling of several HTMLButtonElement attributes&quot;);
+
+var button = document.createElement(&quot;button&quot;);
+shouldBeNull(&quot;button.getAttribute('formMethod')&quot;, &quot;&quot;);
+shouldBeNull(&quot;button.getAttribute('formEnctype')&quot;, &quot;&quot;);
+shouldBeNull(&quot;button.getAttribute('type')&quot;, &quot;&quot;);
+evalAndLog(&quot;button.formMethod = null&quot;);
+shouldBeEqualToString(&quot;button.getAttribute('formMethod')&quot;, &quot;null&quot;);
+evalAndLog(&quot;button.formEnctype = null&quot;);
+shouldBeEqualToString(&quot;button.getAttribute('formEnctype')&quot;, &quot;null&quot;);
+evalAndLog(&quot;button.type = null&quot;);
+shouldBeEqualToString(&quot;button.getAttribute('type')&quot;, &quot;null&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="trunkLayoutTestsfastdomHTMLInputElementnullhandlingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLInputElement/null-handling-expected.txt (0 => 203394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLInputElement/null-handling-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLInputElement/null-handling-expected.txt        2016-07-19 04:45:53 UTC (rev 203394)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Tests null handling of several HTMLInputElement attributes
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS input.getAttribute('formMethod') is null
+PASS input.getAttribute('formEnctype') is null
+input.formMethod = null
+PASS input.getAttribute('formMethod') is &quot;null&quot;
+input.formEnctype = null
+PASS input.getAttribute('formEnctype') is &quot;null&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLInputElementnullhandlinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLInputElement/null-handling.html (0 => 203394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLInputElement/null-handling.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLInputElement/null-handling.html        2016-07-19 04:45:53 UTC (rev 203394)
</span><span class="lines">@@ -0,0 +1,18 @@
</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 null handling of several HTMLInputElement attributes&quot;);
+
+var input = document.createElement(&quot;input&quot;);
+shouldBeNull(&quot;input.getAttribute('formMethod')&quot;, &quot;&quot;);
+shouldBeNull(&quot;input.getAttribute('formEnctype')&quot;, &quot;&quot;);
+evalAndLog(&quot;input.formMethod = null&quot;);
+shouldBeEqualToString(&quot;input.getAttribute('formMethod')&quot;, &quot;null&quot;);
+evalAndLog(&quot;input.formEnctype = null&quot;);
+shouldBeEqualToString(&quot;input.getAttribute('formEnctype')&quot;, &quot;null&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="trunkLayoutTestsfastformssubmitformattributesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/submit-form-attributes-expected.txt (203393 => 203394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/submit-form-attributes-expected.txt        2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/fast/forms/submit-form-attributes-expected.txt        2016-07-19 04:45:53 UTC (rev 203394)
</span><span class="lines">@@ -26,12 +26,12 @@
</span><span class="cx"> PASS input.formTarget is &quot;nta&quot;
</span><span class="cx"> 
</span><span class="cx"> Setting null for input:
</span><del>-PASS input.formEnctype is &quot;&quot;
-PASS input.getAttribute(&quot;formEnctype&quot;) is null
</del><span class="cx"> PASS input.formEnctype is &quot;application/x-www-form-urlencoded&quot;
</span><del>-PASS input.formMethod is &quot;&quot;
-PASS input.getAttribute(&quot;formMethod&quot;) is null
</del><ins>+PASS input.getAttribute(&quot;formEnctype&quot;) is &quot;null&quot;
+PASS input.formEnctype is &quot;application/x-www-form-urlencoded&quot;
</ins><span class="cx"> PASS input.formMethod is &quot;get&quot;
</span><ins>+PASS input.getAttribute(&quot;formMethod&quot;) is &quot;null&quot;
+PASS input.formMethod is &quot;get&quot;
</ins><span class="cx"> PASS input.formTarget is &quot;null&quot;
</span><span class="cx"> PASS input.getAttribute(&quot;formTarget&quot;) is &quot;null&quot;
</span><span class="cx"> PASS input.formTarget is &quot;null&quot;
</span><span class="lines">@@ -81,12 +81,12 @@
</span><span class="cx"> PASS button.formTarget is &quot;nota&quot;
</span><span class="cx"> 
</span><span class="cx"> Setting null for button:
</span><del>-PASS button.formEnctype is &quot;&quot;
-PASS button.getAttribute(&quot;formEnctype&quot;) is null
</del><span class="cx"> PASS button.formEnctype is &quot;application/x-www-form-urlencoded&quot;
</span><del>-PASS button.formMethod is &quot;&quot;
-PASS button.getAttribute(&quot;formMethod&quot;) is null
</del><ins>+PASS button.getAttribute(&quot;formEnctype&quot;) is &quot;null&quot;
+PASS button.formEnctype is &quot;application/x-www-form-urlencoded&quot;
</ins><span class="cx"> PASS button.formMethod is &quot;get&quot;
</span><ins>+PASS button.getAttribute(&quot;formMethod&quot;) is &quot;null&quot;
+PASS button.formMethod is &quot;get&quot;
</ins><span class="cx"> PASS button.formTarget is &quot;null&quot;
</span><span class="cx"> PASS button.getAttribute(&quot;formTarget&quot;) is &quot;null&quot;
</span><span class="cx"> PASS button.formTarget is &quot;null&quot;
</span></span></pre></div>
<a id="trunkLayoutTestsfastformssubmitformattributeshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/submit-form-attributes.html (203393 => 203394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/submit-form-attributes.html        2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/fast/forms/submit-form-attributes.html        2016-07-19 04:45:53 UTC (rev 203394)
</span><span class="lines">@@ -55,13 +55,13 @@
</span><span class="cx"> debug('');
</span><span class="cx"> debug('Setting null for input:');
</span><span class="cx"> input.formEnctype = null;
</span><del>-shouldBeEqualToString('input.formEnctype', '');
-shouldBe('input.getAttribute(&quot;formEnctype&quot;)', 'null');
</del><ins>+shouldBeEqualToString('input.formEnctype', 'application/x-www-form-urlencoded');
+shouldBeEqualToString('input.getAttribute(&quot;formEnctype&quot;)', 'null');
</ins><span class="cx"> input.setAttribute('formEnctype', null);
</span><span class="cx"> shouldBeEqualToString('input.formEnctype', 'application/x-www-form-urlencoded');
</span><span class="cx"> input.formMethod = null;
</span><del>-shouldBeEqualToString('input.formMethod', '');
-shouldBe('input.getAttribute(&quot;formMethod&quot;)', 'null');
</del><ins>+shouldBeEqualToString('input.formMethod', 'get');
+shouldBeEqualToString('input.getAttribute(&quot;formMethod&quot;)', 'null');
</ins><span class="cx"> input.setAttribute('formMethod', null);
</span><span class="cx"> shouldBeEqualToString('input.formMethod', 'get');
</span><span class="cx"> input.formTarget = null;
</span><span class="lines">@@ -152,13 +152,13 @@
</span><span class="cx"> debug('');
</span><span class="cx"> debug('Setting null for button:');
</span><span class="cx"> button.formEnctype = null;
</span><del>-shouldBeEqualToString('button.formEnctype', '');
-shouldBe('button.getAttribute(&quot;formEnctype&quot;)', 'null');
</del><ins>+shouldBeEqualToString('button.formEnctype', 'application/x-www-form-urlencoded');
+shouldBeEqualToString('button.getAttribute(&quot;formEnctype&quot;)', 'null');
</ins><span class="cx"> button.setAttribute('formEnctype', null);
</span><span class="cx"> shouldBeEqualToString('button.formEnctype', 'application/x-www-form-urlencoded');
</span><span class="cx"> button.formMethod = null;
</span><del>-shouldBeEqualToString('button.formMethod', '');
-shouldBe('button.getAttribute(&quot;formMethod&quot;)', 'null');
</del><ins>+shouldBeEqualToString('button.formMethod', 'get');
+shouldBeEqualToString('button.getAttribute(&quot;formMethod&quot;)', 'null');
</ins><span class="cx"> button.setAttribute('formMethod', null);
</span><span class="cx"> shouldBeEqualToString('button.formMethod', 'get');
</span><span class="cx"> button.formTarget = null;
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (203393 => 203394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-07-19 04:45:53 UTC (rev 203394)
</span><span class="lines">@@ -1,5 +1,16 @@
</span><span class="cx"> 2016-07-18  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        input.formEnctype / formMethod and button.formEnctype / formMethod / type should treat null as &quot;null&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=159908
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline now that more checks are passing.
+
+        * web-platform-tests/html/dom/reflection-forms-expected.txt:
+
+2016-07-18  Chris Dumez  &lt;cdumez@apple.com&gt;
+
</ins><span class="cx">         DocType's publicId / systemId should not be nullable
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=159901
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmldomreflectionformsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt (203393 => 203394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt        2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt        2016-07-19 04:45:53 UTC (rev 203394)
</span><span class="lines">@@ -4724,7 +4724,7 @@
</span><span class="cx"> PASS input.formEnctype: IDL set to &quot;\0&quot; followed by getAttribute() 
</span><span class="cx"> PASS input.formEnctype: IDL set to &quot;\0&quot; followed by IDL get 
</span><span class="cx"> PASS input.formEnctype: IDL set to null should not throw 
</span><del>-FAIL input.formEnctype: IDL set to null followed by IDL get assert_equals: expected &quot;application/x-www-form-urlencoded&quot; but got &quot;&quot;
</del><ins>+PASS input.formEnctype: IDL set to null followed by IDL get 
</ins><span class="cx"> PASS input.formEnctype: IDL set to object &quot;test-toString&quot; should not throw 
</span><span class="cx"> PASS input.formEnctype: IDL set to object &quot;test-toString&quot; followed by getAttribute() 
</span><span class="cx"> PASS input.formEnctype: IDL set to object &quot;test-toString&quot; followed by IDL get 
</span><span class="lines">@@ -4865,7 +4865,7 @@
</span><span class="cx"> PASS input.formMethod: IDL set to &quot;\0&quot; followed by getAttribute() 
</span><span class="cx"> PASS input.formMethod: IDL set to &quot;\0&quot; followed by IDL get 
</span><span class="cx"> PASS input.formMethod: IDL set to null should not throw 
</span><del>-FAIL input.formMethod: IDL set to null followed by IDL get assert_equals: expected &quot;get&quot; but got &quot;&quot;
</del><ins>+PASS input.formMethod: IDL set to null followed by IDL get 
</ins><span class="cx"> PASS input.formMethod: IDL set to object &quot;test-toString&quot; should not throw 
</span><span class="cx"> PASS input.formMethod: IDL set to object &quot;test-toString&quot; followed by getAttribute() 
</span><span class="cx"> PASS input.formMethod: IDL set to object &quot;test-toString&quot; followed by IDL get 
</span><span class="lines">@@ -8169,7 +8169,7 @@
</span><span class="cx"> PASS button.formEnctype: IDL set to &quot;\0&quot; followed by getAttribute() 
</span><span class="cx"> PASS button.formEnctype: IDL set to &quot;\0&quot; followed by IDL get 
</span><span class="cx"> PASS button.formEnctype: IDL set to null should not throw 
</span><del>-FAIL button.formEnctype: IDL set to null followed by IDL get assert_equals: expected &quot;application/x-www-form-urlencoded&quot; but got &quot;&quot;
</del><ins>+PASS button.formEnctype: IDL set to null followed by IDL get 
</ins><span class="cx"> PASS button.formEnctype: IDL set to object &quot;test-toString&quot; should not throw 
</span><span class="cx"> PASS button.formEnctype: IDL set to object &quot;test-toString&quot; followed by getAttribute() 
</span><span class="cx"> PASS button.formEnctype: IDL set to object &quot;test-toString&quot; followed by IDL get 
</span><span class="lines">@@ -8320,7 +8320,7 @@
</span><span class="cx"> PASS button.formMethod: IDL set to &quot;\0&quot; followed by getAttribute() 
</span><span class="cx"> PASS button.formMethod: IDL set to &quot;\0&quot; followed by IDL get 
</span><span class="cx"> PASS button.formMethod: IDL set to null should not throw 
</span><del>-FAIL button.formMethod: IDL set to null followed by IDL get assert_equals: expected &quot;get&quot; but got &quot;&quot;
</del><ins>+PASS button.formMethod: IDL set to null followed by IDL get 
</ins><span class="cx"> PASS button.formMethod: IDL set to object &quot;test-toString&quot; should not throw 
</span><span class="cx"> PASS button.formMethod: IDL set to object &quot;test-toString&quot; followed by getAttribute() 
</span><span class="cx"> PASS button.formMethod: IDL set to object &quot;test-toString&quot; followed by IDL get 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorimportedw3cwebplatformtestshtmldomreflectionformsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt (203393 => 203394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt        2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt        2016-07-19 04:45:53 UTC (rev 203394)
</span><span class="lines">@@ -4724,7 +4724,7 @@
</span><span class="cx"> PASS input.formEnctype: IDL set to &quot;\0&quot; followed by getAttribute() 
</span><span class="cx"> PASS input.formEnctype: IDL set to &quot;\0&quot; followed by IDL get 
</span><span class="cx"> PASS input.formEnctype: IDL set to null should not throw 
</span><del>-FAIL input.formEnctype: IDL set to null followed by IDL get assert_equals: expected &quot;application/x-www-form-urlencoded&quot; but got &quot;&quot;
</del><ins>+PASS input.formEnctype: IDL set to null followed by IDL get 
</ins><span class="cx"> PASS input.formEnctype: IDL set to object &quot;test-toString&quot; should not throw 
</span><span class="cx"> PASS input.formEnctype: IDL set to object &quot;test-toString&quot; followed by getAttribute() 
</span><span class="cx"> PASS input.formEnctype: IDL set to object &quot;test-toString&quot; followed by IDL get 
</span><span class="lines">@@ -4865,7 +4865,7 @@
</span><span class="cx"> PASS input.formMethod: IDL set to &quot;\0&quot; followed by getAttribute() 
</span><span class="cx"> PASS input.formMethod: IDL set to &quot;\0&quot; followed by IDL get 
</span><span class="cx"> PASS input.formMethod: IDL set to null should not throw 
</span><del>-FAIL input.formMethod: IDL set to null followed by IDL get assert_equals: expected &quot;get&quot; but got &quot;&quot;
</del><ins>+PASS input.formMethod: IDL set to null followed by IDL get 
</ins><span class="cx"> PASS input.formMethod: IDL set to object &quot;test-toString&quot; should not throw 
</span><span class="cx"> PASS input.formMethod: IDL set to object &quot;test-toString&quot; followed by getAttribute() 
</span><span class="cx"> PASS input.formMethod: IDL set to object &quot;test-toString&quot; followed by IDL get 
</span><span class="lines">@@ -8169,7 +8169,7 @@
</span><span class="cx"> PASS button.formEnctype: IDL set to &quot;\0&quot; followed by getAttribute() 
</span><span class="cx"> PASS button.formEnctype: IDL set to &quot;\0&quot; followed by IDL get 
</span><span class="cx"> PASS button.formEnctype: IDL set to null should not throw 
</span><del>-FAIL button.formEnctype: IDL set to null followed by IDL get assert_equals: expected &quot;application/x-www-form-urlencoded&quot; but got &quot;&quot;
</del><ins>+PASS button.formEnctype: IDL set to null followed by IDL get 
</ins><span class="cx"> PASS button.formEnctype: IDL set to object &quot;test-toString&quot; should not throw 
</span><span class="cx"> PASS button.formEnctype: IDL set to object &quot;test-toString&quot; followed by getAttribute() 
</span><span class="cx"> PASS button.formEnctype: IDL set to object &quot;test-toString&quot; followed by IDL get 
</span><span class="lines">@@ -8320,7 +8320,7 @@
</span><span class="cx"> PASS button.formMethod: IDL set to &quot;\0&quot; followed by getAttribute() 
</span><span class="cx"> PASS button.formMethod: IDL set to &quot;\0&quot; followed by IDL get 
</span><span class="cx"> PASS button.formMethod: IDL set to null should not throw 
</span><del>-FAIL button.formMethod: IDL set to null followed by IDL get assert_equals: expected &quot;get&quot; but got &quot;&quot;
</del><ins>+PASS button.formMethod: IDL set to null followed by IDL get 
</ins><span class="cx"> PASS button.formMethod: IDL set to object &quot;test-toString&quot; should not throw 
</span><span class="cx"> PASS button.formMethod: IDL set to object &quot;test-toString&quot; followed by getAttribute() 
</span><span class="cx"> PASS button.formMethod: IDL set to object &quot;test-toString&quot; followed by IDL get 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203393 => 203394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/Source/WebCore/ChangeLog        2016-07-19 04:45:53 UTC (rev 203394)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2016-07-18  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        input.formEnctype / formMethod and button.formEnctype / formMethod / type should treat null as &quot;null&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=159908
+
+        Reviewed by Alex Christensen.
+
+        input.formEnctype / formMethod and button.formEnctype / formMethod / type
+        should treat null as &quot;null&quot; String:
+        - https://html.spec.whatwg.org/multipage/forms.html#htmlinputelement
+        - https://html.spec.whatwg.org/multipage/forms.html#htmlbuttonelement
+
+        In WebKit, we would treat null as a null String which would end up
+        removing the corresponding attribute. This does not match the
+        specification. Firefox and Chrome match the specification here.
+
+        Tests:
+        - fast/dom/HTMLButtonElement/null-handling.html
+        - fast/dom/HTMLInputElement/null-handling.html
+
+        * html/HTMLButtonElement.idl:
+        * html/HTMLInputElement.idl:
+
</ins><span class="cx"> 2016-07-18  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         webbookmarksd needs to use the same AppCache directory as MobileSafari
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLButtonElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLButtonElement.idl (203393 => 203394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLButtonElement.idl        2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/Source/WebCore/html/HTMLButtonElement.idl        2016-07-19 04:45:53 UTC (rev 203394)
</span><span class="lines">@@ -24,10 +24,9 @@
</span><span class="cx">     readonly attribute HTMLFormElement form;
</span><span class="cx">     attribute DOMString formAction;
</span><span class="cx"> 
</span><del>-    // FIXME: These should not have [TreatNullAs=LegacyNullString].
-    [TreatNullAs=LegacyNullString] attribute DOMString formEnctype;
-    [TreatNullAs=LegacyNullString] attribute DOMString formMethod;
-    [TreatNullAs=LegacyNullString] attribute DOMString type;
</del><ins>+    attribute DOMString formEnctype;
+    attribute DOMString formMethod;
+    attribute DOMString type;
</ins><span class="cx"> 
</span><span class="cx">     [Reflect] attribute boolean formNoValidate;
</span><span class="cx">     [Reflect] attribute DOMString formTarget;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLInputElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLInputElement.idl (203393 => 203394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLInputElement.idl        2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/Source/WebCore/html/HTMLInputElement.idl        2016-07-19 04:45:53 UTC (rev 203394)
</span><span class="lines">@@ -35,9 +35,8 @@
</span><span class="cx">     attribute FileList? files;
</span><span class="cx">     attribute DOMString formAction;
</span><span class="cx"> 
</span><del>-    // FIXME: These should not use [TreatNullAs=LegacyNullString].
-    [TreatNullAs=LegacyNullString] attribute DOMString formEnctype;
-    [TreatNullAs=LegacyNullString] attribute DOMString formMethod;
</del><ins>+    attribute DOMString formEnctype;
+    attribute DOMString formMethod;
</ins><span class="cx"> 
</span><span class="cx">     [Reflect] attribute boolean formNoValidate;
</span><span class="cx">     [Reflect] attribute DOMString formTarget;
</span></span></pre>
</div>
</div>

</body>
</html>