[whatwg] HTML 5 - comments on 5.6 Command APIs
tom at tom.me.uk
Tue Mar 11 12:31:34 PDT 2008
On Tue, Mar 11, 2008 at 6:15 PM, Krzysztof Żelechowski
<giecrilj at stegny.2a.pl> wrote:
> > I see no point in returning true when there are no links to remove. IE
> > and Opera currently only return true when the selection contains a
> > link. WebKit follows the current HTML 5 wording.
> "Unlink" means "Remove all links".
> There is no point removing all links when there are none
> but there is no harm either.
> Me thinks "Unlink" should be enabled in this case.
queryCommandEnabled is primarily, I would argue, used to update UIs
(especially enabling/disabling toolbar buttons) to show whether the
command will currently have any affect on the document.
There is indeed never any harm in calling execCommand('Unlink'), you
can call it as much as you like at any point without raising an
exception, but execCommandEnabled is surely about whether the call
will actually achieve anything.
Following your logic, queryCommandEnabled('Undo') could always return
true, because there's no harm in trying to undo even when there's
nothing to undo.
execCommandEnabled is pointless unless it actually returns a useful
value as to if it's going to do something.
More information about the whatwg