Is it onerror or onError?

Discussion in 'Javascript' started by test9991014@yahoo.com, Mar 21, 2008.

  1. Guest

    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.
    , Mar 21, 2008
    #1
    1. Advertising

  2. wrote:
    > 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
    --
    realism: HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness: XHTML 1.1 as application/xhtml+xml
    -- Bjoern Hoehrmann
    Thomas 'PointedEars' Lahn, Mar 21, 2008
    #2
    1. Advertising

  3. sasuke Guest

    Thomas 'PointedEars' Lahn wrote:
    > > 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.


    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?
    sasuke, Mar 22, 2008
    #3
  4. VK Guest

    On Mar 21, 9:41 pm, wrote:
    > 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.
    VK, Mar 22, 2008
    #4
  5. VK Guest

    On Mar 21, 10:14 pm, Thomas 'PointedEars' Lahn <>
    wrote:
    > `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.
    VK, Mar 22, 2008
    #5
  6. VK wrote:
    > [...] Thomas 'PointedEars' Lahn [...] wrote:
    >> `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


    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
    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
    Thomas 'PointedEars' Lahn, Mar 22, 2008
    #6
  7. VK Guest

    On Mar 22, 7:35 pm, Thomas 'PointedEars' Lahn <>
    wrote:
    > >> `onerror' is a proprietary property of Window and Image host objects.
    > >> Neither is part of the JavaScript language anymore since version 1.4.


    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.
    VK, Mar 22, 2008
    #7
  8. VK wrote:
    > [...] Thomas 'PointedEars' Lahn [...] wrote:
    >>>> `onerror' is a proprietary property of Window and Image host objects.
    >>>> Neither is part of the JavaScript language anymore since version 1.4.

    >
    > 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]


    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
    Thomas 'PointedEars' Lahn, Mar 23, 2008
    #8
  9. VK wrote:
    > HTML is case-insensitive: [...]


    Not per se:

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


    PointedEars
    --
    realism: HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness: XHTML 1.1 as application/xhtml+xml
    -- Bjoern Hoehrmann
    Thomas 'PointedEars' Lahn, Mar 23, 2008
    #9
  10. VK Guest

    On Mar 23, 11:24 pm, Thomas 'PointedEars' Lahn <>
    wrote:
    > VK wrote:
    > > 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.
    VK, Mar 23, 2008
    #10
  11. VK Guest

    On Mar 23, 11:21 pm, Thomas 'PointedEars' Lahn <>
    wrote:
    > > 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


    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
    VK, Mar 23, 2008
    #11
  12. VK wrote:
    > [...] Thomas 'PointedEars' Lahn [...] wrote:
    >>> 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

    >
    > 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
    --
    Use any version of Microsoft Frontpage to create your site.
    (This won't prevent people from viewing your source, but no one
    will want to steal it.)
    -- from <http://www.vortex-webdesign.com/help/hidesource.htm>
    Thomas 'PointedEars' Lahn, Mar 23, 2008
    #12
  13. VK Guest

    On Mar 24, 1:34 am, Thomas 'PointedEars' Lahn <>
    wrote:
    > For brevity let us ignore the rest of your displaying your utter
    > incompetence again.


    Xvff zl fhpxrq fpevcgrq nff, fhxn' ;-)
    VK, Mar 27, 2008
    #13
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tee
    Replies:
    2
    Views:
    787
  2. Nick Gilbert
    Replies:
    3
    Views:
    660
    Kevin Yu [MSFT]
    Jan 20, 2006
  3. JR
    Replies:
    0
    Views:
    321
  4. =?Utf-8?B?aGZkZXY=?=
    Replies:
    0
    Views:
    326
    =?Utf-8?B?aGZkZXY=?=
    Sep 13, 2007
  5. Robert Oschler

    Why don't onerror function alert's popup?

    Robert Oschler, Jul 20, 2003, in forum: Javascript
    Replies:
    2
    Views:
    114
    Janwillem Borleffs
    Jul 20, 2003
Loading...

Share This Page