Re: [PHP] Re: A Little Something.
[email protected] (Stut)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
On 13 May 2008, at 10:32, Robin Vickery wrote: > 2008/5/13 Stut <[email protected]>: >> On 13 May 2008, at 09:04, Peter Ford wrote: >> >>> I think the onus is on the coders of Urchin to document how to avoid >> errors when Javascript is disabled, not the site developer who uses >> it. >>> >> >> Just to repeat a point I made yesterday which was clearly either >> misunderstood or ignored... Urchin *will not* cause Javascript >> errors if >> Javascript is disabled. Odd though it may seem, it's actually not >> possible >> to write Javascript code that will cause Javascript errors if >> Javascript is >> disabled. >> >> If you choose to use an addon that disables some Javascript but not >> all of >> it you need to be willing to live with the errors that may cause. > > While I completely agree with everything you say there, I do think > there is a > point to the other side side of the argument as well; It *is* sloppy > practice to > assume that some resource has already been initialised without > checking, > especially when you're relying on a third-party script. I agree to a certain extend, but the Javascript spec specifies that it's executed in the order it's found on the page. So if you include an external file before calling the code it contains it's perfectly acceptable to assume that code has already been included, parsed and is available to you. Given that fact, checking for the existence of such things is a waste of CPU cycles, something that Javascript developers should never assume are available in abundance. -Stut -- http://stut.net/