css-anchor-positioning icon indicating copy to clipboard operation
css-anchor-positioning copied to clipboard

[BUG] Data attributes get stripped from stylesheet `<link>`s

Open tysongach opened this issue 1 year ago • 0 comments

Describe the bug

The polyfill appears to be stripping data attributes.

Without the polyfill, my link looks like this:

<link rel="stylesheet" href="/assets/application-3282d104.css" data-turbo-track="reload" media="screen">

And when I add the polyfill, I get this:

<link rel="stylesheet" href="blob:http://localhost:3000/ae9daae1-2ee9-44e5-914b-2a829a711088">

Note that media also gets stripped and should be kept, but I believe https://github.com/oddbird/css-anchor-positioning/pull/243 resolves that. Looking at those code changes, I don’t believe it accounts for data attributes, though.

To Reproduce Use the polyfill.

Expected behavior Existing data attributes should still exist on the link when polyfill is applied.

Browsers tested on macOS, Firefox 131

Additional context I’m seeing this issue in a Rails application with Turbo.

tysongach avatar Oct 02 '24 21:10 tysongach