Summary
Right, that was quite a mouthful! We looked at quite a few things in this chapter.
The importance of resource placement on the DOM is often overlooked. It's true that placing scripts at the bottom of the page certainly improves performance, but it's also true that some scripts do need to load before the DOM renders (in the case of our example, to adjust the layout).
Using the technique of preloading content can be greatly helpful in improving the initial load of your site. The example showed a gallery that did not exist in the initial DOM render, but the preloaded images were appended into a gallery wrapper once they had been loaded. The great thing about this is that you can create informative feedback using a plugin such as createjs
.
DNS prefetching is a very helpful piece of code that can resolve the DNS name in the background for the site that your page might point to. Search engines can greatly benefit from this.
Showing and hiding elements might seem like a great idea...