Skip to content

Instantly share code, notes, and snippets.

View TakayoshiKochi's full-sized avatar

Takayoshi Kochi TakayoshiKochi

View GitHub Profile
@TakayoshiKochi
TakayoshiKochi / shadow-v1-style-sharing.html
Created January 11, 2017 08:09
Style Sharing for Shadow DOM v1
<!doctype html>
<html>
<body>
</body>
<script>
'use strict';
let host = document.createElement('div');
const numChildren = 10000;
for (var i = 0; i < numChildren; ++i) {
@TakayoshiKochi
TakayoshiKochi / html-modules-issue645.md
Last active March 27, 2019 04:45
Summary of HTML Modules discussion

HTML Modules summary (issue#645)

Initial: Jun. 28, 2017 / Last Update: Aug. 14, 2017

What is this?

This is the summary of the discussion happening for HTML Modules at webcoomponents#645.

There appear to be lots of diverse opinions, and I'll try to capture them, summarize and provide here for catching up with the discussion for all. Note that this document should never be considered official, complete or final. If anything is wrong or lost, please let @TakayoshiKochi know.

@TakayoshiKochi
TakayoshiKochi / query-slotted.js
Created August 9, 2017 07:22
Replacement for querySelector("::slotted(x)")
function querySlotted(root, selector) {
let slots = root.querySelectorAll('slot');
let matched = [];
slots.forEach((slot) => {
matched = matched.concat(slot.assignedNodes().filter((el) => {
return el.matches(selector);
}));
});
return matched;
}