<?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>74193</bug_id>
          
          <creation_ts>2011-12-09 11:50:26 -0800</creation_ts>
          <short_desc>typeof Node should be function</short_desc>
          <delta_ts>2016-04-10 08:47:38 -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>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>154038</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Erik Arvidsson">arv</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>cdumez</cc>
    
    <cc>dominicc</cc>
    
    <cc>ggaren</cc>
    
    <cc>haraken</cc>
    
    <cc>joe</cc>
    
    <cc>kaustubh.ra</cc>
    
    <cc>oliver</cc>
    
    <cc>rniwa</cc>
    
    <cc>sam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>518370</commentid>
    <comment_count>0</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2011-12-09 11:50:26 -0800</bug_when>
    <thetext>https://www.w3.org/Bugs/Public/show_bug.cgi?id=12458

Related:

Node instanceof Function // should be true
Function.prototype.isPrototypeOf(Node)  // should be true

typeof Object.getPrototypeOf(Node)  // should be &quot;function&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1067826</commentid>
    <comment_count>1</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2015-02-09 08:30:13 -0800</bug_when>
    <thetext>Node is a constructor, not a function.

ES spec is fairly clear on this -- typeof x === &quot;function&quot; only if x is directly callable.

If the webidl spec now calls for element constructors to be callable directly (instead of via new) then the bug here is that NodeConstructor isn&apos;t a function, not any of the other things you&apos;re claiming.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1067830</commentid>
    <comment_count>2</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2015-02-09 09:07:43 -0800</bug_when>
    <thetext>ES6 classes have a [[Call]] but it throws immediately.

http://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects-call-thisargument-argumentslist

2. If F’s [[FunctionKind]] internal slot is &quot;classConstructor&quot;, throw a TypeError exception.


For WebIDL all constructors have a [[Call]]. It used to do the same thing as [[Construct]], which was to throw if non constructable. There is an open WebIDL bug to throw on [[Call]], See https://www.w3.org/Bugs/Public/show_bug.cgi?id=22808, and Firefox just made that change too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1182529</commentid>
    <comment_count>3</comment_count>
    <who name="Joe Pea">joe</who>
    <bug_when>2016-04-09 22:18:11 -0700</bug_when>
    <thetext>Can you guys please fix this? The reason for following the spec in such a way doesn&apos;t outweight the benefit of being able extend from HTMLElement, especially when using the new Custom Element API.

After applying a `document.registerElement` polyfill in Safari, this is what we have to do in order to make a Custom Element that extends from HTMLElement using ES6 classes:


```js
import &apos;document-register-element&apos; // polyfill

// hack for Safari.
if (typeof window.HTMLElement != &apos;function&apos;) {
    const _HTMLElement = function HTMLElement(){}
    _HTMLElement.prototype = window.HTMLElement.prototype
    window.HTMLElement = _HTMLElement
}

class MyElement extends window.HTMLElement {
    createdCallback() { ... }
    attachedCallback() { ... }
    detachedCallback() { ... }
    attributeChangedCallback(attribute, oldValue, newValue) { ... }
}
MyElement = document.registerElement(&apos;motor-node&apos;, MyElement)

export default MyElement
```

I think it&apos;s time to fix this and get Custom Elements working, and in general to be compatible with ES6 classes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1182542</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2016-04-10 08:47:38 -0700</bug_when>
    <thetext>This has already been fixed a while back via Bug 154038. You can give it a try in the Safari Technology Preview (all your 3 tests pass there).

*** This bug has been marked as a duplicate of bug 154038 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>