How does this code run? This is using jQuery to use JS to run CSS. For times when JS is off. Works perfect. It adds the class .js-on to the html if js in on. My question is this? I want to place all this code at the bottom of the page. I was surprised it works this way. Does the browser have to travel all the way back up to find the html tag (thus slowing it down?) or does it work different. I have 5 different ways to do this. I'm looking for the fastest. This way is clean because I already have jquery library on the page. Thanks.
Reason being I have a large photo gallery that needs to load and I don't want any extra markup slowing it down.
I suggest then that you create a demo page for each of the six techniques, so that we can then help you come up with some timings for each of those techniques and also figure out certain pros and cons of each technique that you may want to stay aware of.
Well I set up some test pages. But each time I run them it is a different number. So that's no help it seems.[/QUOTE]
Where do you have those test pages?
Originally Posted by EricWatson
You honestly don't know what the js engine does in that circumstance?
There is no single JS engine. We browsers all have their own different engines with different performance metrics, so the microseconds that one technique might have over another aren't as important as the time it takes for you to manage and maintain and understand whichever technique that you end up deciding to go with.