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

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

From: Ryosuke Niwa <rniwa@webkit.org>
Date: Mon, 19 Sep 2011 10:50:47 -0700
Message-ID: <CABNRm62V5aLqhm9PYv_SUy7z-VrJ3q+_0poyf=d_bLKO0UTNpg@mail.gmail.com>
On Mon, Sep 19, 2011 at 10:45 AM, Aryeh Gregor <ayg at aryeh.name> wrote:
>
> 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.
>

Sounds like a reasonable solution to me.  For what's worth, I think WebKit
used to return false all the time so I don't think this will cause a huge
compat. issue for us.

- Ryosuke
Received on Monday, 19 September 2011 10:50:47 UTC

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