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

Aryeh Gregor ayg at aryeh.name
Mon Sep 19 10:45:36 PDT 2011

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.

More information about the whatwg mailing list