W3C home > Mailing lists > Public > public-webapps-bugzilla@w3.org > November 2012

[Bug 15611] [Shadow]: Consider element.createShadowRoot as API for creating ShadowRoot objects.

From: <bugzilla@jessica.w3.org>
Date: Fri, 02 Nov 2012 20:42:12 +0000
To: public-webapps-bugzilla@w3.org
Message-ID: <bug-15611-2532-sbEBq9UvXY@http.www.w3.org/Bugs/Public/>

--- Comment #2 from Elliott Sprehn <esprehn@gmail.com> ---
(In reply to comment #1)
> ...
> This is new. I'll repurpose the bug to track this. So far, my thinking is
> that "new ShadowRoot(..)" is shorter, and doesn't require extending
> HTMLElement API surface.

We're already extending the API surface with public shadows, and having a
constructor that has side effects is very weird. I can't think of any other
place in the platform where constructing an object has side effects like this
(and it's usually considered a code smell).

It's particularly weird in the implementation of WebKit as we call
ShadowRoot::create(this) often and discard the return value which is
non-obvious to someone looking at the code. Once we expose public shadows
people may do the same thing:

function doSomething() {
  // Not obvious this does anything.
  new ShadowRoot(element);


so I'd propose addShadowRoot() which is the same number of characters and
models what's going on better.


You are receiving this mail because:
You are the QA Contact for the bug.
Received on Friday, 2 November 2012 20:42:13 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:04:27 UTC