这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@tuespetre
Copy link
Contributor

I could not get the test to work with the disabled attribute (jsdom does not implement that attribute) so I just left it out.

@netlify
Copy link

netlify bot commented Sep 12, 2024

Deploy Preview for anchor-position-wpt canceled.

Name Link
🔨 Latest commit c167df4
🔍 Latest deploy log https://app.netlify.com/sites/anchor-position-wpt/deploys/66e4434c3c2dd80008b308cd

@netlify
Copy link

netlify bot commented Sep 12, 2024

Deploy Preview for anchor-polyfill ready!

Name Link
🔨 Latest commit c167df4
🔍 Latest deploy log https://app.netlify.com/sites/anchor-polyfill/deploys/66e4434c609cc80008b68854
😎 Deploy Preview https://deploy-preview-243--anchor-polyfill.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jgerigmeyer jgerigmeyer linked an issue Sep 13, 2024 that may be closed by this pull request
Comment on lines 25 to 26
const promise = new Promise((res) => {
link.onload = res;
Copy link
Member

Choose a reason for hiding this comment

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

I'm fine including disabled here without a test, but we'll need to adjust the promise since onload won't fire for a disabled link. Something e.g.:

Suggested change
const promise = new Promise((res) => {
link.onload = res;
link.disabled = el.disabled;
const promise = new Promise((res) => {
if (link.disabled) {
res(true);
} else {
link.onload = res;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking about this earlier too. I wonder if it might be better to change fetchCSS to just ignore stylesheets with disabled (both link and style)

Copy link
Member

@jgerigmeyer jgerigmeyer Sep 13, 2024

Choose a reason for hiding this comment

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

Let's merge this, and could you open a new issue to consider what to do with disabled link/style elements? It would be a breaking change to ignore disabled stylesheets without a watcher of some sort, since removing the disabled attr would fetch the un-polyfilled styles.

@jgerigmeyer jgerigmeyer requested a review from jamesnw September 13, 2024 14:42
Copy link
Contributor

@jamesnw jamesnw left a comment

Choose a reason for hiding this comment

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

I was going to recommend using el.getAttributes() to get a fuller list, but as you point out in the issue, there's going to need to be some more intentional thought put in on which ones we actually don't want to copy. I'm happy if we look into that on a subsequent PR.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<link> elements are replaced without all of their attributes

3 participants