Bug 1430575 - Document interaction.clearElement. r=automatedtester
authorAndreas Tolfsen <ato@sny.no>
Mon, 15 Jan 2018 17:15:10 +0000
changeset 453926 7220cf5de9a8394c8e95a1afe574f8dcc156f2de
parent 453925 2f1762f3233a161c74478174322f7fbb40367b08
child 453927 949cf88764e6779ea42af6498de9f8e97037a1b3
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester
bugs1430575
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1430575 - Document interaction.clearElement. r=automatedtester MozReview-Commit-ID: 6bwVFiJP6ej
testing/marionette/interaction.js
--- a/testing/marionette/interaction.js
+++ b/testing/marionette/interaction.js
@@ -284,16 +284,36 @@ interaction.selectOption = function(el) 
     event.input(containerEl);
     event.change(containerEl);
   }
 
   event.mouseup(containerEl);
   event.click(containerEl);
 };
 
+/**
+ * Clears the form control or the editable element, if required.
+ *
+ * Before clearing the element, it will attempt to scroll it into
+ * view if it is not already in the viewport.  An error is raised
+ * if the element cannot be brought into view.
+ *
+ * If the element is a submittable form control and it is empty
+ * (it has no value or it has no files associated with it, in the
+ * case it is a <code>&lt;input type=file&gt;</code> element) or
+ * it is an editing host and its <code>innerHTML</code> content IDL
+ * attribute is empty, this function acts as a no-op.
+ *
+ * @param {Element} el
+ *     Element to clear.
+ *
+ * @throws {InvalidElementStateError}
+ *     If element is disabled, read-only, non-editable, not a submittable
+ *     element or not an editing host, or cannot be scrolled into view.
+ */
 interaction.clearElement = function(el) {
   if (element.isDisabled(el)) {
     throw new InvalidElementStateError(pprint`Element is disabled: ${el}`);
   }
   if (element.isReadOnly(el)) {
     throw new InvalidElementStateError(pprint`Element is read-only: ${el}`);
   }
   if (!element.isEditable(el)) {