execCommand for font-size causes problem in Google Chrome
I am using a jquery based rich text editor "lwRTE"
It works well in all ways except in changing fontsize
I traced the problem as follows:
when i change the font size the command and the argument is chosen correctly as "font size" and "[the font size in number Eg.6]"
now the execCommand is executed and chrome executes it differently.
firefox changes the selected text as
<font size="6px">sample text</font>
chrome changes the selected text as
<span class="Apple-style-span" style="font-size: xx-large;">sample text</span>
开发者_开发技巧
this is what causes the problem. when i edit and save using Chrome, firefox seems to not understand the above way of formatting.
how do i make chrome also do the same? (i.e) insert font tag and insert crazy font sizes.
Thanks in advance
See the compatibility charts for execCommand
at http://quirksmode.org. Internet Explorer doesn't support font-size changing at all, Opera and Firefox wrap the font tag and Safari/Chrome behave as you suggested.
You can't change this functionality, you would have to build an alternative that works with the current selection range to implement one x-browser compatible method.
精彩评论