Closed Bug 1811434 Opened 2 years ago Closed 1 year ago

Joining 2 paragraphs merges different style <font> elements

Categories

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

defect

Tracking

()

RESOLVED FIXED
111 Branch
Tracking Status
firefox111 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

Testcase: https://jsfiddle.net/d_toybox/4q6adhku/

When there are 2 paragraphs and both paragraphs have <font> element with different size and/or color attributes, put caret at start of the second paragraph and type Backspace, then, the second paragraph's <font> element is removed and joining the
text in the first paragraph's <font> element. (I tested this with setting editor.join_split_direction.compatible_with_the_other_browsers to true, I guess that the result will be reverted if this is set to false.)

Of course, Chrome does not join them.

I found this bug in Yahoo Mail, so this is a real web-compat issue in a major web app at least.

Summary: Joining 2 paragraphs merge different style <font> elements → Joining 2 paragraphs merges different style <font> elements

Currently, HTMLEditor joins inline elements if the tag name is same and the
specified CSS style is not different. However, this may cause loosing style
specified by <font> elements at joining 2 paragraphs etc. We should not
join <font> elements if they have:

  • different values for color, size or face
  • only one has color, size or face

I don't delete unnecessary testcases in delete.js and forwarddelete.js which
are same as adding tests because deleting them causes unexpected failures of
some following tests near the boundary of test chunks. Perhaps, we should
group them better in another bug.

Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/0cbf97095ee6
Make `HTMLEditor` never join `<font>` elements if they have different styles r=m_kato
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/38194 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 111 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: