Ok, some guys will know what I mean and edit their question, but they did it wrong.
The best explanation:
You have contenteditable divwith text This is a Test String.. If you use now execCommand('underline')on Test String, you get This is a <u>Test String</u>
if you use now 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 deprecated. For the first execCommandyou can use surroundContents()with <span style="text-decoration:underline;">. If now you use surroundContets()for the second execCommand, you get BAD_BOUNDARYPOINTS_ERR.
The thing I want is a function that works in this case as execCommand, but with functions where I can define using the HTML witch tag that will be wrapped by String ... (It should be smart in case there is overlap ...)
source
share