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

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

From: Aryeh Gregor <ayg@aryeh.name>
Date: Mon, 19 Sep 2011 13:45:36 -0400
Message-ID: <CAKA+Ax=BuO4jxdzObBHgHFE-c++w4HfS+EAFOikwL_XvG2byag@mail.gmail.com>
On Mon, Sep 19, 2011 at 12:37 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
> Not throwing makes sense to me (at least for now). What value should they
> return though?

State/indeterm should return false, value should return "".  For
state/indeterm, this is what IE/WebKit/Opera do (Gecko throws).  For
value, it's what Gecko/Opera do; IE and WebKit return boolean false,
but that's the wrong type.  "" and false are equal anyway if you don't
use ===, so I don't think it will be a compat problem to switch from
false to "".

For the value of commands like bold that take a state, I'm going to
say return "" always.  This might not be compatible for everyone, but
we have four different behaviors here: IE returns true or false, Gecko
throws, WebKit returns "true" or "false", Opera returns "" always.  So
it's going to have to be incompatible with someone.  I don't like
WebKit's behavior because returning "false" is very confusing (it
evaluates to boolean true), I don't like IE's behavior because it
returns a boolean instead of a string, I don't like Gecko's because it
throws.  So in this case I think we should be like Opera, and make the
value behave like in other cases where it doesn't make sense.  That's
the most consistent path.
Received on Monday, 19 September 2011 10:45:36 UTC

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