Speed Up Your Site: Web Site Optimization

Errata

Chapter 3

Page 54:

font-size: 1.1 em;

becomes:

font-size: 1.1em;

Page 57:

table.tr.right {...}

becomes:

table tr.right {...}

Since tr elements will always appear inside of table elements, the selector is overly specific here, and could be reduced to:

tr.right {...}

<img src="t.gif" width=1 height=1>

becomes:

<img src=t.gif width=1 height=1>

and this: <table width=100%>

would be clearer as:

<img src=images/t.gif width=10% height=10%>

and this:

"Values with spaces, symbols, or links require quotes in HTML. Example:"

becomes:

"Values with any other characters such as spaces, slashes, or ampersands require quotes in HTML. Example:"

Page 63:

<img src="t.gif" alt=""width="1" height="1">

becomes:

<img src="t.gif" alt="" width="1" height="1">

Chapter 5

Page 101:

<p><font style="arial, helvetica, sans-serif" size="3">Inline styled prose goes here. How do you change the font site-wide? </body> </html>

becomes:

<p><font style="arial, helvetica, sans-serif" size="3">Inline styled prose goes here. How do you change the font site-wide?</font> </body> </html>

Page 118:

<p align="right"><font size="+1" face="arial,helvetica,sans-serif" color="#333333">Overly specified paragraph text goes here.</p>

becomes:

<p align="right"><font size="+1" face="arial,helvetica,sans-serif" color="#333333">Overly specified paragraph text goes here.</font></p>

Chapter 7: CSS Optimization

Page 159:

Figure 7.2: The Netscape 4 box model has a missing border

Here's the correct figure

For the bottom two URLs on this page this:

url(http://domain.gif/b.gif)

becomes:

url(http://domain.com/b.gif)

Page 163:

72 dpi

becomes:

72 ppi

Chapter 9: Optimizing JavaScript for Download Speed

Page 205:

JSCruncher from Hoard's DOMAPI project

becomes:

JSCruncher from the DOMAPI project

Chapter 10: Optimizing JavaScript for Execution Speed

Page 219:

Strike the sentence "with also has been deprecated, so it is best avoided."

with is still in the ECMA JavaScript specification.

Page 228:

var serialData=new;
Array(-1,10,23...);

becomes:

var serialData=new
Array(-1,10,23...);

Page 232:

Listing 10.14 Flipped Loop with Optimized Reverse Count

As I mentioned in the text using the pre-decrement operator as a conditional in a while [while (--i);] assumes that i is a positive integer. For values of i less than or equal to zero an infinite loop would result. If you are not sure that i will be greater than zero you can surround the do-while loop with a check for i>0 like this:

function loopDoWhileReverse3() {
var i=iter;
if (i>0) { // make sure i is positive here
    do
    {
        // do something here
    }
    while (--i); // i must be greater than 0 here
}

Page 236:

Listing 10.18 Faster Duff's Device

Same fix as in listing 10.14. We assume when using the pre-decrement operator that n is positive. In this case with the division by eight, n must also be greater than or equal to 8. If you are not sure that the number of iterations will not equal or exceed the degree of unrolling you can surround the second do-while loop with a check for n>0 just like the first loop:

function duffFasterLoop8(iterations) {
	var testVal=0;	
    var n = iterations % 8;
    if(n>0) {
        do 
        {
            testVal++;
        }
        while (--n); // n must be greater than 0 here
    }
	
    n = parseInt(iterations / 8);
    if (n>0) { // note orig code assumed n >=unrolling degree
        do 
        {
            testVal++;
            testVal++;
            testVal++;
            testVal++;
            testVal++;
            testVal++;
            testVal++;
            testVal++;
        }
        while (--n); // n must be greater than 0 here
    } 	
}

Page 237:

Around seven statements,

becomes:

Around eight statements,

Chapter 13: Minimizing Multimedia

Page 304:

Table 13.1 QDX -> QDM

Chapter 17: Server-Side Techniques

Pages 87 and 401:

POST requires one HTTP request, not two