Hi Everybody!!!
I found out an strange behaviour on my ajax requests, after I updated
my web browser to Firefox 4.
I'm really newbie using Javascript & Mootools, so don´t be too hard on
me is the question is a stupid one :).
Environment:
Mootools Core: 1.3.2 & 1.3.1
Brower: Firefox 3.x and 4.0.1
I have a page, were I use a Mootools Request object to send an html
get request to the server, and then, it loads the content returned in
the response into a div (evaluating the inline scripts returned into
the html code).
This is an snippet of the js code embebed into the html response:
window.addEvent('domready',function() {
$$('#a_link_with_this_id').addEvent('click',function(event) {
event.stop();
/* ... some code here ...*/
});
});
These code works ok on Firefox 3.x, but it stopped working in firefox
4 (it can't find the link with id a_link_with_this_id, which is an
element of the html ajax request, even though firefox 3 find it
without any problem) .
After my little investigation using firebug, I got an idea about where
the crash happens.
On the DomReady event, it crashs in the next lines:
Element.Events.domready = {
onAdd: function(fn){
if (ready) fn.call(this);
}
because ready is true (so it calls the function $$
('#a_link_with_this_id').addEvent()), but the html code from the ajax
request isn´t loaded yet.
I imagine that firefox 4 changed anything about how it manages the dom
statuses, so my question is:
can I do anything to solve this problem?
Thanks so much in advance.