Skip to content

Instantly share code, notes, and snippets.

View esprehn's full-sized avatar

Elliott Sprehn esprehn

View GitHub Profile
@esprehn
esprehn / custom-element-super-swap.js
Last active October 23, 2015 19:29 — forked from domenic/custom-element-super-swap.js
Custom element super swap algorithm
/*
This is a rough approximation of what the algorithm woud do. In an
implementation you might make the JS Wrapper point to a different
C++ Element for the duration of the constructor, then make it
point back at the original C++ element, and move data between them.
This means that the C++ side remains consistent, if you querySelector
from the document you can still find your element where the constructor
is running, but if you look at the parentNode/firstChild or attributes
properties of the element they all appear empty. This means in the