Browsers: The Very Basics – Part 2
One of the reasons that HTML standards are so important is because HTML is a language that has historically been written with a lot of errors and now has many different versions. One of the rules that has been generally agreed upon by browser makers is “don’t break the web”. This means that all new browser versions have to be able to work with all the older standards and handle errors in code in a meaningful way.
Another example is that a <form> nested inside a <form> will be ignored by webkit. Nesting 20+ of the same tags will cause all the tags above #20 to be ignored. (Apparently some crazy website for a Mexican private school, with a whole bunch of <b> tags. Thankfully I think they fired that guy and got a new one, because their website is pretty spiffy now.)
Web standards and semantic HTML will avoid most errors, but if you start to see strange things happening in the browser, make sure you check your code for mistakes. Of course, if we all comply to the standard rules, the browser developers don’t have to make as many decisions about how to handle different kinds of errors, and there will be less variation between browsers.
Disorder of operations:
Now Webkit and Firefox are nice folks (other wise known as if you want a feature, you can built it yourself or wait for someone else too) and they have done a little magic to skip through the DOM tree and try to grab the next required resources while the main parser is busy working on the DOM. It’s a handy feature, but it has its limitations. It will speed up your website’s loading time in comparison to a completely synchronous browser.
Style Sheets are a little different than everything else. They kinda stand alone, and in theory shouldn’t affect the DOM tree, but if you’re loading a script that needs something to be styled properly before it runs, and the browser runs it too soon, you can end up with all kinds of head aches. Basically most modern browsers refuse to load scripts until the CSS has been parsed (Firefox), or they refuse to run scripts that rely on properly rendered CSS (Webkit).