Skip to content

Commit

Permalink
Make selection{Start,End,Direction} no longer throw when non-applicable
Browse files Browse the repository at this point in the history
This keeps up with a recent spec change: whatwg/html#1006.
  • Loading branch information
domenic authored and nhunzaker committed Dec 22, 2016
1 parent 10df58d commit 8007da1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/jsdom/living/nodes/HTMLInputElement-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class HTMLInputElementImpl extends HTMLElementImpl {

get selectionStart() {
if (!allowVariableLengthSelection(this.type)) {
throw new DOMException(DOMException.INVALID_STATE_ERR);
return null;
}

return this._selectionStart;
Expand All @@ -247,7 +247,7 @@ class HTMLInputElementImpl extends HTMLElementImpl {

get selectionEnd() {
if (!allowVariableLengthSelection(this.type)) {
throw new DOMException(DOMException.INVALID_STATE_ERR);
return null;
}

return this._selectionEnd;
Expand All @@ -263,7 +263,7 @@ class HTMLInputElementImpl extends HTMLElementImpl {

get selectionDirection() {
if (!allowVariableLengthSelection(this.type)) {
throw new DOMException(DOMException.INVALID_STATE_ERR);
return null;
}

return this._selectionDirection;
Expand Down
6 changes: 3 additions & 3 deletions lib/jsdom/living/nodes/HTMLInputElement.idl
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ interface HTMLInputElement : 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);
Expand Down
6 changes: 3 additions & 3 deletions lib/jsdom/living/nodes/HTMLTextAreaElement.idl
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ interface HTMLTextAreaElement : 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);
Expand Down

0 comments on commit 8007da1

Please sign in to comment.