Closed Bug 747667 (Pepi3008) Opened 12 years ago Closed 12 years ago

contentEditable -> document.execCommand

Categories

(Core :: DOM: Editor, defect)

11 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 745528

People

(Reporter: pepi3008, Unassigned)

References

()

Details

Attachments

(2 files)

When having a div with contentEditable="true" attribute, then entering only a short text and using the following js sequence on the whole selection:
    document.execCommand('bold', null, false);
    document.execCommand('italic', null, false);
    document.execCommand('underline', null, false);
    document.execCommand('strikethrough', null, false);
then the selected text range won't be formatted, but the parent div gets the style attributes as shown in the video record.

Thank You in Advance
Pepi
the source code of the used example file
Component: General → Editor
Product: Firefox → Core
QA Contact: general → editor
I believe this is fixed by one of Aryeh's latest patches...
Could you provide a self-contained test file -- HTML only, no PHP?  I can't verify that your problem has gone away because I can't easily run your test file.  This should be fixed by the patch to bug 745528, which will land as soon as mozilla-central reopens.  Try waiting a few days, then download a Firefox nightly and test if the problem has gone away.  (It won't be fixed in the stable version of Firefox until Firefox 15 is released, which should be in about 18 weeks.)
Attachment #617461 - Attachment mime type: text/plain → text/html
Thank you Aryeh.

With Best Regards
Pepi
What's the problem with how Firefox is processing your test file?  Could you give exact steps of what you're doing with the test file, what Firefox does, and what you think it should be doing instead?  Something like:

1) Type "abc" into the first text box.

2) Select the text that you just typed in.

3) Press the "B" button.

Expected results: Text is bold.

Actual results: Text is not bold.


I can't confirm what the problem is unless you give detailed steps like that.  Thanks!
Dear Aryeh,

I get this bug when entering a short text in a div with contentEditable attribute.

1) If you type in for example: 'Just A Short Text'

2) Then select the typed in text and click in sequence 'B', 'I', 'U' and 'S'.

Firefox will then generate a style attribute into the parent div: '<div style="font-weight: bold; font-style: italic; text-decoration: underline line-through;" id="divEdit"...'

But it should generate a span tag for the selected text such as this: '<span style="font-weight: bold; font-style: italic; text-decoration: underline line-through;">...</span>'.

Hope this helps.

Best Wishes,
Pepi
Thanks for the detailed instructions!  Try the latest nightly of Firefox 15 from <http://nightly.mozilla.org/>.  It works for me in 15.0a1 (2012-04-26).  Please reopen this bug if it's still a problem for you.  Firefox 15 is scheduled to be released to all Firefox users on August 28: <https://wiki.mozilla.org/RapidRelease/Calendar>.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: