[whatwg] [editing] queryCommand(Indeterm|State|Value) for commands where they make no sense
Ryosuke Niwa
rniwa at webkit.org
Mon Sep 19 10:50:47 PDT 2011
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
More information about the whatwg
mailing list