Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #26635

Re: quick question: how to dynamically an image source file?

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: quick question: how to dynamically an image source file?
Date 2015-01-20 20:47 +0100
Organization PointedEars Software (PES)
Message-ID <1700346.v8gcEl1x6g@PointedEars.de> (permalink)
References (2 earlier) <m9iue0$bah$1@speranza.aioe.org> <6abe327d-c487-4e03-8a6f-f7f65ebc8bb0@googlegroups.com> <14epavonqlnzl.2wklfi1o8grp.dlg@40tude.net> <1894285.eRrXKrdmPT@PointedEars.de> <200120151452134066%timstreater@greenbee.net>

Show all headers | View raw


Tim Streater wrote:

> […] Thomas 'PointedEars' Lahn […] wrote:
>>If the last object in the scope chain still does not have such a property,
>>execution does _not_ simply fail.  Instead, a ReferenceError exception is
>>thrown at the line of the originating code [4] which can be caught in the
>>respective execution context and calling execution contexts [5] by a try–
>>catch(–finally) statement [6].
> 
> Personally I'd be more inclined to use window.onerror so that I don't
> have to put try/catch around every statement in my program.

Your logic is flawed.  You do not “have to” and you SHOULD NOT “put 
try/catch around *every* statement in your program” because the result would 
be a maintenance nightmare.

By contrast to “try–catch(–finally)”, “window.onerror” is a blunt, 
unreliable instrument that was standardized only recently (with HTML5) [1]
[2].  It cannot be used to handle standard exceptions thrown by 
implementations of Specification algorithms, and not outside an HTML UA.
If you must use it, use it only as a last resort.

_______
[1] <https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers.onerror>
[2] <http://www.w3.org/TR/html5/webappapis.html#runtime-script-errors>

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

quick question: how to dynamically an image source file? justaguy <lichunshen84@gmail.com> - 2015-01-18 19:39 -0800
  Re: quick question: how to dynamically an image source file? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-01-19 11:20 +0100
    Re: quick question: how to dynamically an image source file? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-01-19 10:48 -0200
      Re: quick question: how to dynamically an image source file? justaguy <lichunshen84@gmail.com> - 2015-01-19 07:52 -0800
        Re: quick question: how to dynamically an image source file? JJ <jj4public@vfemail.net> - 2015-01-20 02:47 +0700
          Re: quick question: how to dynamically an image source file? justaguy <lichunshen84@gmail.com> - 2015-01-19 14:24 -0800
            Re: quick question: how to dynamically an image source file? JJ <jj4public@vfemail.net> - 2015-01-20 07:31 +0700
              Re: quick question: how to dynamically an image source file? justaguy <lichunshen84@gmail.com> - 2015-01-20 02:26 -0800
            Re: quick question: how to dynamically an image source file? Tim Streater <timstreater@greenbee.net> - 2015-01-20 12:08 +0000
              Re: quick question: how to dynamically an image source file? justaguy <lichunshen84@gmail.com> - 2015-01-20 12:20 -0800
          Re: quick question: how to dynamically an image source file? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-20 14:06 +0100
            Re: quick question: how to dynamically an image source file? Tim Streater <timstreater@greenbee.net> - 2015-01-20 14:52 +0000
              Re: quick question: how to dynamically an image source file? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-20 20:47 +0100
        Re: quick question: how to dynamically an image source file? Denis McMahon <denismfmcmahon@gmail.com> - 2015-01-19 21:15 +0000
          Re: quick question: how to dynamically an image source file? justaguy <lichunshen84@gmail.com> - 2015-01-19 14:25 -0800

csiph-web