I've discussed this issue with some of Edge's key parser developers. From a 
technical ground, we do not have a problem with stopping the parser to callout 
to author code in order to run a constructor, either during parsing or cloning. 
For example, in parsing, I would expect that the callout happens after initial 
instance creation, but before the target node is attached to the DOM tree by 
the parser.

Having put my support in for this design, which I believe to be the most 
straightforward approach that most closely matches how the platform itself 
works, and which would not be a problematic issue for our implementation, I did 
have a chance to discuss this briefly with Alex Russell, who felt that running 
synchronous author code at such early stages in the loading pipeline (e.g., 
while initial parsing due to a previously encountered document.registerElement 
call was an anti-pattern that he'd like to avoid. He is a strong supporter of 
the proto-swizzle technique that happens later with retro-active upgrades to 
previously-seen custom elements. I am sympathetic to this concern, but have my 
own reservations about the proto-swizzle technique.

-----Original Message-----
From: Domenic Denicola [mailto:d...@domenic.me] 
Sent: Thursday, July 16, 2015 2:45 AM
To: public-webapps
Subject: The key custom elements question: custom constructors?

Hi all,

Ahead of next week's F2F, I'm trying to pull together some clarifying and 
stage-setting materials, proposals, lists of open issues, etc. In the end, they 
all get blocked on one key question:

**Is it OK to run author code during parsing/cloning/editing/printing (in 

If we allow custom elements to have custom constructors, then those must run in 
order to create properly-allocated instances of those elements; there is simply 
no other way to create those objects. You can shuffle the timing around a bit: 
e.g., while cloning a tree, you could either run the constructors at the normal 
times, or try to do something like almost-synchronous constructors [1] where 
you run them after constructing a skeleton of the cloned tree, but before 
inserting them into the tree. But the fact remains that if custom elements have 
custom constructors, those custom constructors must run in the middle of all 
those operations.

We've danced around this question many times. But I think we need a clear 
answer from the various implementers involved before we can continue. In 
particular, I'm not interested in whether the implementers think it's 
technically feasible. I'd like to know whether they think it's something we 
should standardize.

I'm hoping we can settle this on-list over the next day or two so that we all 
come to the meeting with a clear starting point. Thanks very much, and looking 
forward to your replies,


[1]: https://lists.w3.org/Archives/Public/public-webapps/2014JanMar/0098.html

Reply via email to