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

[whatwg] Feedback on UndoManager spec

From: Ryosuke Niwa <rniwa@webkit.org>
Date: Sat, 26 Nov 2011 16:41:53 -0800
Message-ID: <CABNRm62ZZOVabGMdtVh1ra52iNvBZ66-0BrHi1K92+OmHXXXbw@mail.gmail.com>
Calling apply, unapply, and reapply methods for automatic DOM transaction
poses a problem if we merge apply and reapply because now whenever you
define an automatic transaction, you'd have to check the argument and bail
out as needed:
editor.undoManager.transact({apply: function (isReapply) {
    if (isReapply)
        return;
    ...
}, isAutomatic: true});

as supposed to:

editor.undoManager.transact({apply: function (isReapply) {
    ...
}, isAutomatic: true});

This is strictly worse than having apply, unapply and reapply methods. UA
now makes a call to apply on reapply even though the author isn't going to
do anything, and the author has to manually check the argument in very
simple case where he/she wants the UA to take care of everything.

- Ryosuke

On Fri, Oct 28, 2011 at 1:31 PM, Jonas Sicking <jonas at sicking.cc> wrote:

> On Fri, Oct 28, 2011 at 12:20 PM, Aryeh Gregor <ayg at aryeh.name> wrote:
> > On Fri, Oct 28, 2011 at 2:47 PM, Ojan Vafai <ojan at chromium.org> wrote:
> >> On Fri, Oct 28, 2011 at 11:36 AM, Aryeh Gregor <ayg at aryeh.name> wrote:
> >>> It's a few extra characters.  I really think the increase in clarity
> >>> is worth it.  Boolean parameters are much more confusing, and should
> >>> be avoided wherever possible.
> >>
> >> +1. I'm also OK with the argument if it's a string.
> >
> > Jonas?
>
> I'm ok with the string argument too. But I'm also fine with keeping it
> a boolean. I don't really see the risk that people will use the wrong
> interpretation of the boolean and that that wrong impression would
> spread through copy-past as being a very real risk.
>
> I agree boolean arguments can be a pain. But they are more of a pain
> on the caller side than on the callee side.
>
> / Jonas
>
Received on Saturday, 26 November 2011 16:41:53 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:09 UTC