Builder demo errata
A reader just brought an issue with the book’s Builder demo (chapter 17) to my attention.
The code that ships with the demo essentially grabs code pieces from the page itself, where they are displayed in table cells, to run this code live and display its result. In doing so, it attempted to go the extra mile and strip single-line comments from the code before eval‘ing it; it isn’t mandatory, it just felt cleaner at the time.
However, the regular expression used b0rks on IE7. I’m surprised nobody alerted me to that in almost 7 months since the book’s final release…
To get it to work in IE7, simply strip the clean-up line from the code. That’s the following line:
code = code.replace(/^\s*\/\/.*$/mg, '');
This will work just fine on all browsers now.
Thanks to Bharat for the heads up!
No comments yet. Be the first.
Leave a reply



