I can't answer for the first, but I believe the 10ms wait is in some way 
related to the fact that not all browsers update the DOM immediately after an 
innerHTML assignment.

The timeout is probably just giving time for that update to happen.



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Peter
Michaux
Sent: Friday, July 21, 2006 10:07 AM
To: rails-spinoffs@lists.rubyonrails.org
Subject: [Rails-spinoffs] Prototype.js strips scripts before innerHTML


Hi,

I have been spending a lot of time reading Prototype.js. Because there
are no comments, I don't understand the rational for why it is doing a
few things. Two things are in Element.update

  update: function(element, html) {
    $(element).innerHTML = html.stripScripts();
    setTimeout(function() {html.evalScripts()}, 10);
  },


Why strip the scripts before inserting? Is this only for NS6 browser support?

Why wait 10 ms before evaluating the scripts?

Thanks,
Peter
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to