Re: [custom elements] Improving the name of document.register()

Also,
http://www.html5rocks.com/en/tutorials/webcomponents/customelements/
and
http://www.polymer-project.org/platform/custom-elements.html
already talk about custom elements as a way of "defining (and use) new (types of DOM) elements".

I mean… even our current working draft says
"This specification describes the method for enabling the author to _define_ and use new types of DOM elements in a document."
(http://w3c.github.io/webcomponents/spec/custom/)

- R. Niwa

On Dec 12, 2013, at 10:41 PM, Maciej Stachowiak <mjs@apple.com> wrote:

> I like defineElement a lot too. I think it gets to the heart of this method's potential - the ability to define your own elements.
> 
>  - Maciej
> 
> On Dec 11, 2013, at 6:46 PM, Dominic Cooney <dominicc@google.com> wrote:
> 
>> On Thu, Dec 12, 2013 at 5:17 AM, piranna@gmail.com <piranna@gmail.com> wrote:
>> I have seen registerProtocolHandler() and it's being discused registerServiceWorker(). I believe registerElementDefinition() or registerCustomElement() could help to keep going on this path.
>> 
>> Send from my Samsung Galaxy Note II
>> 
>> El 11/12/2013 21:10, "Edward O'Connor" <eoconnor@apple.com> escribió:
>> 
>> Hi,
>> 
>> The name "register" is very generic and could mean practically anything.
>> We need to adopt a name for document.register() that makes its purpose
>> clear to authors looking to use custom elements or those reading someone
>> else's code that makes use of custom elements.
>> 
>> I support this proposal.
>>  
>> Here are some ideas:
>> 
>> document.defineElement()
>> document.declareElement()
>> document.registerElementDefinition()
>> document.defineCustomElement()
>> document.declareCustomElement()
>> document.registerCustomElementDefinition()
>> 
>> I like document.defineCustomElement() the most, but
>> document.defineElement() also works for me if people think
>> document.defineCustomElement() is too long.
>> 
>> 
>> I think the method should be called registerElement, for these reasons:
>> 
>> - It's more descriptive about the purpose of the method than just "register."
>> - It's not too verbose; it doesn't have any redundant part.
>> - It's nicely parallel to registerProtocolHandler.
>> 
>> If I had to pick from the list Ted suggested, I think defineElement is the best of that bunch and also an improvement over just "register". It doesn't line up with registerProtocolHandler, but there's some poetry to defineElement/createElement. 
>> 
>> 
>> Ted
>> 
>> P.S. Sorry for the bikeshedding. I really believe we can improve the
>> name of this function to make its purpose clear.
>> 
>> I searched for bugs on this and found none; I expect this was discussed but I can't find a mail thread about it. The naming of register is something that's been on my mind so thanks for bringing it up.
>> 
>> Dominic

Received on Friday, 13 December 2013 08:07:55 UTC