On Oct 7, 12:34 pm, Tobie Langel <tobie.lan...@gmail.com> wrote:
>  > Sorry, but I don't follow the logic. What stops us from using
>
> > `getElement` with optional selector?
>
> That meant adding another method. We had chosen to avoid that.
> (Remember Event#findElement already existed).

We can add it in 2.0 which doesn't confine us much to existing API.

[...]

> > Even better would be to replace both - `element()` and `findElement()`
> > with `getTarget()` which would accept optional selector. It's shorter
> > and conveys intention better; it actually describes that it is event's
> > *target* that we are retrieving here, not just some vague *element*.
>
> I think Event#getTarget is ambiguous too, as we don't return the
> target node but the first node above it that's an Element.

Ok, that makes sense. I would then still go with `getElement`, rather
than `findElement` (if we are introducing it in backwards-incompatible
2.0).

>
> > What do you think?
>
> As I said in my previous comment, worth discussing in the context of
> Sam's upcoming work on Element#on.

Could you expand on this? What's the idea behind Element#on?

>
> FWIW, I'm not particularly sold on the name of Event#findElement
> myself, but it happened to be already part of the API.

Does `getElement()` sound like a good replacement for `element()` and
`findElement()`? Still, if we have a chance to change name to
something more descriptive in upcoming 2.0, what's the point of
deprecating `element` at this point? First, people will start using
`findElement` instead of `element()`, and then they'll be forced to
switch to other name again (I'm assuming there will be another name,
since `findElement` doesn't seem like the best we can come up with).

Or am I missing something?

>
> It made sense to extend it for the reasons I explained above. And it's
> unquestionably much better than Event#element.

Agreed. `element()` didn't quite follow convention.

--
kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to