Peter Kröner's Avatar

Peter Kröner

@sirpepe.bsky.social

Vanilla #webdev, cats, travel. Reading web technology specs and building smol frontend frameworks for fun. Less #JavaScript and fewer nazis plz. Also at @sir_pepe@mastodon.social

108 Followers  |  89 Following  |  529 Posts  |  Joined: 20.11.2023  |  1.665

Latest posts by sirpepe.bsky.social on Bluesky

Post image 10.08.2025 15:40 — 👍 1    🔁 0    💬 0    📌 0

part of my resentment towards LLMs is to do with them crowding out anything else we could be talking about. there are so many things I could be reading to get better at my craft but I'm presented with "you should actually get worse at it on purpose because nothing matters any more"

08.08.2025 19:27 — 👍 632    🔁 122    💬 7    📌 21
CSS Fonts Module Level 4

🧐 TIL: the font shorthand property, even though it CAN NOT set font-size-adjust, implicitly RESETS font-size-adjust anyway

👉 drafts.csswg.org/css-fonts/#f...

#CSS #webdev

08.08.2025 14:34 — 👍 0    🔁 0    💬 0    📌 0
Preview
NodeIterator - Web APIs | MDN The NodeIterator interface represents an iterator to traverse nodes of a DOM subtree in document order.

