Skip to content

Conversation

keithamus
Copy link
Member

@keithamus keithamus commented Sep 25, 2025

This aligns the spec to Chrome's implementation and WPTs found in web-platform-tests/wpt#29408, by setting the baseUrl of the CSSStyleSheet to be that of the script module's baseUrl.

Refs #11629


/webappapis.html ( diff )

@keithamus keithamus force-pushed the use-script-s-baseurl-for-cssstylesheets branch from d9201c0 to 86fbf69 Compare September 25, 2025 13:43
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good if @nicolo-ribaudo reviewed this too. And maybe @dandclark.

source Outdated

<li><p>Let <var>sheet</var> be the result of running the steps to <span>create a constructed
<code>CSSStyleSheet</code></span> with an empty dictionary as the argument.</p></li>
<code>CSSStyleSheet</code></span> with a dictionary with:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<code>CSSStyleSheet</code></span> with a dictionary with:
<code>CSSStyleSheet</code></span> with

(might have to line break differently after applying this)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh I see, thanks!

Copy link
Member Author

@keithamus keithamus Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind changing the line wrapping but the entire «[ .* ]» chunk will not fit on the 100 column break point on the line above, so it feels right to keep it on one line.

I see other examples do break on «[, so I can put that on the line above, but it feels odd to me.

Copy link
Member

@annevk annevk Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do break inside literals just like we break on whitespace elsewhere, but it might not matter much if we end up applying @zcorpan's rewrapper script.

<li><p>Set <var>script</var>'s <span data-x="concept-script-settings-object">settings
object</span> to <var>settings</var>.</p></li>

<li><p>Let <var>baseUrl</var> be <var>script</var>'s <span data-x="concept-script-base-url">base
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure script's baseURL is valid here -- we just created script in the first step of this algorithm and haven't initialized that field yet.

I see that other "create a module script" algos take the baseURL as a parameter, e.g. see create a javascript module script. It looks to me like "create a CSS module script" also needs that parameter. We'd pass in the "response's URL" as the baseURL here in the same way as is done for WASM module scripts and JS module scripts nearby.

It's a little more plumbing than I thought it'd be in #11629 (comment) but I hadn't realized at the time that the CSS module script's baseURL just gets set to null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants