tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

has-instance.html (900B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>instanceof behavior</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 
      7 <iframe></iframe>
      8 
      9 <script>
     10 test(function() {
     11  var obj = Object.create(Element.prototype);
     12  assert_true(obj instanceof Element);
     13  assert_true(obj instanceof Node);
     14  assert_false(obj instanceof Attr);
     15 }, "Manually-constructed prototype chains are correctly handled by instanceof");
     16 
     17 test(() => {
     18  // This tests that the historical override of [[HasInstance]] was removed:
     19  // https://github.com/heycam/webidl/pull/356
     20  assert_false(document.body instanceof frames[0].Element);
     21 }, "instanceof must return false across different globals, for platform objects");
     22 
     23 test(() => {
     24  assert_false(EventTarget.hasOwnProperty(Symbol.hasInstance));
     25 }, "platform objects do not have Symbol.hasInstance installed");
     26 </script>