Between the feedback on this list and the feedback I got offline (one
"Oh god, yes." email) it seems that there definitely is an interest
for an "ondomready" synthesized event. As soon as I can find the time
I'll try to combine Felipe's version (tweaked as per Per's comment)
with jQuery's (to cover any browser cases Felipe's version doesn't)
and post the result to this list.
However, I do have one concern. It seems pretty clear that this
method is going to have to use a certain amount of browser detection
to work (well, browser detection sucks, so I'll try to implement it as
feature detection, but it will amount to the same thing). Currently
the only browser/feature detection I know of in Mochikit is
Mochikit.Signal's hidden _browserAlreadyHasMouseEnterAndLeave function
(which doesn't actually check for either of those events; it just
checks whether the UA string has MSIE in it).
So I COULD just create a few more methods like
_browserAlreadyHasMouseEnterAndLeave to make "ondomready" work, OR I
could add "real" browser detection functionality to Mochikit.
Personally, I think the latter approach is better (it gives Mochikit
more tools, and makes any future browser-dependent coding easier), but
then again Bob et. all might have reasons for wanting to keep that
sort of thing out of Mochikit.
If there is support for "real" browser detect functions (as opposed to
hidden ones that are only used within Mochikit), I'd almost certainly
startwith PPK's browser detector:
http://www.quirksmode.org/js/detect.html
Thoughts?
Jeremy
On May 6, 10:58 pm, "Bob Ippolito" <
b...@redivi.com> wrote:
> This would definitely be convenient, it's always been on my list and
> I've hacked together crappy (polling) implementations once or twice,
> but I never needed it bad enough to tackle all of the cross-browser
> issues myself :)
>
> On Tue, May 6, 2008 at 10:51 PM, Per Cederberg <
cederb...@gmail.com> wrote:
>
> > I liked the "ondomready" name and structure. Looking at MSDN, they
> > provide the following solution instead of writing new script tags into
> > the document (not tested, just pasted):
>
> > document.onreadystatechange=fnStartInit;
> > function fnStartInit()
> > {
> > if (document.readyState=="complete")
> > {
> > // Finish initialization.
> > }
> > }
>
> > Otherwise I like the proposed solutions and vote for inclusion to
> > MochiKit.Signal. Never know when it might be handy.
>
> > Cheers,
>
> > /Per
>