[Bug 24087] [Custom]: Rename document.registerElement to defineElement

https://www.w3.org/Bugs/Public/show_bug.cgi?id=24087

Scott Miles <sjmiles@chromium.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sjmiles@chromium.org

--- Comment #5 from Scott Miles <sjmiles@chromium.org> ---
I'm sorry there wasn't more clarity on the arguments. The rationale for
'register' goes something like this:

There was a first concept from the originators of Custom Elements, which was to
make 'a way to attach a JS class to a element'. So, the vision has been toward:

  class MyElement extends HTMLElement {
    ...
  }
  document.registerElement('my-element', MyElement);

>From this point of view, the `class` statement is what I would consider the
definition. From there, it seemed clear that the document method was
registering a tag-name for that. I believe this is also fairly close to what I
expect to happen in implementations, which is to say an entry is being added to
a registry. That resonance helped me, for one, to argue for `registerElement`.

Appendix: this is close as we come today to the above `class` construction:

MyElement = function() {
};
MyElement.prototype = Object.create(HTMLElement.prototype, {
  ...
});
MyElement.prototype.createdCallback = MyElement;
MyElement = document.registerElement('my-element', MyElement);

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 6 February 2014 00:41:01 UTC