W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2014

Re: [Custom]: Rename "createdCallback" to "created"

From: James M. Greene <james.m.greene@gmail.com>
Date: Mon, 6 Oct 2014 11:24:53 -0500
Message-ID: <CALrbKZikD=yeOEpvs=p0NDp8HJ1G--2KAcNPgMQBxsaic41jdg@mail.gmail.com>
To: Matthew Robb <matthewwrobb@gmail.com>
Cc: Jarek Foksa <jarek@foksa.name>, Takayoshi Kochi (河内 隆仁) <kochi@google.com>, public-webapps <public-webapps@w3.org>
I admittedly haven't been following the Custom Elements spec, so forgive if
my point of view has already been discussed and rejected but... I
definitely agree that this naming seems very inconsistent with the rest of
the Web Platform.

I would have expected to have these handlers configured via
`addEventListener` calls.  For example:


var XFooPrototype = Object.create(HTMLElement.prototype);

XFooPrototype.addEventListener("create", function( /* event */ ) {
  this.textContent = "I'm an x-foo!";

  // OR:
  // event.target.textContent = "I'm an x-foo!";

XFooPrototype.foo = function() {
  console.log("foo() called");

var XFoo = document.registerElement('x-foo', {
  prototype: XFooPrototype


This only thing about this approach that is *slightly* inconsistent with
the rest of the Web Platform is assuming that the `this` context within the
handler will be set to the element, rather than being forced to grab it via

Even `XFooPrototype.oncreate = fn;` would be more consistent than
`XFooPrototype.create`, `XFooPrototype.created`, or

The same thoughts also hold true for the other Custom Element lifecycle
hooks as well, of course.
Received on Monday, 6 October 2014 16:25:42 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:31 UTC