The tests RTE2-C_BC:ace_FONT.ass.s:bc:rgb-1_SW and
RTE2-C_HC:ace_FONT.ass.s:bc:rgb-1_SW both test that if changing the background
color on an input like
<span class="Apple-style-span" style="background-color: rgb(255, 0, 0)">[foobarbaz]</span>
the result is something like
<span style="background-color: #aaccee">[foobarbaz]</span>
However, the algorithm in the editing spec, and as of
<https://bugzilla.mozilla.org/show_bug.cgi?id=746515#c8> also the algorithm in
Gecko, works by first removing all styles, then adding new styles in a wrapper
span, without adding styles to any existing elements. This makes the behavior
in CSS mode match the behavior in HTML mode, where as a rule, only new elements
are added and existing ones aren't modified. (Modifying existing elements can
make the modes behave differently in some cases when properties interact, e.g.,
color and text-decoration.) Thus the styles are first stripped, leaving
<span class="Apple-style-span">[foobarbaz]</span>
(because it won't remove the span because it has a class), and then a new span
is added, giving
<span style="background-color: rgb(170, 204, 238);"><span class="Apple-style-span">[foobarbaz]</span></span>
This has an extra <span>, so it's not as clean. But the alternatives are either
1) Special-case class="Apple-style-span". This is not acceptable in a
standard. WebKit no longer produces it anyway, so it shouldn't be necessary
going forward.
2) Add style="" to existing elements, not just newly-created ones. This is not
desirable because it can lead to CSS and non-CSS modes working differently,
like in the case of execCommand("underline") on <span class="x">foo</span> with
the style rule .x { color: red }. If in CSS mode we produced <span class="x"
style="text-decoration: underline">foo</span>, the underline would be red. But
in non-CSS mode we have to produce <u><span class="x">foo</span></u>, and the
underline will be black. To avoid this possibility, we need to avoid adding
style="" to any existing elements.
Please update the tests to permit the result required by the spec. Thank you.
Original issue reported on code.google.com by a...@aryeh.name on 20 Apr 2012 at 6:21
Original issue reported on code.google.com by
a...@aryeh.name
on 20 Apr 2012 at 6:21