execCommand(bold | italic | underline) fails when selecting entire text inside an anchor element

NEW
Unassigned

Status

()

Core
Editor
5 years ago
5 years ago

People

(Reporter: dan, Unassigned)

Tracking

({regression})

15 Branch
x86
All
regression
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17

Steps to reproduce:

Start with an anchor element with the contenteditable attribute set:

<a href="http://www.mozilla.org" contenteditable="true">SOME TEXT</a>

then select the entire text inside this element and call document.execCommand('bold'). 

The above also applies for other commands like 'italic' or 'underline'.


Actual results:

Nothing happens


Expected results:

The text should become bold. 

In the same scenario, if a div element is used instead of the anchor element, execCommand works as expected.

You can give it a try on http://jsfiddle.net/ZTDBx/

Comment 1

5 years ago
There are 2 regressions.
#1 The problem happens  due to landing Bug 738366 - Default styleWithCSS to false (e.g. editor.use_css=false)
#2 The problem happens even if set editor.use_css=true , regressed by Bug 746515

#1 regression window:
Good:
http://hg.mozilla.org/mozilla-central/rev/6881fa89cfca
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120404 Firefox/14.0a1 ID:20120404001322
Bad:
http://hg.mozilla.org/mozilla-central/rev/638769f8ec54
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120404 Firefox/14.0a1 ID:20120404043722
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=6881fa89cfca&tochange=638769f8ec54
Triggered by:
aaba08c21296	Aryeh Gregor — Bug 738366 - Default styleWithCSS to false; r=ehsan



#2 regression window (force editor.use_css = true)
Good:
http://hg.mozilla.org/mozilla-central/rev/424cb3a6141b
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120424 Firefox/15.0a1 ID:20120424095512
Bad:
http://hg.mozilla.org/mozilla-central/rev/f661fb83699b
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120424 Firefox/15.0a1 ID:20120424181127
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=424cb3a6141b&tochange=f661fb83699b

#2 regression window(birch):
Good:
http://hg.mozilla.org/projects/birch/rev/98beb4e935d7
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120419 Firefox/14.0a1 ID:20120419040227
Bad:
http://hg.mozilla.org/projects/birch/rev/568ff98bad40
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120420 Firefox/14.0a1 ID:20120420040227

Triggered by: Bug 746515
Blocks: 746515
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
OS: Mac OS X → All
Version: 18 Branch → 15 Branch
We agreed in bug 833889 comment 9, 10, 13 that the relevant part of bug 746515 is disruptive and should be backed out, so that should fix this whenever it happens.
You need to log in before you can comment on or make changes to this bug.