Okay, some Guys will know what i mean and edit my Question but they did it wrong.
A better explanation:
You have a contenteditable div
with the text This is a Test String.
.
If you use now the execCommand('underline')
on Test String
you get This is a <u>Test String</u>
if you use now the execCommand('strikethrough')
on is a Test
you get This <s>is a <u>Test</u></s><u>String</u>
, THIS is correct.
So, in HTML5 <u>
and <s>
are obsolete.
For the first execCommand
you can use the surroundContents()
with a <span style="text-decoration:underline;">
. If you now use the surroundContets()
for the second execCommand
you receive the BAD_BOUNDARYPOINTS_ERR
.
The Thing i want is a Function which works like the execCommand
in this case but with functions where i can define with witch HTML-Tag the String will wrapped… (It should be intelligent in the case if there is any overlapping…)