BubikolRamios
12-05-2012, 11:13 AM
sample text:
chfjgj ghj gfhj hg jgfh jfg foo sdčlfaklsd foo gfhdfhg
assuming blue stuff is something like:
<font color='blue'>foo</font>
or
<font color='blue' id = 'dsfasd' ...>foo</font>
How to clear that (assuming I selected one of 'foo's), using execCommand or anything else to 'foo' only ?
BubikolRamios
12-05-2012, 02:12 PM
So, in order to do something you must read selection underlying HTML.
One cross browser method is here: http://www.codingforums.com/archive/index.php/t-154848.html, scroll to bottom.
Now the problem that exist all the time, regardles of method used for reading
underlying HTML .....
consider this (note extra space in second line):
(<font color='blue'>foo</font>)
( <font color='blue'>foo</font> )
In first case selecting 'foo' and using func for reading HTML, return would be 'foo', in second case selecting ' foo ' (with spaces) return would be ' <font color='blue'>foo</font> ' (with spaces).
This(getting html) even work if you have 'foo,' and select all that, but gives you one extra unwanted ',' (in this case) inside HTML.
Any solution to this ?
All upper statements tested on FF.
EDIT: the prob is in contentEditable = /true/false. In IE works OK regardlesa of state, in FF works same as IE OK if false, otherwise not.
felgall
12-05-2012, 06:11 PM
Just a reminder that the <font> tag was deleted from HTML back in 1997 and was one of those replaced by CSS.
BubikolRamios
12-05-2012, 07:05 PM
Yes I know, but execCommand puts it in. Latest FF version (for fore color text).