ecaroth (1) [Avatar] Offline
#1
Love the book so far, found some errors though!
All occur in isCssReady function on page 37

"testElem.class" should be "testElem.className"
"node.currentStyle" should be "testElem.currentStyle" (in 2 places)

Additionally, other than just syntax errors, using color as the css property to check does not work because when using getPropertyValue in standards-compliant browsers the rgb value of the color is returned. Something that I use which works cross browser, and you don't have to worry about accidentally cascading down from parent elements is font-family.

EG:
.css-ready{ font-family: css_is_ready}

then value === 'css_is_ready' in the JS
benvinegar (68) [Avatar] Offline
#2
Re: Multiple syntax and functional errors found, please note
Hey Evan,

Thanks for pointing this out - looks like a huge oversight on my part. Will fix asap.

As an aside, I'm also moving this section (loading CSS files) to another chapter (on rendering), as I feel it's more appropriate content there.

- Ben
jugglinmike (4) [Avatar] Offline
#3
Re: Multiple syntax and functional errors found, please note
The "value" variable should be declared at the beginning of the anonymous function to prevent leaking into the global namespace.

Also, would it be preferable to used a named self-executing function so that you aren't reliant on the deprecated arguments.callee?
benvinegar (68) [Avatar] Offline
#4
Re: Multiple syntax and functional errors found, please note
Yep, you're right on both counts.

As an aside, we're pushing a quick update to the PDF this week which will address the broken examples you guys pointed out, but otherwise doesn't make any changes (the text is the same).