Skip to content

Commit

Permalink
Merge 4ae449c into fc82a66
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed Jan 12, 2020
2 parents fc82a66 + 4ae449c commit 38d1b13
Show file tree
Hide file tree
Showing 5 changed files with 764 additions and 648 deletions.
30 changes: 29 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,4 +349,32 @@ const SVGElements = new Set([
"vkern"
]);

export { Attributes, SVGAttributes, NonComposedEvents, SVGElements };
/*
(function() {
window._$HYDRATION = { events: [], completed: new Set() };
function lookup(el) {
return el && (el.getAttribute("_hk") || lookup((el.host && el.host instanceof Node) ? el.host : el.parentNode));
}
function hydrationEventHandler(e) {
let node = (e.composedPath && e.composedPath()[0]) || e.target;
const id = lookup(node);
if (id && !window._$HYDRATION.completed.has(id)) window._$HYDRATION.events.push([id, e]);
}
["${eventNames.join(
'","'
)}"].forEach(name => document.addEventListener(name, hydrationEventHandler));
})();
*/
function generateHydrationEventsScript(eventNames) {
return `!function(){function t(t){const e=function t(e){return e&&(e.getAttribute("_hk")||t(e.host&&e.host instanceof Node?e.host:e.parentNode))}(t.composedPath&&t.composedPath()[0]||t.target);e&&!window._$HYDRATION.completed.has(e)&&window._$HYDRATION.events.push([e,t])}window._$HYDRATION={events:[],completed:new Set},["${eventNames.join(
'","'
)}"].forEach(e=>document.addEventListener(e,t))}();`;
}

export {
Attributes,
SVGAttributes,
NonComposedEvents,
SVGElements,
generateHydrationEventsScript
};

0 comments on commit 38d1b13

Please sign in to comment.