I’m trying to use contenteditable and styleWithCss.
It doesn’t seem to work in webkit.
Anytime I use do an execCommand, it generates a <b> rather than the span I expected.
Here’s a demo:
http://jsbin.com/izomo/2/edit
Select part of the text, click the bold button, and see the html output.
Is this a bug or am I doing something wrong.
Thank you very much.
It seems like everything is working as intended.See Bug 13490 on WebKit BugZilla.EDIT: Support for styleWithCSS was added to WebKit’s source in changeset 40560, on 03 February 2009.
That said, it seems like ever since then, no matter what,
styleWithCSSis always set tofalse, whereas before the change, style commands were always applied with CSS, as ifstyleWithCSSexisted but was always set totrue.I even tried rewriting your
document.execCommandline as follows, in accordance with the Mozilla documentation:These modified commands still work in Firefox, but not in either Chrome 5 or Safari 5 (both on Windows and installed today).
So, it would seem like this is a WebKit bug.