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?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: quick question: how to dynamically an image source file?
Date Tue, 20 Jan 2015 20:47:40 +0100
Organization PointedEars Software (PES)
Lines 31
Message-ID <1700346.v8gcEl1x6g@PointedEars.de> (permalink)
References <9607d1f5-10c0-4703-901c-bab1932cb04a@googlegroups.com> <XnsA427734C3E58Ceejj99@194.109.133.133> <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>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace solani.org 1421783300 22692 eJwFwQkBwDAIA0BL4wtFTmDFv4TehUEw6Qh4bCzn1Dc81jOCzjZdXuwtdeENq+IvmiBXQ+oBMnMRjQ== (20 Jan 2015 19:48:20 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Tue, 20 Jan 2015 19:48:20 +0000 (UTC)
User-Agent KNode/4.14.2
X-User-ID eJwFwQERADEIAzBLcKzdkAN88S/hEwSdcw/Bg8VW0dF4yRnnWkb05/0kla2YRsjV3HtrmIdv08zYkZrsH2EDFdU=
Cancel-Lock sha1:OLbjcz2P+9Sb2wI0hozn244JJGA=
X-NNTP-Posting-Host eJwFwYEBwDAEBMCVUF6NIy/2HyF38UHBdAQ8NlYalymDw7/Le6/WjqTRinbgdG0ydrJVLB4xthGw
Xref csiph.com comp.lang.javascript:26635

Show key headers only | 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