W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2011

[whatwg] [editing] queryCommand(Indeterm|State|Value) for commands where they make no sense

From: Ehsan Akhgari <ehsan@mozilla.com>
Date: Thu, 15 Sep 2011 18:02:19 -0400
Message-ID: <4E7275EB.2090809@mozilla.com>
On 11-09-15 4:39 PM, Aryeh Gregor wrote:
> I think the exception-throwing behavior is preferable in principle,
> but for compat, I suspect the right behavior is to always return
> boolean false for state and indeterm, and "" for value.  This
> basically matches everyone but Gecko for commands where none of them
> make sense, and matches Gecko/Opera for the value of commands where
> only state makes sense.  Throwing doesn't match anyone except Gecko,
> and then only in some cases.  If others agree, I'll change the spec
> and tests accordingly.

With my Gecko hat off (honesly, without having investigated, I think the 
reason that Gecko throws in some of these cases are just bugs!), I hate 
APIs which return dummy values and hide the authors mistake in that way. 
  I think now's our chance to improve things here.

But I do agree that web-compat is something which we need to address 
here.  However, I think that's going to be a general risk with the new 
spec.  There are things which don't have a clear-cut answer, where 
existing implementations do things differently, and nobody knows why. 
For those cases, the web-compat concern is really tricky to address. 
But there are cases where implementations are doing something which 
doesn't make sense at all in response to the author doing something 
which doesn't make sense at all.  No matter what the implementation 
does, the content script is doing something wrong.  I find the position 
of refusing such invalid requests very defendable, and I would be quite 
willing to change Gecko's behavior like that in the near future.

Speaking pragmatically, I've never seen a bug report in Mozilla where 
somebody asks why does Gecko do this when I do this thing which doesn't 
make sense in the first place.  So my educated guess is that this is not 
going to break a lot of existing websites anyway.

Cheers,
Ehsan
Received on Thursday, 15 September 2011 15:02:19 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:36 UTC