On Feb 18, 1:00 pm, Tobie Langel <[email protected]> wrote:
> Form#present checks for a falsy value. So that wouldn't be appropriate
> for select elements. consider the following:

Actually, right now it checks for an empty string and so doesn't catch
IE's falsy `null`:

...
present: function(element) {
  return $(element).value != '';
},
...

>
> <select>
>     <option value="">empty string</option>
> </select>
>
> I know this is an edge case, but I think we should still guard against
> it.
>
> I suspect the best solution would be to check that selectedIndex > -1

Seems reasonable.

[snip]

> Maybe the API should reflect this, too. What about a: hasValue
> method ?

`hasValue` as a replacement to `present` or as a wrapper around
`getValue().empty()`? In general, I'm not excited about adding another
method until we introduce wrappers.

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

Reply via email to