On Aug 10, 9:17 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> So my original code sample was based on my application, which happened
> to use bindAsEventListener(). I didn't know if that was potentially
> causing a major problem in IE6, but I still don't feel like I have a
> great solution to the problem. The problem isn't especially due to the
> DOM creation, I just did that to try it out (again, cool). Not being
> at a computer with IE6, I can't see if my new test is faster than I
> originally said, but there still is a *serious* slowdown when I do
> Event.observe on IE6, and I'm not sure how to improve it.
Then don't use Event.observe. It's really only necessary when you
want to add more than one handler to a particular intrinsic event.
Your original example could be:
function changeColour(){
this.style.backgroundColor = '#00FF00';
}
function doEeet() {
var startTime = new Date();
var i = 4000;
var body = document.body;
while (i--) {
var el = document.createElement("div");
el.className = "dot";
el.onmouseover = changeColour;
body.appendChild(el);
}
el = null;
$('totalTime').innerHTML = new Date() - startTime + ' ms';
}
doEeet();
Which runs in IE 6 about 3 times faster than Firefox (for me, about
170ms versus 630ms).
> This is still a bit rough, but my code is here if you want to see the
> exact example:
>
> http://stage.whypaysticker.com/showroom/
>
> Lines 744 - 755 of controller.js are the Event.observe calls (I was
> trying to replace them, hence the comments). I've been working on this
> for some time, but I'd love some senior feedback.
Why on earth do you add a reset button to a form by adding a plain
button, then using script to call the form's reset method?
Replace all those individual events with one single event that detects
the element clicked on and acts accordingly.
--
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---