HTMLEditor should not use existing `<strong>`, `<em>` and `<s>` as alternative container when styling node is a sibling of existing one
Categories
(Core :: DOM: Editor, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox109 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
Details
Attachments
(3 files)
The other browsers do not use existing <strong>
, <em>
and <s>
as alternative container of styling text node when they are siblings. E.g., execCommand("bold")
for ab[c]<strong>def</strong>
becomes ab<strong>cdef</strong>
in Gecko but becomes ab<b>c</b><strong>def</strong>
in the others.
However, they are treated as conflict element at removing. E.g., execCommand("bold")
for <strong>a[b]c</strong
should make it <strong>a</strong>b<strong>c</strong>
rather than <strong>a<b>b</b>c</strong>
nor <strong>a</strong><b>b</b><strong>c</strong>
.
Assignee | ||
Comment 1•2 years ago
|
||
I think that the tests were based on Gecko's behavior (and strikethrough.js
expects <s>
as default container of execCommand("strikethrough")
but all
browsers use <strike>
, I guess that the original test author was confused).
Blink and WebKit don't use near these elements as existing container of
alternatives of <b>
, <i>
and <strike>
. I think that this makes sense
because for example <b>
represents bold style but <strong>
represents
emphasize the text.
This patch makes the tests align to Blink/WebKit and most new expectations
are copied from Blink's result. Exception is, Blink/WebKit replaces rightmost
<s>
when middle of it is unstyled only in some cases with <strike>
or
<span>
. This must be a leak of their implementation, and hard to follow it
because the simplest approach of partially removing style is, split the existing
element at 2 points and unwrap middle element children. I.e., it's not required
to touch the rightmost element.
Depends on D163184
Assignee | ||
Comment 2•2 years ago
|
||
The other browsers do not do this. From semantics point of view, stop reusing
them is better.
Depends on D163185
Assignee | ||
Comment 3•2 years ago
|
||
Depends on D163186
Comment 5•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/669016166d0c
https://hg.mozilla.org/mozilla-central/rev/c0843589387e
https://hg.mozilla.org/mozilla-central/rev/6330f1ee7002
Description
•