Bug 18423 - InsertHtml command is adding <span class="Apple-style-span"> tags by itself
Summary: InsertHtml command is adding <span class="Apple-style-span"> tags by itself
Status: RESOLVED DUPLICATE of bug 12248
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 525.x (Safari 3.1)
Hardware: Macintosh OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-10 23:33 PDT by Martin Kou
Modified: 2008-04-17 13:16 PDT (History)
0 users

See Also:


Attachments
Test case with an editable iframe prepared. (919 bytes, text/html)
2008-04-10 23:35 PDT, Martin Kou
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Kou 2008-04-10 23:33:55 PDT
Steps to reproduce the bug:

 1. Create an editable document with some contents wrapped in an <h3> tag.
 2. Put the caret inside the <h3> tag.
 3. Try to run document.execCommand('inserthtml', false, $some_html) to insert some simple text into the current caret position.
 4. Notice the inserted text looks different to the rest of the <h3> tag.
 5. Print the HTML contents of the editable document to find some extra <span> tags have been inserted unintentionally by the InsertHtml command.
Comment 1 Martin Kou 2008-04-10 23:35:07 PDT
Created attachment 20471 [details]
Test case with an editable iframe prepared.
Comment 2 Martin Kou 2008-04-10 23:35:51 PDT
This bug is causing the bug https://dev.fckeditor.net/ticket/2113 in FCKeditor.
Comment 3 Mark Rowe (bdash) 2008-04-11 16:54:55 PDT
This is probably the same as bug 12248.
Comment 4 Martin Kou 2008-04-15 02:17:52 PDT
I've found that in addition to adding unnecessary <span> tags, the bug is also manipulating the DOM structure of the editable document in unexpected ways.

For example, if I had this HTML inside the editable frame:
<h3 style="color:red;">Hello <span id="abc" style="color:green;">Wor</span>ld!</h3>

.. and inside the green text "Wor", insert the "<" symbol, then we'll have:
<h3 style="color:red;">Hello <span id="abc" style="color:green;">W<span class="Apple-style-span" style="color: rgb(0, 0, 0); font-size: 16px; font-weight: normal; ">&lt;<span class="Apple-style-span" style="color: rgb(255, 0, 0); font-size: 19px; font-weight: bold; "><span id="abc" style="color:green;">or</span>ld!</span></span></span></h3>

Notice that now we have two <span> tags with the id "abc". This is clearly wrong.
Comment 5 David Kilzer (:ddkilzer) 2008-04-17 13:16:56 PDT

*** This bug has been marked as a duplicate of 12248 ***