W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2014

Re: Determining what prototype should be used for an object

From: Anne van Kesteren <annevk@annevk.nl>
Date: Fri, 14 Nov 2014 12:39:23 +0100
Message-ID: <CADnb78iD10s-YD95qbUefQd+VMf+Fh4DM+A==m-y36yFjoWhjA@mail.gmail.com>
To: Domenic Denicola <d@domenic.me>
Cc: Boris Zbarsky <bzbarsky@mit.edu>, "public-script-coord@w3.org" <public-script-coord@w3.org>
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]))
   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 11:39:50 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:23 UTC