On Dec 1, 2008, at 11:01 PM, kangax wrote:
>> This behaves the way you would want it to -- so fast that the change
>> doesn't register until the list starts getting very short.
>
> I think something along these lines could be faster:
>
> document.observe("dom:loaded", function() {
>
> var list = $$("#listAll li");
> var lastValue = $F("filter");
>
> $('filter').observe('keyup', function(e) {
> var value = this.value;
> if (value !== lastValue) {
> value = value.toLowerCase();
> list.each(function(el) {
> if (el.innerHTML.toLowerCase().include(value)) {
> Element.show(el);
> }
> else {
> Element.hide(el);
> }
> })
> lastValue = value;
> }
> })
> })
Thanks very much, I'll give this a try. I can see where your shortcuts
are, and they make a lot of sense.
Walter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" 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-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---