Closed Bug 676966 Opened 14 years ago Closed 14 years ago

In contentEditable forms, selecting the entire text (ctrl+a) and trying to format bold or italic fails to output correct html with execCommand

Categories

(Firefox :: General, defect)

5 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: ihavetoeatdinner, Unassigned)

References

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0.1) Gecko/20100101 Firefox/5.0.1 Build ID: 20110707182747 Steps to reproduce: 'm trying to write a wysiwyg editor using a contentEditable div, and am having trouble in Firefox when dealing with bold (and italic). Actual results: When all text in the div is selected, execCommand('bold') works in the div, but when I try to grab the HTML of that content, the HTML does not reveal any formatting. To see what I mean, please try running the attached HTML code in Firefox 5. Please try the following: - Select the word "Some" only. Click the Bold button. This will make the text bold, as expected. The HTML output uses <span style="font-weight:bold;"> to bold the word, which is somewhat unfortunate (it's <b> in Safari, Chrome), but nonetheless does the job. - Select the entire phrase "Some editable text" (either manually or using CTRL-A). Click the Bold button. While the contentEditable text is bold, as expected, the HTML output does not have the bold formatting applied. Expected results: The HTML output should have the bold formatting applied.
Attachment #551172 - Attachment mime type: text/plain → text/html
It works if onClick="execCommand('styleWithCSS', false, false);execCommand(.....
Attached image screenshot
View Selection source shows > <div style="font-weight: bold;" id="input" contenteditable="true">Some editable text</div> And the test is shown in bold.
(In reply to Alice0775 White from comment #1) > It works if onClick="execCommand('styleWithCSS', false, > false);execCommand(..... Thanks. This worked!
(In reply to ihavetoeatdinner from comment #3) > (In reply to Alice0775 White from comment #1) > > It works if onClick="execCommand('styleWithCSS', false, > > false);execCommand(..... > > Thanks. This worked! So is this Resolved? Can you set the bug's status accordingly? Thanks
Considering comment3, setting resolution to Resolved WFM
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: