`text-decoration` should be updated if the element changes it
Categories
(Core :: DOM: Editor, enhancement, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox109 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
Details
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
In the case, execCommand("strikethrough")
for foo<u>[bar]</u>baz
in the CSS mode,
- Blink:
foo<span style="text-decoration-line:underline line-through">bar</span>baz
- WebKit
foo<u style="text-decoration:underline line-through">bar</u>baz
- Gecko:
foo<span style="text-decoration:line-through"><u>bar</u></span>baz
Gecko has some specific path for <span>
element in the CSS mode. Therefore, aligning to Blink must be reasonable since it reduces the number of element.
Assignee | ||
Comment 1•2 years ago
|
||
There is another case: foo<ins>[bar]</ins>baz
in the CSS mode,
- Blink:
foo<ins style="text-decoration-line:line-through">bar</ins>baz
- WebKit:
foo<ins style="text-decoration:underline line-through">bar</ins>baz
- Gecko:
foo<span style="text-decoration:line-through"><ins>bar</ins></span>baz
I think Blink's result is reasonable because underline
is the default style of <ins>
.
Assignee | ||
Comment 2•2 years ago
|
||
Gecko wraps selection (and parent elements if entirely selected in them) in
new <span>
element and set text-decoration
. However, the other browsers
tries to reuse selected or parent element which already has text-decoration
style. The other browsers' behavior is more reasonable from point of view of:
- smaller footprint
- minimizing to update the DOM tree
And aligning the behavior makes it easier to check the compatibility between
browsers and us avoid from new test failures aligning other behaviors to the
other browsers.
If there is an element specifying text-decoration
, its text-decoration
declaration should be updated first.
If found element is <i>
, <s>
or <strike>
, it should be replaced with new
<span>
because these elements just represents the visual style and we should
not use such elements in the CSS mode (bug 1802736). At this time, unless
the element has text-decoration
rules in its style
attribute value, we
the new text-decoration
style should have the value represented by the
removing element (i.e., underline
for <i>
, line-through
for the others).
However, if found element is <ins>
or <del>
, we should set its
text-decoration
and unless it already has text-decoration
rules, we need
to append corresponding style (underline
for <ins>
and line-through
for
<del>
) too.
When setting the values or removing a value from text-decoration
declaration,
the value should be normalized to represent only text-decoration-line
for
compatibility with the other browsers and keeping the implementation simpler.
And also the value should be built as the following order:
- underline
- overline
- line-though
rather than updating current value with complicated code. Then, the tests can
compare with one expectation.
Depends on D163188
Comment 5•2 years ago
|
||
bugherder |
Description
•