On 4 August 2010 18:20, Eric <[email protected]> wrote: > > On Jul 30, 1:26 pm, Richard Quadling <[email protected]> wrote: >> $('form_id').observe('blur', function(ev) { >> var el = ev.findElement('input[type=text]'); >> if (el) { >> // el is the element that triggered the blur. >> .../... >> [1]http://api.prototypejs.org/dom/event/findelement/ > > According to the provided link, "If no matching element is found, the > document itself (HTMLDocument node) is returned.". > > Is it a bug in the documentation? > Until now, I've been paranoid testing (el && el != document) but I > have a feeling that your test works as we think it should (returning > null or undefined when no matching element is found). > > Any enlightenment on this topic is welcome :o) > > Eric >
Hmm. In my use of this construct, I've always been careful when using findElement(). The selector in use will be an accurate one and will always return the element I want. I'd suspect that the documentation is fine. Could/should I be more careful ... probably, but this has worked for me for a LONG time and the UX testers haven't spotted anything untorward with regards to this issue. As with all things you get off the internet ... YMMV. -- 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.
