-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core(scripts): move to ScriptElements artifact #7920
Conversation
I think #7882 is going to be satisfied by structured data parsing. But for this PR independent of that issue, I can see the argument in going general like the other e.g. doesn't Basically the more general we get the more widely useful these get (like if you want to write a |
Maybe it's inevitable, like if you want to give warnings on invalid We could make help structurally in the artifact shape, like dividing the top level |
Not AFAICT. We never checked the type before, just if it had content and didn't have a src, which is the same as what's happening now. Also, the type is almost always This change shouldn't meaningfully impact the breadth of what we collect. It primarily impacts the properties and amount of data we provide about each script. If there are scripts with a src that weren't fetched for some reason, then those are new, but they won't have content so there's not much I can imagine one might try to do with them. |
I definitely like the idea of helping consumers, but IMO the benefit of consistentcy of |
Oh, that's a good point. Inline glsl output definitely ends up in
but we need to know what the type was :)
Doing something like making the structure of the data into documentation of the possible pitfalls means you can't forget it (like a |
if you're referring to the inline scripts here, you'll be glad to learn this has only existed for 28 days, so it's not that old :) I agree that it will be easy to overlook and worth some of our attention to document/highlight/etc, but seeing as there's only a single usage of this artifact currently and who knows how it will be consumed, I'm just saying I'm not sure it's worth crafting bespoke artifact shapes for each |
@hoten any thoughts here since you were just touching |
this was surprising to me. In order to fix that, we would need the type... good thing this PR adds it to the artifact! let's follow up with an explicit check for JS scripts in that audit. I do see most use cases of |
IMO, we should just normalize the type in the artifact in the followup that fixes I think doing anything beyond that puts the cart before the horse a bit. Are people writing plugins that consume script element contents mostly going to target javascript? I'm not convinced the answer is yes :) The most obvious first plugins to me are actually targeting non-standard script types like json-ld or framework-specific template content. I think this highlights more that we need robust guides for consuming artifacts to help folks think through what they intend to flag, so they don't write the same bugs we do 😆 I'm going to go ahead and merge this as a step forward, and we can always discuss the ideal way to guide plugin author usage of our artifacts in the future. @hoten did you say that to mean you wanted to take the followup or shall I? |
sounds good
go for it! |
Summary
Moves
Scripts
artifact toScriptElements
and includes information about all script elements on the page.Related Issues/PRs
#6747 #7882