Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: intercept an alert Date: Mon, 12 May 2014 19:35:35 +0200 Organization: PointedEars Software (PES) Lines: 43 Message-ID: <10627210.CkprS3AAyM@PointedEars.de> References: <862dneogqrcsze3OnZ2dnUVZ_gCdnZ2d@westnet.com.au> <3910370.hJEAF5dPUy@PointedEars.de> <8761lb47e7.fsf@gmail.com> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1399916137 3888 eJwFwYkRwDAIA7CVeGyTjhO4sP8IlZhyTUEUuFyPtGAN+Pbr9URcfz1QH/O20QGUXpfX3sQPCZoQgw== (12 May 2014 17:35:37 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Mon, 12 May 2014 17:35:37 +0000 (UTC) User-Agent: KNode/4.12.4 X-User-ID: eJwFwYEBwDAEBMCVKjx+nCD2H6F3UBfvMIcbFpvtm3Mwug/Uibbae4hqI0uStxrCKs3NfHgadPSnHNHAD2mpFZA= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. "Evertjan." writes: >> Simon Lewis […] wrote […]: >>> People tag things on to "window" in each and every JS project. >> You cannot know my JS projects, nor that of my neighbours, >> so such utterances make your js-credulity go below 1% here. > > When one just defines a global function (which happens > often) or variable, it becomes a property of the windows > object. You meant _window_, and no. It becomes a property of the ECMAScript global object with the attribute [[DontDelete]] (ES3) or lacking the [[Writable]] attribute (ES5.1+); see ES 5.1, §§10.2.3 and 10.4.1 [0]. Anything more depends on the runtime environment and is not reliable (cross-frame referencing excluded). The ECMAScript global object can be referred to in the global execution context with “this” because it is its /this/ value. Since there is no other standards-compliant way, particularly not a built-in property, to refer to the global object (yet) (returning the “this” value from an instantly called anonymous function does not work in strict mode), it is recommended to define a variable or property that can be used instead. For example: var _global = this; JSX provides “jsx.global” since several revisions in order to avoid another global variable. [1] (The main compatibility layer, JSX:compat.js, can still provide the old “_global” if needed. [2]) Of course, in properly structured code it is only seldom necessary to refer to the global object from local context in the first place. ____________ [0] [1] [2] -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not Cc: me. / Bitte keine Kopien per E-Mail.