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

The content model of <ul>/<ol> conflicts with execCommand("indent") behavior #5567

Open
saschanaz opened this issue May 20, 2020 · 3 comments

Comments

@saschanaz
Copy link
Member

saschanaz commented May 20, 2020

As described in w3c/editing#256, document.execCommand("indent") has been generating <ul> right inside <ul> (or <ol> right inside <ol>), causing a conflict with their content models.

I guess we have two options:

  • Change the API behavior. This needs implementer interests.
  • Change the content model. Every browser supports lists inside a list, so maybe a simpler option?
  • Or, do nothing and deal with the conflict. A note should still be helpful in this case.
@domenic
Copy link
Member

domenic commented May 20, 2020

I tend toward doing nothing, assuming browsers don't want to change. The contentEditable spec should indeed include a note that it generates invalid HTML in all locations where it does so; I imagine this is not the only one (e.g., it probably generates brs or divs for paragraph breaks too in some cases, which is also invalid).

@masayuki-nakano
Copy link

I imagine this is not the only one (e.g., it probably generates brs or divs for paragraph breaks too in some cases, which is also invalid).

Well, but the invalid nested list may be preferred by users because <li> elements containing only sub list also has a bullet by the default style but this is different style from word processors. So web authors may also want to use the (currently) invalid structure.

@annevk
Copy link
Member

annevk commented Sep 28, 2021

It is true that

<ul>
 <li>
  <ul>
   <li>...

results in something that looks weird. And there is also nothing that says that is non-conforming. In expected usage however, web developers would write something like

<ul>
 <li>
  consider these subpoints:
  <ul>
   <li>...

at which point things are fine.

And arguably the editor output of

<ul>
 <li>consider these subpoints:</li>
 <ul>
  <li>

is somewhat funky as the subpoints have no direct relationship with the item they belong to.

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

No branches or pull requests

4 participants