Closed Bug 525888 Opened 15 years ago Closed 4 years ago

[Midas] execCommand(indent) should place the ul inside li, not ul inside ul

Categories

(Core :: DOM: Editor, defect, P2)

defect

Tracking

()

RESOLVED DUPLICATE of bug 54479
Tracking Status
thunderbird_esr68 --- affected

People

(Reporter: JoWie, Unassigned)

References

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2b1) Gecko/20091029 Firefox/3.6b1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2b1) Gecko/20091029 Firefox/3.6b1

When using execCommand(indent) on a list, an ul/ol is placed directly under the parent ul/ol. This is invalid HTML 4 strict: http://www.w3.org/TR/html4/struct/lists.html#edef-UL

Related to bug 485466

Reproducible: Always

Steps to Reproduce:
1. Goto http://www.mozilla.org/editor/midasdemo/
2. Create a list with 2 items
3. Indent the second item
4. View the source
Actual Results:  
<ul>
  <li>First</li>
  <ul>
    <li>Second</li>
  </ul>
</ul>

Expected Results:  
<ul>
  <li>First
    <ul>
      <li>Second</li>
    </ul>
  </li>
</ul>
All major browsers have this behaviour.
Status: UNCONFIRMED → NEW
Ever confirmed: true
And the editing spec requires it.  The markup is invalid, though: <https://www.w3.org/Bugs/Public/show_bug.cgi?id=12609>
Attached file Testcase

This came up in bug 1548753. The invalid markup has the effect that we get unexpected list numbers because we're now using the CSS built-in 'list-item' counter for HTML lists (which means an <ol> affects any sibling <li>s after it).

The HTML spec is quite clear that only <li>s (and <script>) are valid inside <ol>:
https://html.spec.whatwg.org/multipage/grouping-content.html#the-ol-element
(ditto for <ul> and <menu>)
So we should fix this...

OS: Windows XP → All
Priority: -- → P2
Hardware: x86 → All
Attached patch hackSplinter Review

Wrapping the child <ol> we're currently inserting in a <li style="display:block"> might be a solution?
I guess we'd need to account for this in the "outdent" command though?

Feel free to take it from here...

(BTW, there's an amazing amount of copy-pasted code between IndentAroundSelectionWithHTML and IndentAroundSelectionWithCSS which we probably should share...)

Currently, we cannot fix this bug at least for now since the other browsers also behave so. Therefore, fixing this bug may cause web-compat issue. If we need to fix this, you need to ask Google and Apple about this issue first.

Fair enough, do we have any contacts there that are working on execCommand/editor code?

Given the state of the execCommand spec is effectively "abandoned" we should probably try to remove these commands from the web platform. Again, this requires vendor coordination of course.

See Also: → 485466
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: