Prev: using screenX and screenY?
Next: ECMA-262-5 in detail. Chapter 1. Properties and Property Descriptors.
From: Thomas 'PointedEars' Lahn on 28 Apr 2010 21:47 Ciaran wrote: > Is it just me or was my query hijacked and converted into a debugging > session for an intended publicity/SEO plug for a personal project? It is just you. This is how Usenet works. Usenet is not a right. As a poster, you do not have a right to receive an answer (that you like). In the same sense you do not own a thread as an OP, so it cannot be in any way hijacked. The discussion that followed from discovering the bug in the ECMAScript Support Matrix, and ultimately JSX, where BTW at least the former is a development-supporting project being appreciated and contributed to by several subscribers of this newsgroup, was on-topic here. It showed which problems can arise if one does not use closures carefully, and that `undefined' must not be assigned to `window.onerror' (and perhaps other proprietary event-handler properties) (in MSHTML-based browsers). What has been learned here will be available in the archives for future reference (hence my change of Subject), and so of benefit to *all*. <http://jibbering.com/faq/#posting> HTH & HAND PointedEars -- var bugRiddenCrashPronePieceOfJunk = ( navigator.userAgent.indexOf('MSIE 5') != -1 && navigator.userAgent.indexOf('Mac') != -1 ) // Plone, register_function.js:16
From: Garrett Smith on 28 Apr 2010 23:59 VK wrote: >> Do not assign undefined to window.onerror in IE/MSHTML (was: Trigger hover pseudo class using javascript?) > > The title was misleading so I corrected it. IE doesn't and never did > allow to assign undefined to window host object event handlers, in > this aspect onerror is same as onload. If one needs to clear up a > handler, assign null instead: > window.onerror = null; > It comes as no surprise to see errors occur in Internet Explorer when setting the event handler property of a host object to something other than function. Problems with Internet Explorer throwing "Type mismatch" error for ActiveX XMLHttp when setting onreadystatechange to null have come up many times over the years on this newsgroup. Calling delete on a host object property would also result in errors in IE. A safe way to remove an existing event handler property is to replace the value with a function the does nothing and returns undefined. The global noop function `Function.prototype` fits that bill perfectly. Example: hostObject[methodName] = Function.prototype; -- Garrett comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Thomas 'PointedEars' Lahn on 29 Apr 2010 07:19 Garrett Smith wrote: > A safe way to remove an existing event handler property is to replace > the value with a function the does nothing and returns undefined. The > global noop function `Function.prototype` fits that bill perfectly. > > Example: > hostObject[methodName] = Function.prototype; We've been over this. The Specification does not say it must be a "noop function" (and it is not global), so this is _not_ even remotely safe. The following is safe¹, though: hostObject[methodName] = function () {}; PointedEars ___________ ¹ <http://PointedEars.de/es-matrix#f> -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs, <f806at$ail$1$8300dec7(a)news.demon.co.uk>
From: Ry Nohryb on 29 Apr 2010 07:41 On Apr 29, 1:19 pm, Thomas 'PointedEars' Lahn <PointedE...(a)web.de> wrote: > > (...) (and it is not global) (...) A public (could not be otherwise) property of a globally accessible object is globally accessible too and therefore it's a "global" too. If not the "globals" you refer to would not be "globals" either, for they are nothing but properties of the globally accesible "Global object". -- Jorge.
From: VK on 29 Apr 2010 08:38 On Apr 29, 3:41 pm, Ry Nohryb <jo...(a)jorgechamorro.com> wrote: > A public (could not be otherwise) property of a globally accessible > object is globally accessible too and therefore it's a "global" too. > > If not the "globals" you refer to would not be "globals" either, for > they are nothing but properties of the globally accesible "Global > object". A discussion about a "strictly standard" way to overcome a particular platform-dependent non-standard behavior is pointless. From the ground- >up point of view the sh** had been started by The Man who introduced a possibility for a variable to have a defined value "I am not defined", other words allowing undefined to be the right side of the assignment. I don't know what Mr.Eich was smoking that time, but it was a damn good rifle stuff by all signs... From the code stability point of view assigning a loophole function instead of null assignment looks better as it frees from an extra error check for "callability", so an accidental window.onerror() call will not to be trapped.
|
Next
|
Last
Pages: 1 2 3 4 5 6 7 Prev: using screenX and screenY? Next: ECMA-262-5 in detail. Chapter 1. Properties and Property Descriptors. |