From 1884cb637ec3b49aa0778883f0b3deb364ebf6a7 Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Wed, 6 Apr 2016 12:14:08 +0200 Subject: [PATCH] Make input/textarea.selection{Direction,Start,End} not throw Return null instead of throwing InvalidStateError for input.selectionDirection, selectionStart, and selectionEnd, when they do not apply. Fixes https://www.w3.org/Bugs/Public/show_bug.cgi?id=28225. --- source | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/source b/source index 92d5204d008..0a8d52f4189 100644 --- a/source +++ b/source @@ -42140,9 +42140,9 @@ interface HTMLFormElement : HTMLElement { [SameObject] readonly attribute NodeList labels; void select(); - attribute unsigned long selectionStart; - attribute unsigned long selectionEnd; - attribute DOMString selectionDirection; + attribute unsigned long? selectionStart; + attribute unsigned long? selectionEnd; + attribute DOMString? selectionDirection; void setRangeText(DOMString replacement); void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode = "preserve"); void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); @@ -49887,9 +49887,9 @@ interface HTMLOptionElement : HTMLElement { [SameObject] readonly attribute NodeList labels; void select(); - attribute unsigned long selectionStart; - attribute unsigned long selectionEnd; - attribute DOMString selectionDirection; + attribute unsigned long? selectionStart; + attribute unsigned long? selectionEnd; + attribute DOMString? selectionDirection; void setRangeText(DOMString replacement); void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode = "preserve"); void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); @@ -54320,9 +54320,9 @@ dictionary AutocompleteErrorEventInit : EventInit { DOM interfaces for handling their selection:

  void select();
-  attribute unsigned long selectionStart;
-  attribute unsigned long selectionEnd;
-  attribute DOMString selectionDirection;
+  attribute unsigned long? selectionStart;
+  attribute unsigned long? selectionEnd;
+  attribute DOMString? selectionDirection;
   void setRangeText(DOMString replacement);
   void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode = "preserve");
   void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction = "preserve");
@@ -54433,9 +54433,10 @@ dictionary AutocompleteErrorEventInit : EventInit {

For input elements, calling these methods while they don't apply, and getting or setting these attributes while they don't apply, must throw an InvalidStateError exception. Otherwise, they - must act as described below.

+ apply">don't apply, and setting these attributes while they don't apply, must throw an InvalidStateError exception; and getting + these attributes while they don't apply must return null. + Otherwise, they must act as described below.

For input elements, these methods and attributes must operate on the element's value. For textarea elements, these methods and