Re: [DOM Level 3 Events] optionality of the capture argument in addEventListener/removeEventListener

On 10/04/2010 08:31 AM, Garrett Smith wrote:
> On 10/3/10, Olli Pettay<Olli.Pettay@helsinki.fi>  wrote:
>> On 10/01/2010 08:20 PM, Ojan Vafai wrote:
>>> On Wed, Sep 29, 2010 at 8:31 PM, Jonas Sicking<jonas@sicking.cc>  wrote:
>>>
>>>      On Wed, Sep 29, 2010 at 10:04 AM, Olli Pettay
>>>      <Olli.Pettay@helsinki.fi<mailto:Olli.Pettay@helsinki.fi>>  wrote:
>>>       >  I don't support this kind of change.
>>>       >  It happens way too often that people don't think about the phase,
>>>      and that
>>>       >  leads to bugs.
>>>
>>>      I don't think requiring the last argument is helping a whole lot with
>>>      that right now. I've heard multiple times developers say:
>>>
>>>      "I don't know why I have to specify the last 'false' value, but I have
>>>      to do that everywhere when I call addEventListener".
>>>
>>>
>>> In addition to this, I've seen many developers toggle the boolean value
>>> because it happened to fix a specific bug without understanding why (and
>>> it usually caused other bugs). Forcing people to use the boolean is not
>>> synonymous with forcing them to understand it.
>>>
>
> You can expect that that unskilled developers, given a badly designed
> API and not enough time to learn on the job, will do just that.
>
> Have ever I mentioned how much I love boolean parameters?
>
>>> Ojan
>>
>> But effectively removing the parameter means that even
>> fewer web developers understand DOM propagation model in the future,
>> I believe.
>>
> Read carefully. The proposal was to make the useCapture parameter
> optional; not to remove it.
I said "effectively removing", and I mean that people would just
not use the the last parameter and possibly quickly
forget that there is such thing and even fewer developers
would actually know how event propagation works.
And yet the event propagation model is quite useful when
used properly.


-Olli


>
> How much did the useCapture parameter being mandatory do much to help
> developers understand its implications? If they're fiddling with
> toggling it back and forth to fix a bug without understanding why
> they're doing that, wouldn't it be perfectly fair to say that there is
> no evidence that the useCapture parameter helped developer
> understanding?
>
> The capture phase is confusing and representing it with a boolean
> argument doesn't help that.
>
> Making the useCapture parameter optional will not reduce understanding
> of the capture phase.
>
> Garrett
>

Received on Monday, 4 October 2010 14:37:14 UTC