Is it onerror or onError?

T

test9991014

Hi,

I gather that Javascript standard function names are case sensitive
and they follow the old Smalltalk manner of applying case e.g.
thisName,
however I am curious, I see "onerror" mentioned on some web pages
which seems to contradict the standard. Or is it actually onError?

Thanks.
 
T

Thomas 'PointedEars' Lahn

I gather that Javascript standard function names are case sensitive and
they follow the old Smalltalk manner of applying case e.g. thisName,
however I am curious, I see "onerror" mentioned on some web pages which
seems to contradict the standard.

The ECMAScript Language Specification, which is the standard that JavaScript
and other implementations are based on, has nothing to say about the
expected case of user-defined identifiers, although its use of identifiers
starting with capital letter, among other PLs, for constructors, has become
a rule of thumb for Pretty Printing.

I suspect the camelCasing in JavaScript (since 1996 CE) and consequently
ECMAScript (since 1997 CE) was derived from Perl (since 1987 CE) and its
successors instead, although Smalltalk (since 1972 CE) maybe was the
language that introduced it.
Or is it actually onError?

`onerror' is a proprietary property of Window and Image host objects.
Neither is part of the JavaScript language anymore since version 1.4.


PointedEars
 
S

sasuke

Thomas said:
`onerror' is a proprietary property of Window and Image host objects.
Neither is part of the JavaScript language anymore since version 1.4.

So I guess we are only left with the exception handling (try..catch
blocks) when performing error handling since 'onerror` is no longer a
javascript standard.

Is Javascript language version different from the ECMA script
specification versions? Is there any way of knowing the implementation
version a user agent (browser) uses?
 
V

VK

Hi,

I gather that Javascript standard function names are case sensitive
and they follow the old Smalltalk manner of applying case e.g.
thisName,
however I am curious, I see "onerror" mentioned on some web pages
which seems to contradict the standard. Or is it actually onError?

Thanks.

HTML is case-insensitive: so are its tag names, so are tags' attribute
names. This way one may write
<BODY ONERROR="...
<body onerror="...
<BoDy OnErRoR="... etc.

