<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>188083</bug_id>
          
          <creation_ts>2018-07-26 15:47:17 -0700</creation_ts>
          <short_desc>The instanceof operator does not work as expected for classes that extend CustomEvent or Event</short_desc>
          <delta_ts>2020-03-22 10:25:17 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>Safari Technology Preview</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=174313</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Eugene Kashida">ekashida</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ashvayka</cc>
    
    <cc>cdumez</cc>
    
    <cc>keith_miller</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1445577</commentid>
    <comment_count>0</comment_count>
    <who name="Eugene Kashida">ekashida</who>
    <bug_when>2018-07-26 15:47:17 -0700</bug_when>
    <thetext>Overview:

class FooEvent extends CustomEvent {
  constructor() {
    super(&apos;foo&apos;);
  }
};
var foo = new FooEvent();
console.log(&apos;This evaluates to &quot;false&quot; which is unexpected&apos;, foo instanceof FooEvent);
console.log(&apos;This evaluates to &quot;true&quot; which is expected&apos;, foo instanceof CustomEvent);
console.log(&apos;This evaluates to &quot;true&quot; which is expected&apos;, foo instanceof Event);


Expected Results:

The instanceof operator, when given an instance of FooEvent which extends CustomEvent, and the FooEvent constructor, should evaluate to &quot;true&quot;.

Build Date &amp; Hardware:

Release 61 (Safari 12.0, WebKit 13606.1.25.1)
Mac OS 10.13.6</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1446783</commentid>
    <comment_count>1</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2018-07-31 19:06:50 -0700</bug_when>
    <thetext>I don&apos;t think class inheritance ever worked with Event&apos;s.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1447021</commentid>
    <comment_count>2</comment_count>
    <who name="Eugene Kashida">ekashida</who>
    <bug_when>2018-08-01 15:12:28 -0700</bug_when>
    <thetext>It seems to be working as expected in Firefox and Chrome, and Edge has the following open issue:
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11923584/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1632653</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Shvayka">ashvayka</who>
    <bug_when>2020-03-22 10:24:58 -0700</bug_when>
    <thetext>(In reply to Eugene Kashida from comment #0)
&gt; Expected Results:
&gt; 
&gt; The instanceof operator, when given an instance of FooEvent which extends
&gt; CustomEvent, and the FooEvent constructor, should evaluate to &quot;true&quot;.

As of https://trac.webkit.org/changeset/256716, extending CustomEvent (as well as other DOM constructors) works as expected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1632656</commentid>
    <comment_count>4</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-03-22 10:25:17 -0700</bug_when>
    <thetext>&lt;rdar://problem/60743143&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>