- From: Allen Wirfs-Brock <allen@wirfs-brock.com>
- Date: Fri, 14 Nov 2014 09:00:12 -0800
- To: Anne van Kesteren <annevk@annevk.nl>
- Cc: Domenic Denicola <d@domenic.me>, Boris Zbarsky <bzbarsky@mit.edu>, "public-script-coord@w3.org" <public-script-coord@w3.org>
what's "self"? where are the semi-colons ;-)
On Nov 14, 2014, at 3:39 AM, Anne van Kesteren wrote:
> On Fri, Nov 14, 2014 at 12:31 PM, Domenic Denicola <d@domenic.me> wrote:
>> Just to sharpen the discussion, it would help to give one example of each...
>
> <!DOCTYPE html>
> <iframe></iframe>
> <script>
> function isObjectFromGlobal(object, global) { return object
> instanceof global.Object }
> onload = function() {
> var x = new self[0].Array()
> w(isObjectFromGlobal(x, self[0]))
> x = Array.prototype.constructor.call(self[0])
> w(isObjectFromGlobal(x, self[0]))
according to the ES6 spec.
new Array()
and
Array.prototype.constructor.call(anything)
both produce objects whose [[Prototype]] are in the same realm as Array. So the answer should yield true, true.
allen
> x = self[0].document.createElement("x")
> w(isObjectFromGlobal(x, self[0]))
> x = Document.prototype.createElement.call(self[0].document, "x")
> w(isObjectFromGlobal(x, self[0]))
> }
> </script>
>
> http://software.hixie.ch/utilities/js/live-dom-viewer/saved/3302
>
> yields true, false, true, true.
>
>
> --
> https://annevankesteren.nl/
>
Received on Friday, 14 November 2014 17:00:43 UTC