There are some oftenly seen ways to use the case, say to capitalize
the name of the event, sometimes capitalize both "On" and the event
name though the latter is now considered as an old style of writing:
<body onError="... or <body OnError="...
HTML itself doesn't care, it is all the question of particular habits.
In the older school it was common to capitalize the opening tag but to
use lower case for the closing tag, plus to capitalize "On" and event
names, so by seeing a source like:
<BODY OnError="myFunction()">
<H1>Hello!</h1>
and similar one may assume that it is made by an old geezer (by the
Web's time scale) or by someone pretending to be such old geezer.

From the other side Javascript is a case-sensitive language,
respectively window.onerror, window.onError, window.ONERROR etc are
all different for it with only the first one having the same effect as
<body onerror=... and anything else just adding extra property to the
window object.

That means that from the practical point of view it is better to stick
to the lowercased version of event handler names: that will prevent
possible typos in your script, when say you are typing window.onLoad
because you have used to it in your body element - and then you cannot
understand why it doesn't work.

Of course it is not a rule of any kind - just a suggestion.
 
V

VK

`onerror' is a proprietary property of Window and Image host objects.
Neither is part of the JavaScript language anymore since version 1.4.

onerror event handler is an official documented part of JScript-DOM
interface since JScript 1.0 (IE 3.0)
http://msdn2.microsoft.com/en-us/library/cc197053(VS.85).aspx

onerror event handler is an official documented part of JavaScript-DOM
interface since JScript 1.0 (NN 2.0B)
http://developer.mozilla.org/en/docs/DOM:window.onerror

Please double check your sources.
 
T

Thomas 'PointedEars' Lahn

VK said:
onerror event handler is an official documented part of JScript-DOM
interface since JScript 1.0 (IE 3.0)
http://msdn2.microsoft.com/en-us/library/cc197053(VS.85).aspx

Nonsense. There is no "JScript-DOM interface". There is an MSHTML DOM
(colloquially called MS-DHTML) that can be accessed with JScript, among
other programming languages.
onerror event handler is an official documented part of JavaScript-DOM
interface since JScript 1.0 (NN 2.0B) ^^^^^^^^^^^^^^^^^^^^^
http://developer.mozilla.org/en/docs/DOM:window.onerror

Nonsense. First, Netscape never implemented JScript, it implements
JavaScript, of course. But, more important, there is no "JavaScript-DOM
interface". There is a Gecko DOM that can be accessed with JavaScript,
among other programming languages.
Please double check your sources.

My sources are as correct as are yours here, in fact they are pretty much
the same. You have just not understood that these sources describe DOM
APIs, which are independent of the respective programming language.

The programming languages you are referring to are described here, respectively:

http://msdn2.microsoft.com/en-us/library/hbxc2t98(VS.85).aspx
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference


PointedEars
 
V

VK

I just reminded you what was I correcting. "window" object and event
handlers were never a part of JavaScript language: this language
doesn't have internal IO tools to "communicate with the world". So
something that never was a part of the language cannot possible become
"not a part" on some stage later. That was a completely misleading
statement as such.

"window", "window.alert", "window.onerror" etc. are not DOM interfaces
neither unless you consider window.alert box or a runtime script error
as parts of document DOM tree :)
What they really are nobody knows including W3C, just say "host
object, its properties, methods and event handlers". They just are -
and they will be forever. The fact that they are not documented in
ECMAScript or W3C means nothing because indeed this topic is
completely out of competence of either one of both.
 
T

Thomas 'PointedEars' Lahn

VK said:
I just reminded you what was I correcting. "window" object and event
handlers were never a part of JavaScript language:

Wrong, they have been until including JavaScript 1.3:

http://docs.sun.com/source/816-6408-10/window.htm

I have pointed that out (to you) numerous times before.
[...]
"window", "window.alert", "window.onerror" etc. are not DOM interfaces
neither unless you consider window.alert box or a runtime script error
as parts of document DOM tree :)

In Mozilla/5.0-based user agents, the entire chrome is drawn by the layout
engine through XUL documents, so it is not unreasonable to call these
features of the Gecko DOM.

It is also debatable whether objects that can be referred to with the
document.defaultView property really do not belong to the document tree at all.

[snipped point-missing rant]
 
V

VK

VK said:
HTML is case-insensitive: [...]

Not per se:

http://www.w3.org/TR/html4/types.html#h-6.1

http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.1
"Element names are always case-insensitive."

http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2
"Attribute names are always case-insensitive."

This is all what relevant to the topic but again (http://
groups.google.com/group/comp.lang.javascript/msg/2c93334d643abbc2)
thank you for trying - though not always successfully - to be useful.
 
V

VK

Wrong, they have been until including JavaScript 1.3:

http://docs.sun.com/source/816-6408-10/window.htm

They have been part of browser producer documentation for using
JavaScript: because somewhere it had to be described, had it?
Later it was decided to move into DOM section by MDC volunteers but it
doesn't matter: window is not ECMAScript, window is not DOM - window
is window. It doesn't care of any authority because it has the entire
Web behind of it with billions of existing pages no one will dare to
break. This is why W3C once started "documenting window" but dropped
it: because soon they felt themselves in a stupid position of people
who are writing an instruction for sunrises and sunsets with say
strict demand to the Sun to appear on the east only and to follow to
the west. But even in their sketches never used the word "DOM":
http://www.w3.org/TR/Window/#introduction
 
T

Thomas 'PointedEars' Lahn

VK said:
They have been part of browser producer documentation for using
JavaScript: because somewhere it had to be described, had it?

Brendan Eich, formerly of Netscape Communications Corp., invented the
JavaScript programming language which was first implemented in Netscape
Navigator 2.0, and he maintains the development of JavaScript to date.

For brevity let us ignore the rest of your displaying your utter
incompetence again.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top