Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #32185
| 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 <PointedEars@web.de> |
| 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> (permalink) |
| References | <ZpKdncuDJ6SUqenFnZ2dnUU7-YHNnZ2d@westnet.com.au> <8bydnVoLx8BUq-nFnZ2dnUU7-bednZ2d@westnet.com.au> <4259298.GXAFRqVoOG@PointedEars.de> <drGdnYqmpYpK_unFnZ2dnUU7-bfNnZ2d@westnet.com.au> <20170110215212.00003a50@gmail.com> <1747068.usQuhbGJ8B@PointedEars.de> <o5eal0$4ib$1@dont-email.me> <9a709fc2-325b-4280-98b8-1c0d5cb790cd@googlegroups.com> <o5gvqr$cvm$1@dont-email.me> <3d25c9c9-8daf-4a66-a2e6-e5f517dbb32f@googlegroups.com> |
| 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 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= |
|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n4D1hB0 |
| X-Face | %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v |
| Xref | csiph.com comp.lang.javascript:32185 |
Show key headers only | View raw
Michael Haufe (TNO) wrote:
> 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:
>
>
<https://github.com/lukehoban/es6features/blob/master/README.md#subclassable-built-ins>
While an interesting summary, I do not see anything relevant to this problem
there.
> <http://www.ecma-international.org/ecma-262/7.0/#sec-well-known-symbols>
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
,-<http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype-@@hasinstance>
|
| 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: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | 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
custom event in IE Andrew Poulos <ap_prog@hotmail.com> - 2017-01-10 12:08 +1100
Re: custom event in IE Andrew Poulos <ap_prog@hotmail.com> - 2017-01-10 12:20 +1100
Re: custom event in IE Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-10 02:45 +0100
Re: custom event in IE Andrew Poulos <ap_prog@hotmail.com> - 2017-01-10 15:32 +1100
Re: custom event in IE Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-10 12:53 +0100
Re: custom event in IE Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-11 08:25 +0100
Re: custom event in IE James Kirk <noneya.invalid@gmail.com> - 2017-01-10 21:52 -0500
Re: custom event in IE Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-11 04:09 +0100
Re: custom event in IE James Kirk <noneya.invalid@gmail.com> - 2017-01-11 21:31 -0500
Re: custom event in IE Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-12 14:22 +0100
Re: custom event in IE Scott Sauyet <scott@sauyet.com> - 2017-01-14 23:01 +0000
Re: custom event in IE "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-01-15 09:51 -0800
Re: custom event in IE Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-15 22:37 +0100
Can we recognize Constructor Functions (was: custom event in IE) Scott Sauyet <scott@sauyet.com> - 2017-01-15 23:39 +0000
Re: custom event in IE Scott Sauyet <scott@sauyet.com> - 2017-01-15 23:15 +0000
Re: custom event in IE "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-01-15 22:36 -0800
Re: custom event in IE Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-16 12:54 +0100
Re: custom event in IE "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-01-16 14:18 -0800
Re: custom event in IE Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-17 00:24 +0100
csiph-web