Path: csiph.com!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: custom event in IE Date: Mon, 16 Jan 2017 12:54:48 +0100 Organization: PointedEars Software (PES) Lines: 97 Message-ID: <7254284.T7Z3S40VBb@PointedEars.de> References: <8bydnVoLx8BUq-nFnZ2dnUU7-bednZ2d@westnet.com.au> <4259298.GXAFRqVoOG@PointedEars.de> <20170110215212.00003a50@gmail.com> <1747068.usQuhbGJ8B@PointedEars.de> <9a709fc2-325b-4280-98b8-1c0d5cb790cd@googlegroups.com> <3d25c9c9-8daf-4a66-a2e6-e5f517dbb32f@googlegroups.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 1484567690 21570 eJwNwoERACEIA7CVBNviOgiy/wj/l3DLVAFR4HBOPoOhe26kc9/w+b08ST8QVFx3vBFPNesDJGkRWw== (16 Jan 2017 11:54:50 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Mon, 16 Jan 2017 11:54:50 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwFwYkBwEAEBMCWHFYox9t/CZmB2LP+1GCKw2mO43rSJrB5wfpEVq6dMHAMxzItGbCErErq6isZcV7/AW6WFk0= 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== Cancel-Lock: sha1:YCENUBIMtNWGH2peTMccledI9/I= X-NNTP-Posting-Host: eJwFwQcBACAIBMBKDJ8RRxD6R/AOamztx2AHiw0X5RAyfdCXqVvDVcBaDIXfpU6FcxND5n4D1hB0 X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. Scott Sauyet wrote: >> But my question was about more fundamental language issues. Can we tell >> at all [whether an object can be reasonably called as a constructor]? I >> don't see a way, but was wondering if I'm missing something that might be >> useful. > > I *think* it *will* be possible by testing for the existence of one of the > standard symbols. How? > The current browser support seems pretty flaky so I > haven't discovered any useful results: > > While an interesting summary, I do not see anything relevant to this problem there. > I see a relevant symbol to tell whether an object implements [[Construct]], but none that could tell if it makes sense to call it as a constructor. “Symbol.hasInstance” is not it (tested in Chromium 53¹): | > ({})[Symbol.hasInstance] | undefined | | > (function () {})[Symbol.hasInstance] | [Symbol.hasInstance]() { [native code] } | | > var f = function () {}; | > delete f[Symbol.hasInstance]; | > f[Symbol.hasInstance] | [Symbol.hasInstance]() { [native code] } Also: | > HTMLLIElement[Symbol.hasInstance] | [Symbol.hasInstance]() { [native code] } (it has to, for HTMLLIElement.prototype) But: | > new HTMLLIElement | Uncaught TypeError: Illegal constructor(…) See also ,- | | Function.prototype [ @@hasInstance ] ( V )# | | When the @@hasInstance method of an object F is called with value V, the $ | following steps are taken: | | 1. Let F be the this value. | 2. Return ? OrdinaryHasInstance(F, V). | | The value of the name property of this function is "[Symbol.hasInstance]". | | This property has the attributes { [[Writable]]: false, | [[Enumerable]]: false, [[Configurable]]: false }. | | NOTE | This is the default implementation of @@hasInstance that most functions | inherit. @@hasInstance is called by the instanceof operator to determine | whether a value is an instance of a specific constructor. An expression | such as | | v instanceof F | | evaluates as | | F[@@hasInstance](v) | | A constructor function can control which objects are recognized as its | instances by instanceof by exposing a different @@hasInstance method on | the function. > This may be worth raising in es-discuss Yes. ___________ ¹ navigator.userAgent === "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36" -- PointedEars FAQ: | | Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.