From 46b51ebed494c3f605c9dd427fc114189dda5528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20J=2E=20Z=C3=A4hller?= <287836+seezee@users.noreply.github.com> Date: Fri, 19 Dec 2025 17:37:05 -0600 Subject: [PATCH] Update styling.md Updates syntax to replace deprecated import assertion syntax to new import atttributes`with` syntax --- learn/components/styling.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/learn/components/styling.md b/learn/components/styling.md index 6ca6b47..6b5899e 100644 --- a/learn/components/styling.md +++ b/learn/components/styling.md @@ -292,11 +292,11 @@ class FancyArticleElement extends HTMLElement { ### Using CSS Module scripts CSS Module scripts allow developers to import stylesheets as if they were a module script. To do so, use an import -assertion where the `type` is `css` and then you can add the imported stylesheet to the `adoptedStyleSheets` array for +attribute where the `type` is `css` and then you can add the imported stylesheet to the `adoptedStyleSheets` array for the element's shadow root. ```js -import stylesheet from "./fancy-article-element.css" assert { type: "css" } +import stylesheet from "./fancy-article-element.css" with { type: "css" } class FancyArticleElement extends HTMLElement { connectedCallback() { @@ -305,4 +305,10 @@ class FancyArticleElement extends HTMLElement { } ``` +Note that import assertion (the old name for import attributes) has been deprecated. The following will not work in : + +```js +import stylesheet from "./fancy-article-element.css" assert { type: "css" } +``` + [css-custom-properties]: https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties