The Better way
By now, we are all using some compiler to compile your code. Right? If you haven’t started, grab the Closure Compiler to follow through on this example.
- Download the latest Closure Compiler http://closure-compiler.googlecode.com/files/compiler-latest.zip
- Copy the compiler.jar file into your directory with the JS Files.
- follow along below and enjoy!
Question: Image – inline Script – image, are the images parallel?
Souders just posted the following tweet.
Someone out in #webperf land should test how inline scripts block downloads – eg, image – inline script – image – are the images parallel?
So here is my response to the question…
In the 3rd chapter, Literals and Constructors, I noticed this section on “Patterns for enforcing new” with the following entry:
When your constructor has something like this.member and you invoke the constructor without new, you’re actually creating a new property of the global object called member and accessible through window.member or simply member. This behavior is highly undesirable, because you know you should always strive for keeping the global namespace clean.
As the guys over at Underscore.js put it:
Underscore.js uses the built in functions if they exist, and if they don’t falls back to its own version. Since there are only a few browsers that currently support ECMAScript 5, it allows us to use these functions even on older browsers. Now, not only can we start using those constructs before they are officially supported in the browsers, but as soon as they become available underscore.js will get out of the way.
*quick note: I originally posted this on trulyevil.com. However its time to move sites and actually keep something up and running for a while.
Events seem daunting at first, but really jQuery makes them super simple. Events can be used to alter behavior or even have multiple events happen on a single state change.
We all know about events like click, onkeydown, onmousedown, onmouseover, etc. But you can fire custom events as well. First you need to understand how to fire events. You can do this by using the $().trigger() event through jQuery.