- From: Aryeh Gregor <Simetrical+w3c@gmail.com>
- Date: Thu, 7 Apr 2011 13:36:47 -0400
On Wed, Apr 6, 2011 at 7:40 PM, Tim Down <timdown at gmail.com> wrote: > Is there an overwhelming reason why execCommand() should be restricted > to contentEditable/designMode elements, as the spec seems to suggest? IIRC from testing, that's how all browsers but IE9 behave. I guess the reason is that if you have a typical WYSIWYG editor, which has non-editable stuff surrounding it, and the user has selected some non-editable stuff on the page and clicks the "bold" button, you don't want the non-editable stuff to be bolded -- the button should only affect the editable area. Also, in a typical case, you're letting the user edit so that the markup will be saved or submitted to a server, and the markup that you'll save or submit is probably only the editable stuff. So if you do something like push down styles from outside the editable area, that change will not only unexpectedly affect the appearance of the non-editable part of the page, the change might not get saved. Of course, this makes it less convenient to use the commands for non-editing purposes, but they're mostly not very useful for that anyway. Do you have particular use-cases for using execCommand() outside of contentEditable/designMode? I'll probably put off tackling details like this until a much later date, once I've specified the algorithms themselves to a satisfactory extent.
Received on Thursday, 7 April 2011 10:36:47 UTC