Title: [224423] branches/safari-604.4.7.10-branch

Diff

Modified: branches/safari-604.4.7.10-branch/LayoutTests/ChangeLog (224422 => 224423)


--- branches/safari-604.4.7.10-branch/LayoutTests/ChangeLog	2017-11-03 20:13:08 UTC (rev 224422)
+++ branches/safari-604.4.7.10-branch/LayoutTests/ChangeLog	2017-11-03 20:19:00 UTC (rev 224423)
@@ -1,3 +1,21 @@
+2017-11-03  Jason Marcell  <jmarc...@apple.com>
+
+        Cherry-pick r224398. rdar://problem/35329712
+
+    2017-11-03  Daniel Bates  <daba...@apple.com>
+
+            Invalidate node list when associated form control element is removed
+            https://bugs.webkit.org/show_bug.cgi?id=179232
+            <rdar://problem/35308269>
+
+            Reviewed by Ryosuke Niwa.
+
+            Add a test to ensure the node list returned by HTMLFormElement.elements stays synchronized
+            with the document.
+
+            * fast/forms/node-list-remove-button-from-form-expected.txt: Added.
+            * fast/forms/node-list-remove-button-from-form.html: Added.
+
 2017-10-29  Jason Marcell  <jmarc...@apple.com>
 
         Cherry-pick r224139. rdar://problem/35143359

Added: branches/safari-604.4.7.10-branch/LayoutTests/fast/forms/node-list-remove-button-from-form-expected.txt (0 => 224423)


--- branches/safari-604.4.7.10-branch/LayoutTests/fast/forms/node-list-remove-button-from-form-expected.txt	                        (rev 0)
+++ branches/safari-604.4.7.10-branch/LayoutTests/fast/forms/node-list-remove-button-from-form-expected.txt	2017-11-03 20:19:00 UTC (rev 224423)
@@ -0,0 +1,15 @@
+Tests that removing a <button> from the document removes it from HTMLFormElement.elements.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Before removal of button:
+PASS document.getElementById('aForm').elements is non-null.
+PASS document.getElementById('aForm')['aButton'] is document.getElementById('aButton')
+
+After removal of button:
+PASS document.getElementById('aForm')['aButton'] is undefined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-604.4.7.10-branch/LayoutTests/fast/forms/node-list-remove-button-from-form.html (0 => 224423)


--- branches/safari-604.4.7.10-branch/LayoutTests/fast/forms/node-list-remove-button-from-form.html	                        (rev 0)
+++ branches/safari-604.4.7.10-branch/LayoutTests/fast/forms/node-list-remove-button-from-form.html	2017-11-03 20:19:00 UTC (rev 224423)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<button id="aButton" form="aForm"></button>
+<form id="aForm"></form>
+<script>
+description("Tests that removing a &lt;button&gt; from the document removes it from HTMLFormElement.elements.");
+
+runTest();
+
+function runTest()
+{
+    debug("Before removal of button:");
+    shouldBeNonNull("document.getElementById('aForm').elements");
+    shouldBe("document.getElementById('aForm')['aButton']", "document.getElementById('aButton')");
+    document.getElementById('aButton').remove();
+
+    debug("<br>After removal of button:");
+    shouldBeUndefined("document.getElementById('aForm')['aButton']");
+}
+</script>
+</body>
+</html>

Modified: branches/safari-604.4.7.10-branch/Source/WebCore/ChangeLog (224422 => 224423)


--- branches/safari-604.4.7.10-branch/Source/WebCore/ChangeLog	2017-11-03 20:13:08 UTC (rev 224422)
+++ branches/safari-604.4.7.10-branch/Source/WebCore/ChangeLog	2017-11-03 20:19:00 UTC (rev 224423)
@@ -1,3 +1,24 @@
+2017-11-03  Jason Marcell  <jmarc...@apple.com>
+
+        Cherry-pick r224398. rdar://problem/35329712
+
+    2017-11-03  Daniel Bates  <daba...@apple.com>
+
+            Invalidate node list when associated form control element is removed
+            https://bugs.webkit.org/show_bug.cgi?id=179232
+            <rdar://problem/35308269>
+
+            Reviewed by Ryosuke Niwa.
+
+            A node list represents a live view of the DOM. Invalidate the node list
+            associated with a form element whenever one of its associated form control
+            elements is removed.
+
+            Test: fast/forms/node-list-remove-button-from-form.html
+
+            * html/HTMLFormElement.cpp:
+            (WebCore::HTMLFormElement::removeFormElement):
+
 2017-10-29  Jason Marcell  <jmarc...@apple.com>
 
         Cherry-pick r224134. rdar://problem/35143359

Modified: branches/safari-604.4.7.10-branch/Source/WebCore/html/HTMLFormElement.cpp (224422 => 224423)


--- branches/safari-604.4.7.10-branch/Source/WebCore/html/HTMLFormElement.cpp	2017-11-03 20:13:08 UTC (rev 224422)
+++ branches/safari-604.4.7.10-branch/Source/WebCore/html/HTMLFormElement.cpp	2017-11-03 20:19:00 UTC (rev 224423)
@@ -606,6 +606,9 @@
     removeFromPastNamesMap(e);
     m_associatedElements.remove(index);
 
+    if (auto* nodeLists = this->nodeLists())
+        nodeLists->invalidateCaches();
+
     if (e == m_defaultButton)
         resetDefaultButton();
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to