Skip to content

Instantly share code, notes, and snippets.

View tomalec's full-sized avatar

Tomek Wytrębowicz tomalec

View GitHub Profile
@hallettj
hallettj / global-variables-are-bad.js
Created February 14, 2009 21:15
How and why to avoid global variables in JavaScript
// It is important to declare your variables.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// Because if you don't, the become global variables.
(function() {
@dglazkov
dglazkov / gist:ce96f673b0b2ce7b8c55
Last active August 29, 2015 13:58
Shadow DOM Imperative API Brainstorming

#Shadow DOM Imperative API Brainstorming

##Reduced test case:

<div>
  <template shadow> <!-- shadow root -->
    <details>
      <content></content>
 
@davatron5000
davatron5000 / the-state-of-element-container-queries.md
Last active August 23, 2023 15:43
The State of Element/Container Queries

The State of Container Queries

tl;dr Developers would like the idea to style components based on a parent's width rather than depend solely on the viewport media query. This would allow modular components to style themselves while being agnostic to the viewport.

There is currently a lot of developer interest in getting a feature like Container Queries (née "Element Queryies") shipped in a browser.

2-min Catchup

Here are official'ish documents to outline the developer community's desires.

@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.

@WebReflection
WebReflection / custom-elements-pattern.md
Last active April 29, 2025 19:25
Handy Custom Elements' Patterns

Handy Custom Elements' Patterns

Ricardo Gomez Angel Photo by Ricardo Gomez Angel on Unsplash

This gist is a collection of common patterns I've personally used here and there with Custom Elements.

These patterns are all basic suggestions that could be improved, enriched, readapted, accordingly with your needs.