[Proto-Scripty] Re: A better way to check for an element.

2009-09-20 Thread Rick Waldron
Thats not to say that when() isn't pretty cool :) On Sun, Sep 20, 2009 at 9:00 AM, Rick Waldron wrote: > Mislav's when() seems a bit redundant when called inside of > document.observe('dom:loaded')... > > > I think this topic would be interesting to discuss in the the proto-dev > mailing list,

[Proto-Scripty] Re: A better way to check for an element.

2009-09-20 Thread Rick Waldron
Mislav's when() seems a bit redundant when called inside of document.observe('dom:loaded')... I think this topic would be interesting to discuss in the the proto-dev mailing list, ie. exceptions thrown for non-existant elements... i'd also like to see some kind of support for catching stupid codi

[Proto-Scripty] Re: A better way to check for an element.

2009-09-19 Thread Radoslav Stankov
You can use something like my CD3.Behavior lib ( http://github.com/RStankov/controldepo-3-widgets/blob/master/src/behaviors.js ) CD3.Behaviors({'#element:click': yourClickHandler }); // -- or -- CD3.Behaviors('#element', function(){ this.observe('click', yourClickHandler); }); // -- or ... CD3

[Proto-Scripty] Re: A better way to check for an element.

2009-09-18 Thread Rick Waldron
Its not much different, but this is what i do: if ( $('some_button') ) { $('some_button').observe('click', function (e) { //do stuff. }); } Ideally, i wish prototype was a bit more strict about this stuff... If you're using Firebug, you could replace your $() definition: function $(ele