Perhaps you have heard about JavaScript Document’s execCommand() function, which we often use to make rich text editors. It had a bad reputation before as Internet Explorer worked differently with it. Here are my questions.
-
Today, do all the elements of
execCommandwork on all browsers? Like save as, bold, italic, etc…? -
If you want to make a rich text editor, is
execCommandthe appropriate choice today? -
Can you give me a website where I can find all the elements this function offers? Because I visited some, but they are just showing bold, italic and others. I want the complete updated lists.
Quirksmode has an (oldish) compatibility table of
document.execCommand.I think the best would be to mix
execCommandwith selection/range & DOM manipulation for a rich-text editor.Edit:
window.getSelection()document.selectionRelated questions: