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 committed May 24, 2016
1 parent bc467b3 commit ecd6dd6
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
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
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
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 ecd6dd6

Please sign in to comment.