w3c / w3c/editing

execCommand('inserttext',...) behavior

Open
#112 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

execCommand
Dominant language
HTML
Stars
202
Forks
43
PR merge metrics
No merged PRs in 30d

Description

I have a question about space canonicalization that happens in the browser when an user inserts or removes text or when it is done through execCommand(‘inserttext’,...). Spec: https://w3c.github.io/editing/execCommand.html#canonical-space-sequences – section 9.7.

I’ve been investigating what happens in Chrome when we have a situation with multiple spaces in the string: ‘ foo bar ‘.

It seems that there is a bug in Chrome. I was not able to investigate what happens in Firefox as I couldn’t see insertion of &nbsp in Firefox console. Not sure if Firefox is inserting it but it is not displayed in the console or like Edge, they are not doing it.

Chrome folks: this looks like a bug

Here is the sample: https://jsfiddle.net/mwvywtze/ .

Expected output:

some text  foo  bar  

Actual output:

some text  foo bar  

thanks,
--grisha

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with section 9.7 of the linked execCommand specification and reproduce the behavior using the provided JSFiddle. Compare Chrome's output with the expected canonical space sequence and investigate the corresponding behavior in Firefox or Edge. Done means determining whether the result violates the specification and documenting the confirmed browser behavior or required specification clarification.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
web-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.