MochiKit is wonderful, as you wrote ir, but is the base, you can made
too much things, but you may need read or investigate some more time
like jQuery.

I prefer call it domready, because it is when dom nodes are loaded, i
use this code to implement domready, and i not have any problem.

[code]
var __domready__ = false;
if (document.addEventListener)
        document.addEventListener("DOMContentLoaded", function() { if(!
__domready__) { __domready__ = true; window.signal(window,
'ondomready') }; }, false);

/[EMAIL PROTECTED] @*/
/[EMAIL PROTECTED] (@_win32)
    document.write("<script id=__ie_onload defer
src=javascript:void(0)><\/script>");
    document.getElementById("__ie_onload").onreadystatechange =
function() {
        if (this.readyState == "complete") {
                signal(window, 'ondomready');
        }
    };
/[EMAIL PROTECTED] @*/

if (/WebKit/i.test(navigator.userAgent)) {
  var __domready__timer__ = setInterval(function() {
    if (/loaded|complete/.test(document.readyState)) signal(window,
'ondomready');
    clearInterval(ctimer);
  }, 10);
}
[/code]

and when i need to call them i use

[code]
connect(window, 'ondomready', function () {
      alert('now i know kung fu');
});
[/code]


Felipe Alcacibar Buccioni
Developer of systems and solutions

On 6 mayo, 17:47, machineghost <[EMAIL PROTECTED]> wrote:
> Hey All,
>
> In trying to explain why he liked jQuery, a co-worker of mine clued me
> in to a fairly cool method in that library: "ready(someFunc);".  For
> those who aren't familiar with jQuery, you can think of this method as
> something like:
> partial(connect, document, "DOMContentLoaded")
>
> In other word, it connects the provided function to the
> "DOMContentLoaded" document event.  Now, the specific jQuery syntax I
> could care less about (with partial I can already make any "connect"
> variant I want), but what is really cool about the function is that it
> makes it really easy to use the "DOMContentLoaded" event.  And why is
> that cool?
>
> 1) The "DOMContentLoaded" event fires sooner (and if you have a heavy
> page, MUCH sooner) than the "onLoad" event (although you can't do
> stuff that depends on the rendered DOM, like getElementDimensions,
> until "onLoad" goes off).  As a result, you can get significant
> performance improvements just by changing (most of) your "onLoad" code
> to be "onDOMContentLoaded" code.
>
> 2) Internet Explorer doesn't support "DOMContentLoaded" :-(  Luckily
> however, this guy:http://javascript.nwbox.com/IEContentLoaded/
> figured out a hack to emulate the event in IE.  When you call
> "ready(someFunc)", behind the scenes JQuery handles figuring out
> whether to use the hack or the real event.
>
> Now, I don't have any desire to switch to jQuery; it has the same
> basic stuff as Mochikit, but none of the wonderful advanced stuff like
> partial, keys, etc.  I would however like to have access to this
> "fake" event.  Am I alone in this, or would others on this list like
> to see a synthesized Mochikit "DOMContentLoaded" event (similar to the
> existing synthesized "onmouseenter" and "onmouseleave" events)?
>
> If there is interest in this event I'll be happy to help write a
> proper Mochikit patch, but if not I'll just steal (quick and dirty
> style) the jQuery event for my own purposes.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" 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/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to