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

[Input Events] Why are insertText and replaceContent separate events? #124

Closed
ayg opened this issue Apr 19, 2016 · 8 comments
Closed

[Input Events] Why are insertText and replaceContent separate events? #124

ayg opened this issue Apr 19, 2016 · 8 comments

Comments

@ayg
Copy link
Contributor

ayg commented Apr 19, 2016

Isn't replacing content just inserting content in the case where the selection is not collapsed?

@johanneswilm
Copy link
Contributor

insertText is specifically limited to text. This used to be "insertCharacter" which maybe gave a better explanation for what was happening. In the JavaScript part one will likely deal quite differently with characters the user types and content that can potentially contain more complex DOM structures.

So if the two were joined together, JavaScript authors would likely have to go through the inserted content to try to figure out if this is richtext content or whether it is about plaintext characters/text.

See also discussion at #118

@ayg
Copy link
Contributor Author

ayg commented Apr 19, 2016

Okay, but then why not call it insertContent? Why replaceContent? Also, how can the user insert non-text content, other than by pasting, which is already handled by the paste event?

@johanneswilm
Copy link
Contributor

why not call it insertContent? Why replaceContent?

That name may work as well.

how can the user insert non-text content, other than by pasting

By dragging, or by using the spellcheck function which may work across DOM boundaries. There may be more such checkers in the future.

@ayg
Copy link
Contributor Author

ayg commented Apr 19, 2016

I suggest replacing "using a keyboard, IME, speech, or similar method" in the spec for replaceContent with something like "using spellcheck, drag-and-drop, or similar method" to clarify that it's not meant to deal with regular input.

Also, is it meant to cover paste and drag-and-drop, even though there are existing events (paste and drop events)? It may make sense to have one event that can be used to catch all such modifications, but perhaps it should have a field specifying the cause of the event.

@johanneswilm
Copy link
Contributor

Also, is it meant to cover paste and drag-and-drop, even though there are existing events (paste and drop events)?

This is still under discussion. See https://lists.w3.org/Archives/Public/public-webapps/2016JanMar/0083.html

@gked
Copy link

gked commented Apr 25, 2016

@johanneswilm: Do you think we should create an issue (that if it has not been done already) for renaming "replaceContent" with "insertContent"?
Also, instead of "insertContent", I am thinking "insertNonText" would have a better clarity?

@johanneswilm
Copy link
Contributor

@gked: I think that sounds like a good idea.

@johanneswilm
Copy link
Contributor

With the recently opened issue #126, it seems this issue has been dealt with and can be closed. Please reopen if assumption was mistaken.

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

3 participants