Hi there,
I am using the JavaScript prototype library
(http://prototype.conio.net/) and want to check if the library is
running properly, because javascript prototype is not supported by IE
versions older than IE 6 (see
http://wiki.osafoundation.org/bin/view/Projects/AjaxLibraries).
What is the best way to check, if prototype is running correctly?
Regards
Reinhold
|
|
0
|
|
|
|
Reply
|
resch25 (4)
|
5/5/2006 9:26:41 AM |
|
Reinhold Schrecker wrote:
> What is the best way to check, if prototype is running correctly?
prototype.js has its own author you should address your question to.
On an abstract level: "How to check that an external library loaded and
parsed properly?" you could choose some representative object from that
library and check its type.
if ("undefined" != typeof $) {
// prototype.js seems loaded OK
}
|
|
0
|
|
|
|
Reply
|
VK
|
5/5/2006 10:10:58 AM
|
|
Reinhold Schrecker wrote:
> I am using the JavaScript prototype library
> (http://prototype.conio.net/)
My sincere condolences.
> and want to check if the library is running properly, because javascript
> prototype is not supported by IE versions older than IE 6 (see
> http://wiki.osafoundation.org/bin/view/Projects/AjaxLibraries).
That is an understatement. Prototype.js is much more restricted to certain
browsers than you think. Which is one of its many flaws.
It is possible to rewrite that code so that it runs with a wider spectrum
of HTML user agents, following design guidelines laid out in numerous
discussions in this newsgroup, and programming along the version
information known for each language feature[1]. However, I'd rather
rewrite it from scratch than to attempt to correct this junk.
> What is the best way to check, if prototype is running correctly?
Always test the return values.[2] (With a `typeof' test you can only test
that a certain variable does not have the `undefined' value; it does not
test that the code invoked by calling that variable as a method will run
correctly. Incidentally, you should not trust anything VK is proposing.)
PointedEars
___________
[1] <URL:http://pointedears.de/es-matrix/>
[2] <URL:http://pointedears.de/scripts/test/whatami#inference>
--
There are two possibilities: Either we are alone in the
universe or we are not. Both are equally terrifying.
-- Arthur C. Clarke
|
|
0
|
|
|
|
Reply
|
Thomas
|
5/17/2006 12:06:20 PM
|
|