Re: Custom element lifecycle callbacks

On 1/9/15 4:28 AM, Anne van Kesteren wrote:
> On Thu, Jan 8, 2015 at 5:54 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>>    var input = document.createElement("input");
>>    input.value = "file:///etc/passwd";
>>    var newInput = input.cloneNode();
>>    newInput.type = "file";
>>
> Note that in the above example cloning callbacks would happen after
> the cloneNode() call but still before type is being set. So that might
> be okay?

Ok, what about this testcase:

   var parent = document.createElement("x-my-element");
   var input = document.createElement("input");
   parent.appendChild(input);
   input.value = "file:///etc/passwd";
   parent.cloneNode(true);

and then in the cloning callback for x-my-element, assuming "newNode" is 
the clone:

   newNode.firstChild.type = "file";

That seems to me like it would do the type set before the cloning 
callback for the input runs, right?

-Boris

Received on Friday, 9 January 2015 11:29:49 UTC