Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make input/textarea.selection{Direction,Start,End} not throw #1006

Merged
merged 1 commit into from
Apr 6, 2016

Conversation

zcorpan
Copy link
Member

@zcorpan zcorpan commented Apr 6, 2016

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.

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.
@zcorpan
Copy link
Member Author

zcorpan commented Apr 6, 2016

cc @mounirlamouri @bzbarsky

@mounirlamouri
Copy link
Member

Sounds like a good change if it doesn't break websites assumptions (ie. have a catch, thus assume non-null).

@zcorpan
Copy link
Member Author

zcorpan commented Apr 6, 2016

I tried looking for things that could regress but didn't find anything:

  • Not throwing was the behavior before these attributes were implemented.

  • https://developer.microsoft.com/en-us/microsoft-edge/platform/catalog/ suggests Edge doesn't have selectionDirection for textarea (but does have it for input).

  • httparchive gave 0 results for:

    SELECT page, url FROM (
    SELECT
      page,
      url,
      JSON_EXTRACT(payload, '$._body') AS hasBody,
      JSON_EXTRACT(payload, '$.response.content.text') AS content
    FROM [httparchive:har.chrome_feb_1_2016_requests]
    )
    WHERE hasBody = 'true'
    AND REGEXP_MATCH(content, "\bselection(Direction|Start|End)\b")
    AND REGEXP_MATCH(content, "\bcatch\b")
    
  • Searching in github for a few minutes I could not find anything that would regress.

  • Searching for the more generic "JSON.stringify" AND "catch" (see http://stackoverflow.com/questions/23073216/why-cant-you-stringify-a-jquery-object ) turns up lots of hits but is difficult to analyse; although there's stuff like safeJsonStringify which tries JSON.stringify and falls back to a custom function.

@bzbarsky
Copy link
Contributor

bzbarsky commented Apr 6, 2016

Seems ok to me; please update web platform tests as needed to make sure implementors get this on their radar or something..

@smaug----
Copy link

ok to me

@zcorpan
Copy link
Member Author

zcorpan commented Apr 13, 2016

Tests at web-platform-tests/wpt#2825

zcorpan added a commit to web-platform-tests/wpt that referenced this pull request May 12, 2016
domenic added a commit to jsdom/jsdom that referenced this pull request May 24, 2016
arronei pushed a commit to arronei/web-platform-tests that referenced this pull request Jun 14, 2016
@zcorpan
Copy link
Member Author

zcorpan commented Jun 23, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants