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

What if the underlying range is changed? #25

Closed
hgl opened this issue Nov 21, 2014 · 2 comments
Closed

What if the underlying range is changed? #25

hgl opened this issue Nov 21, 2014 · 2 comments

Comments

@hgl
Copy link

hgl commented Nov 21, 2014

Should this spec codify if the range return by selection.getRangeAt(0) is changed, (e.g. insert a node into the range), the selection should change accordingly or not?

Currently, browsers behave differently on this one. Webkit and blink make selection to contain a new range. Gecko changes the selection. I personally think Gecko's behavior is the correct one.

@rniwa
Copy link
Contributor

rniwa commented Nov 21, 2014

The spec matches WebKit/Blink behavior. See http://w3c.github.io/selection-api/#user-interactions where it says:

The user agent should allow the user to change the selection associated with the active document (defined in [HTML5]). If the user makes any modification to a selection, the user agent must create a new range with suitable start and end of the range ([DOM4]) and associate the selection with this new range (not modify the existing range), and set update selection's direction to forwards if the start is before or equal to the end, backwards if if the end is before the start, or directionless if the start and the end cannot be ordered due to the platform convention.

@rniwa
Copy link
Contributor

rniwa commented Nov 21, 2014

Closing the issue as discussed on IRC. Please file a new issue should you find this solution unsatisfactory.

@rniwa rniwa closed this as completed Nov 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants