惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
L
Lohrmann on Cybersecurity
Simon Willison's Weblog
Simon Willison's Weblog
P
Proofpoint News Feed
P
Privacy International News Feed
The Hacker News
The Hacker News
AWS News Blog
AWS News Blog
S
Securelist
P
Proofpoint News Feed
Recent Announcements
Recent Announcements
GbyAI
GbyAI
B
Blog RSS Feed
A
About on SuperTechFans
C
CXSECURITY Database RSS Feed - CXSecurity.com
Y
Y Combinator Blog
Microsoft Azure Blog
Microsoft Azure Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Cyberwarzone
Cyberwarzone
I
Intezer
T
Tor Project blog
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
Recorded Future
Recorded Future
aimingoo的专栏
aimingoo的专栏
Cisco Talos Blog
Cisco Talos Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
W
WeLiveSecurity
D
DataBreaches.Net
U
Unit 42
Project Zero
Project Zero
Martin Fowler
Martin Fowler
V
V2EX
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
C
Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V2EX - 技术
V2EX - 技术
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
Threat Research - Cisco Blogs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Tenable Blog
F
Full Disclosure
T
The Exploit Database - CXSecurity.com
H
Heimdal Security Blog
Latest news
Latest news
Webroot Blog
Webroot Blog

Miriam Eric Suzanne

Butter bells, fresh from the kiln Butter bells, fresh from the kiln Butter bells, fresh from the kiln I had to look it up I Laser-cut pottery throwing gauge Tech continues to be political Aggregating my distributed self We don Eleventy buckets & cascade layers A slash-why proposal User styles on the web Custom element, two ways New year, same (terrible) Mia CSS @scope Reclaiming my time Cascade Layers Javascript automation on Mac Personal Histories Ancient Web Browsers Critical CSS? Not So Fast! CSS tie-dye gradient backgrounds Personal website redesign Request for Comments: Sass Color Spaces A long-term plan for logical properties? Container queries in browsers! I never let things be small A whole cascade of layers This content won No demo [website] reno 2 days of cordwainery Body margin 8px The gray areas of HWB color Miriam, for the archive Complex vs compound selectors The spam has arrived Am I on the IndieWeb yet? My theatrical delusions A Complete Guide to CSS Cascade Layers Container queries explainer & proposal Very Extremely Practical CSS Art An open CSS notebook Custom Property “Stacks" Alcohol affects the frontal cortex Embracing the Universal Web CSS most normalizer-est Introducing Sass Modules F*CSS Not clear to me, an installation Framed | Born to choose this way Last Bullet, live music video A Dark Plain, live music video Guts | Let Rejecting maleness Chosen family (thank you) Mia Speaking of pride More CSS Charts, with Grid & Custom Properties (Mis)gender Stop Being Productive Fun with Viewport Units Gods on the Lam Body & gender fragments Trans Interviews & Photography Getting Started with CSS Grid Just Like That Adaptation: SideSaddle/Myths Justice [under construction] Some clarifications on trans language Some kind of resistance tour Loops in CSS Preprocessors An Interview with Miriam Suzanne Estrogentrification Miriam, a how-to guide Holes / SideSaddle midwest tour Underground music showcase Species of the stars PROPHETIA VETITUM MUNDI Pig Sez, song demo I UMS day 4 (the end) UMS day 3 A Dark Plain, song demo UMS day 2 UMS day 1 Media Archeology Lab, Artist in Residence Stratified design (re)Thinking on your feet Five(5), song demo Poetry readings are terrible Explosive growth Get curious The Posture of Contour Starting from a seed Portrait of Sondra & Dan Creative modes and cycles Ordinary tools of thought Portrait of Kitten Karlyle (nsfw) Fuck the muse Susy 1.0 release
A web component for CodePen embeds?
2024-09-09 · via Miriam Eric Suzanne

David Darnes already made a <code-pen> web component. It’s great. It takes code, and creates a pen from that code. But I don’t want to create a pen, I want to embed one.

The default CodePen embed is pretty good already. So right from the start, this whole project is unnecessary. The code looks like this:

<p class="codepen" data-slug-hash="BEvjbm" data-height="600">
  CodePen Demo:
  <a href="https://codepen.io/miriamsuzanne/pen/BEvjbm">
    CSS-only 'mixin'
  </a>
</p>
<script async src="https://static.codepen.io/assets/embed/ei.js"></script>

There are other optional attributes, but those are the essentials in my experience. You can put anything you want inside the paragraph, since the entire element is getting replaced.

To my eye, that’s a custom element waiting to happen. And I had a few small adjustments in mind:

  • The pen data-slug-hash could be extracted from the link
  • If we provide the height in CSS, we can use it to avoid layout shift?

I’m not sure it’s enough to make this worthwhile, but it was enough for me to create a new pen and start playing around.

With the first draft, my fancy new embed looks like this:

<embed-pen style="height: 600px">
  CodePen Demo:
  <a href="https://codepen.io/miriamsuzanne/pen/BEvjbm">
    CSS-only 'mixin'
  </a>
</embed-pen>
<script async src="https://static.codepen.io/assets/embed/ei.js"></script>

Ok, so not much has changed. But it works! Here it is, doing the thing:

CodePen Demo: An embed-pen web web component

If I was to flesh this out, I think:

  • The custom element should stick around, instead of becoming div.cp_embed_wrapper
  • The embed/ei.js logic should be part of the element definition, not a separate script

Along the way, I learned that the height attribute is only allowed on specific elements, which is why I had to use the style attribute instead. One of those elements is the iframe.

Looking closer, the CodePen Embed docs demonstrate using an iframe from the start, if you need to avoid JS:

<iframe src="https://codepen.io/miriamsuzanne/embed/BEvjbm" height="600" width="100%" loading="lazy"></iframe>

Well that sure gets right to the point. Maybe that’s all I need? I don’t feel like I’m losing essential behavior, here. All the parameters are still available via the URL.

© Miriam Eric Suzanne,
protect trans kids