Closed Bug 1802418 Opened 2 years ago Closed 2 years ago

`vertical-align` style should be removed when `execCommand("superscript")` or `execCommand("subscript")` for making `<sup>` and `<sub>` work cleanly

Categories

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

defect

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

execCommand("superscript") and execCommand("subscript") are handled specially.

<sup> and <sub> are exclusive. Therefore, existing element is removed first.

However, they are not mapped to CSS due to bug 394304 comment 2 even though the behavior is different from the other browsers. On the other hand, the other browsers remove (potentially) conflicting vertical-align styles around selected range. This makes sense and matches with the above special handling. Therefore, we should follow it. Then, we can get better result after applying patches for bug 1792386.

execCommand("superscript") and execCommand("subscript") are handled
specially.

<sup> and <sub> are exclusive. Therefore, existing element is removed first.

However, they are not mapped to CSS due to bug 394304 comment 2 even though the
behavior is different from the other browsers. Therefore, Gecko does not remove
vertical-align styles from selected ranges. On the other hand, the other
browsers do it. This makes sense and matches with the handling in HTML mode.

Therefore, we should remove vertical-align style around the selection ranges.

Note that this updates existing WPTs.

The first block of each command checks how the command work with similar
<span> having vertical-align style. The new expectation matches with the
other browsers (i.e., currently they fail in the other browsers).

The second block of each command checks how the command work with similar
situation but there is a sibling which has the applying style (i.e., <sup>
or <sub>). These tests keep failing in the other browsers since they want
to update vertical-align style at the selected range in the <span> having
vertical-align style.

Anyway, this fix is for avoiding new WPT failures of fixing bug 1792386, and
these commands must not be used so widely especially in the CSS mode.
Therefore, I believe that this change is not so risky.

Depends on D163183

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/87837958743a Make the style editor remove potentially conflicting `vertical-align` styles at applying `<sup>` or `<sub>` style r=m_kato
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/37219 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: