views:

34

answers:

0

I have a DIV element with contentEditable set to 'true'. I wanted to create link elements inside this DIV, which needs to be deleted with a single backspace. I generate the link by replacing the text entered, when 'space' character is pressedI followed the suggestions given in http://stackoverflow.com/questions/2239821/backspace-doesnt-delete-inner-html-tags-of-a-contenteditable-div-in-firefox. Seems to work mostly, with some cross-browser issues.

  1. In FF, if the link node is at the beginning, delete does not work. But works if not at the beginning (like "foo www.google.com").
  2. In safari, after inserting the link (when space is pressed), the focus is lost.
  3. In IE, if HTML strict mode is set in doctype, backspace does not delete the entire node, but one character. If I remove the doctype, backspace deletes the entire node.

Any suggestions to resolve the above issues?

Thanks

Anand