TIL: If you ever need to traverse a DOM tree, you don't need to do so manually: NodeIterator is there for you! The API's kinda nuts (the whatToShow property is a bitmask, not that common a construct in #JavaScript), but should work in every browser!

👉 developer.mozilla.org/en-US/docs/W...

#webdev

05.08.2025 10:34 — 👍 2    🔁 1    💬 0    📌 0
Preview
prefers-color-scheme - CSS | MDN The prefers-color-scheme CSS media feature is used to detect if a user has requested light or dark color themes. A user indicates their preference through an operating system setting (e.g., light or d...

Turns out this does not work in Safari, which does not respect color-scheme inherited from parent 😭

developer.mozilla.org/en-US/docs/W...

FML.

07.08.2025 11:59 — 👍 0    🔁 0    💬 0    📌 0
Preview
color-scheme + picture in SVG via <foreignObject> in <object> ...

Demo: codepen.io/SirPepe/pen/...

(the image CDN is a tad slow, be patient)

07.08.2025 11:54 — 👍 0    🔁 0    💬 1    📌 0
<object
    width="32"
    height="32"
    data='data:image/svg+xml,
&lt;svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"&gt;
&lt;foreignObject class="node" x="0" y="0" width="32" height="32"&gt;
    &lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;style&gt;
        :root, body { margin: 0 }
    &lt;/style&gt;
    &lt;picture&gt;
        &lt;source srcset="http://127.0.0.1:5500/dark.png" media="(prefers-color-scheme: dark)" /&gt;
        &lt;img src="http://127.0.0.1:5500/light.png" /&gt;
    &lt;/picture&gt;
    &lt;/body&gt;
&lt;/foreignObject&gt;
&lt;/svg&gt;'
></object>

<object width="32" height="32" data='data:image/svg+xml, &lt;svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"&gt; &lt;foreignObject class="node" x="0" y="0" width="32" height="32"&gt; &lt;body xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;style&gt; :root, body { margin: 0 } &lt;/style&gt; &lt;picture&gt; &lt;source srcset="http://127.0.0.1:5500/dark.png" media="(prefers-color-scheme: dark)" /&gt; &lt;img src="http://127.0.0.1:5500/light.png" /&gt; &lt;/picture&gt; &lt;/body&gt; &lt;/foreignObject&gt; &lt;/svg&gt;' ></object>

... but not if you use <object> apparently! There it is, <picture> respecting color-scheme 🥳

#SVG #CSS #webdev

07.08.2025 11:33 — 👍 0    🔁 0    💬 1    📌 0
<img
    src='data:image/svg+xml,
    &lt;svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"&gt;
    &lt;foreignObject class="node" x="0" y="0" width="32" height="32"&gt;
        &lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;
        &lt;style&gt;
            :root, body { margin: 0 }
        &lt;/style&gt;
        &lt;picture&gt;
            &lt;source srcset="http://127.0.0.1:5500/dark.png" media="(prefers-color-scheme: dark)" /&gt;
            &lt;img src="http://127.0.0.1:5500/light.png" /&gt;
        &lt;/picture&gt;
        &lt;/body&gt;
    &lt;/foreignObject&gt;
    &lt;/svg&gt;'
/>

<img src='data:image/svg+xml, &lt;svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"&gt; &lt;foreignObject class="node" x="0" y="0" width="32" height="32"&gt; &lt;body xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;style&gt; :root, body { margin: 0 } &lt;/style&gt; &lt;picture&gt; &lt;source srcset="http://127.0.0.1:5500/dark.png" media="(prefers-color-scheme: dark)" /&gt; &lt;img src="http://127.0.0.1:5500/light.png" /&gt; &lt;/picture&gt; &lt;/body&gt; &lt;/foreignObject&gt; &lt;/svg&gt;' />

Oh, it DOES work when the SVG is not embedded in the document! Only remaining problem: browsers refuse to download the external rsources...

#SVG #CSS #webdev

07.08.2025 11:12 — 👍 0    🔁 0    💬 1    📌 0
<svg
  xmlns="http://www.w3.org/2000/svg"
  width="800"
  height="500"
  style="color-scheme: dark">
  <foreignObject class="node" x="0" y="0" width="200" height="300">
    <body xmlns="http://www.w3.org/1999/xhtml">
      <!-- Respects style="color-scheme: dark" -->
      <style>
        @media (prefers-color-scheme: dark) {
          .foo { color: red }
        }
      </style>
      <p class="foo">Text</p>
      <!-- Ignores style="color-scheme: dark" -->
      <picture>
        <source srcset="./dark.png" media="(prefers-color-scheme: dark)" />
        <source srcset="./light.png" media="(prefers-color-scheme: light)" />
        <img src="./light.png" alt="" />
      </picture>
    </body>
  </foreignObject>
</svg>

<svg xmlns="http://www.w3.org/2000/svg" width="800" height="500" style="color-scheme: dark"> <foreignObject class="node" x="0" y="0" width="200" height="300"> <body xmlns="http://www.w3.org/1999/xhtml"> <!-- Respects style="color-scheme: dark" --> <style> @media (prefers-color-scheme: dark) { .foo { color: red } } </style> <p class="foo">Text</p> <!-- Ignores style="color-scheme: dark" --> <picture> <source srcset="./dark.png" media="(prefers-color-scheme: dark)" /> <source srcset="./light.png" media="(prefers-color-scheme: light)" /> <img src="./light.png" alt="" /> </picture> </body> </foreignObject> </svg>

How frustrating: <foreignObject> in #SVG in #HTML inherits the parent's color-scheme settings... but <source> in <picture> ignores it anyway 😭

developer.mozilla.org/en-US/docs/W...

#webdev

07.08.2025 09:58 — 👍 2    🔁 1    💬 1    📌 0
Preview
comptime.ts — compile-time expressions for TypeScript A simple-to-use compiler and Vite plugin to evaluate TypeScript expressions at build time.

comptime.ts enables compile-time evaluation of expressions marked with comptime

👉 comptime.js.org

#typescript #webdev

07.08.2025 08:14 — 👍 4    🔁 1    💬 0    📌 0
Preview
CSS: supports() static method - Web APIs | MDN The CSS.supports() static method returns a boolean value indicating if the browser supports a given CSS feature, or not.

🤯 TIL: there is a #JavaScript equivalent to #CSS support queries; a static method on the global CSS object!

👉 developer.mozilla.org/en-US/docs/W...

#webdev

04.08.2025 09:56 — 👍 1    🔁 1    💬 0    📌 0
Preview
Untitled ...

I must be doing something wrong then: codepen.io/SirPepe/pen/...

06.08.2025 15:10 — 👍 0    🔁 0    💬 2    📌 0

This is obviously egregious misinformation. A brief look at the specifications or a tiny experiment could easily have told you that this is entirely wrong. Delete your post.

06.08.2025 14:58 — 👍 1    🔁 0    💬 1    📌 0
Video thumbnail

😱 Today I realized: unconditionally setting the display property in a :host rule overrides the effect of the global hidden (developer.mozilla.org/en-US/docs/W...) attribute. This is... bad!

#webdev #webcomponents #JavaScript

06.08.2025 11:26 — 👍 2    🔁 0    💬 6    📌 0
Preview
Should we remove XSLT from the web platform? · Issue #11523 · whatwg/html What is the issue with the HTML Standard? XSLT v1.0, which all browsers adhere to, was standardized in 1999. In the meantime, XSLT has evolved to v2.0 and v3.0, adding features, and growing apart f...

WHATWG asks: "Should we remove XSLT from the web platform?"

👉 github.com/whatwg/html/...

#XML heads, make your voices heard!

#webdev

05.08.2025 12:20 — 👍 1    🔁 1    💬 0    📌 0

I must not rewrite the state management. Rewriting state management is the mind-killer. Rewriting state management is the little-death that brings total obliteration to side projects.

#webdev

05.08.2025 12:34 — 👍 0    🔁 0    💬 0    📌 0
Preview
Should we remove XSLT from the web platform? · Issue #11523 · whatwg/html What is the issue with the HTML Standard? XSLT v1.0, which all browsers adhere to, was standardized in 1999. In the meantime, XSLT has evolved to v2.0 and v3.0, adding features, and growing apart f...

WHATWG asks: "Should we remove XSLT from the web platform?"

👉 github.com/whatwg/html/...

#XML heads, make your voices heard!

#webdev

05.08.2025 12:20 — 👍 1    🔁 1    💬 0    📌 0
Preview
NodeIterator - Web APIs | MDN The NodeIterator interface represents an iterator to traverse nodes of a DOM subtree in document order.

TIL: If you ever need to traverse a DOM tree, you don't need to do so manually: NodeIterator is there for you! The API's kinda nuts (the whatToShow property is a bitmask, not that common a construct in #JavaScript), but should work in every browser!

👉 developer.mozilla.org/en-US/docs/W...

#webdev

05.08.2025 10:34 — 👍 2    🔁 1    💬 0    📌 0
Preview
Code.Movie | Declarative animated syntax highlighter Automatically turn code snippets into highlighted step-by-step animations for the web

Code.Movie 0.0.32 adds support for #PHP!

👉 code.movie/blog/php-sup...

Also included: out-of-bounds checks for decorations, improved animation heuristics for #JavaScript and #TypeScript, and full support for @scope rules in #CSS

04.08.2025 11:47 — 👍 1    🔁 1    💬 0    📌 0
Preview
Code.Movie | Declarative animated syntax highlighter Automatically turn code snippets into highlighted step-by-step animations for the web

Code.Movie 0.0.32 adds support for #PHP!

👉 code.movie/blog/php-sup...

Also included: out-of-bounds checks for decorations, improved animation heuristics for #JavaScript and #TypeScript, and full support for @scope rules in #CSS

04.08.2025 11:47 — 👍 1    🔁 1    💬 0    📌 0
Preview
CSS: supports() static method - Web APIs | MDN The CSS.supports() static method returns a boolean value indicating if the browser supports a given CSS feature, or not.

🤯 TIL: there is a #JavaScript equivalent to #CSS support queries; a static method on the global CSS object!

👉 developer.mozilla.org/en-US/docs/W...

#webdev

04.08.2025 09:56 — 👍 1    🔁 1    💬 0    📌 0
Preview
GitHub - WICG/html-in-canvas Contribute to WICG/html-in-canvas development by creating an account on GitHub.

"We propose new HTML Canvas APIs for rendering HTML content into the canvas for Canvas 2D and WebGL."

👉 github.com/WICG/html-in...

#webdev

04.08.2025 07:19 — 👍 1    🔁 1    💬 0    📌 0

I'm no slouch when it comes to writing bad documentation, but BunnyCDN is the GOAT of incomprehensibility.

01.08.2025 09:42 — 👍 1    🔁 0    💬 0    📌 0
Preview
Code.Movie | Declarative animated syntax highlighter Automatically turn code snippets into highlighted step-by-step animations for the web

News from Code.Movie: Improved animation heuristics in version 0.0.31

👉 code.movie/blog/improve...

TLDR: The animation heuristics got better, at least for some corner cases. Also this version has been released for over a month, but I have had no time to write about it 🤷

28.07.2025 14:03 — 👍 0    🔁 2    💬 0    📌 0
Preview
HTML: html transformer drops line breaks between <pre> tags · Issue #10204 · parcel-bundler/parcel 🐛 bug report Parcel's HTML transformer drops line breaks between <pre> tags. Input; <pre> Hello</pre> Output: <pre> Hello</pre> This happens in both dev and production mode, so minification is prob...

Nope, no productive work for me today github.com/parcel-bundl... 🥴

Build tools: not even once! Modern #webdev is a con.

28.07.2025 15:21 — 👍 1    🔁 0    💬 0    📌 0
Preview
Code.Movie | Declarative animated syntax highlighter Automatically turn code snippets into highlighted step-by-step animations for the web

News from Code.Movie: Improved animation heuristics in version 0.0.31

👉 code.movie/blog/improve...

TLDR: The animation heuristics got better, at least for some corner cases. Also this version has been released for over a month, but I have had no time to write about it 🤷

28.07.2025 14:03 — 👍 0    🔁 2    💬 0    📌 0
Preview
CSS: Nested rules lead to invalid output in production mode · Issue #10203 · parcel-bundler/parcel 🐛 bug report Parcel outputs invalid CSS in production mode when a declaration with a var() (and possibly other function values) appears between two nested rules. Example: div { table { color: lime;...

There's my bug report: github.com/parcel-bundl...

Turns out that when #CSS or #JavaScript syntax gets more complex, minifiers have a hard time keeping up. Surprise!

Just uninstall your minifiers. Remember: removing the source of a problem is always more efficient than building a solution.

#webdev

28.07.2025 13:09 — 👍 1    🔁 0    💬 0    📌 0

I love debugging #CSS minifiers actually 🤬

Hot take: minifying source code (be that #CSS or #JavaScript) is obsolete bullshit anyway. GZIP (or whatever) on the server is enough and saves you a bunch of dependencies. And could have saved my afternoon.

#webdev

28.07.2025 12:33 — 👍 3    🔁 0    💬 1    📌 0

Pro tip: "it's supposed to work like this" does not mean it's not bad. ☝️

28.07.2025 10:52 — 👍 1    🔁 0    💬 0    📌 0

Just had to unfollow someone who I have really admired for over 20 years over their glib rejection of valid AI cricitisms. Please, don’t fall prey to the “works for me, what is the problem?” line of argument and believe that washes you clean of the ethical and environmental nightmare.

28.07.2025 06:25 — 👍 10    🔁 1    💬 1    📌 0

@sirpepe is following 20 prominent accounts