Bug 91783 - execCommand copies the backgroung-color of the enclosing element to the element being edited.
Summary: execCommand copies the backgroung-color of the enclosing element to the eleme...
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2012-07-19 14:18 PDT by Ryosuke Niwa
Modified: 2012-07-27 17:32 PDT (History)
5 users (show)

See Also:

Patch (5.03 KB, patch)
2012-07-27 05:01 PDT, Sukolsak Sakshuwong
no flags Details | Formatted Diff | Diff
Patch (4.94 KB, patch)
2012-07-27 13:07 PDT, Sukolsak Sakshuwong
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2012-07-19 14:18:43 PDT
What steps will reproduce the problem?
1. Open a blank/any page.
2. Open the developer tool console.
3. Execute the following JS from the console:

var body = document.getElementsByTagName('body')[0];
body.contentEditable = true;
body.style['cssText'] = 'background-color: white;';

4. Now type some text into the page. (e.g aaa)
5. select the text typed in 4.
6. from the js console:


What is the expected result?

body.innerHTML should give

What happens instead?

body.innerHTML gives
"<ul><li><span style="background-color: white; ">aaa</span></li></ul>"

Please provide any additional information below. Attach a screenshot if

It can also be reproduced with other commands e.g insertOrderedList.
Comment 1 Ryosuke Niwa 2012-07-19 14:18:55 PDT
Comment 2 Sukolsak Sakshuwong 2012-07-27 05:01:24 PDT
Created attachment 154908 [details]
Comment 3 Ryosuke Niwa 2012-07-27 11:15:37 PDT
Comment on attachment 154908 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=154908&action=review

The code change looks right.

> LayoutTests/editing/style/redundant-background-color.html:6
> +<script src="../../resources/testharness.js"></script>
> +<script src="../../resources/testharnessreport.js"></script>

We don't normally use testharness.js for webkit regression tests. Use dump-as-markup.js in LayoutTests/resources/ instead.
Comment 4 Sukolsak Sakshuwong 2012-07-27 13:07:23 PDT
Created attachment 155033 [details]
Comment 5 WebKit Review Bot 2012-07-27 17:32:31 PDT
Comment on attachment 155033 [details]

Clearing flags on attachment: 155033

Committed r123940: <http://trac.webkit.org/changeset/123940>
Comment 6 WebKit Review Bot 2012-07-27 17:32:35 PDT
All reviewed patches have been landed.  Closing bug.