W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2008

[whatwg] HTML 5 - comments on 5.6 Command APIs

From: Tom Gilder <tom@tom.me.uk>
Date: Tue, 11 Mar 2008 19:31:34 +0000
Message-ID: <746baa540803111231k78394710o111a77036532814d@mail.gmail.com>
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.


Tom
Received on Tuesday, 11 March 2008 12:31:34 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:40 UTC