-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
New feature proposal: HTMLScriptElement.supports(type) method #6472
Comments
When implementing |
As for the spec change, it's better to split out the Step 8 of |
Another example is https://github.com/jeremyroman/alternate-loading-modes/blob/main/triggers.md#speculation-rules . FWIW I am cautiously positive on this. Feature-detection interfaces are always a bit tricky, but we have positive experience so far with |
What are the non-standard Limiting the |
It sounds reasonable to me that |
I'm a bit torn. I like the simplicity of that. But then it's totally disconnected from the It does match the |
Supporting only "classic" and "module" sounds good, while it deviates from To align with |
Bug: 1245528, whatwg/html#6472 Change-Id: I9a902504cf692caa73ae7e49fd65895156bbf197
Bug: 1245528, whatwg/html#6472 Change-Id: I9a902504cf692caa73ae7e49fd65895156bbf197
Thank you. Disallowing uppercases sounds good to me. Updated spec change. |
I created a pull request #7008. Could you please review? |
Another point in the design space that just occurred to me is to omit "classic" and use this only for types that have their own dedicated I think I am OK either way, and maybe even slightly prefer keeping "classic" based on the arguments about symmetry with the Worker constructor, but I wanted to mention that possibility. |
Bug: 1245528, whatwg/html#6472 Change-Id: I9a902504cf692caa73ae7e49fd65895156bbf197
Ah interesting; I'm okay with either. |
@guybedford would this be useful to es-module-shims in any way? In particular it would be a simple synchronous way to detect importmap support. |
Yes, it definitely would be useful. I wonder if this could extend to JSON / CSS module script support detections as well? Just removing import maps from that list would be a huge benefit though. |
I think that would require a different entry point, since they are all types of modules. Maybe something like |
A separate note: I like putting this on If we do ever extend workers with more types, we could introduce a separate |
Bug: 1245528, whatwg/html#6472 Change-Id: I9a902504cf692caa73ae7e49fd65895156bbf197
Bug: 1245528, whatwg/html#6472 Change-Id: I9a902504cf692caa73ae7e49fd65895156bbf197 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3133553 Commit-Queue: Tsuyoshi Horo <horo@chromium.org> Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/main@{#918474}
Bug: 1245528, whatwg/html#6472 Change-Id: I9a902504cf692caa73ae7e49fd65895156bbf197 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3133553 Commit-Queue: Tsuyoshi Horo <horo@chromium.org> Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/main@{#918474}
Bug: 1245528, whatwg/html#6472 Change-Id: I9a902504cf692caa73ae7e49fd65895156bbf197 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3133553 Commit-Queue: Tsuyoshi Horo <horo@chromium.org> Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/main@{#918474}
…e) method, a=testonly Automatic update from web-platform-tests Implement HTMLScriptElement.supports(type) method Bug: 1245528, whatwg/html#6472 Change-Id: I9a902504cf692caa73ae7e49fd65895156bbf197 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3133553 Commit-Queue: Tsuyoshi Horo <horo@chromium.org> Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/main@{#918474} -- wpt-commits: e02f4a5db0a268cb888edf0abbf90eff3cd98d3a wpt-pr: 30284
…e) method, a=testonly Automatic update from web-platform-tests Implement HTMLScriptElement.supports(type) method Bug: 1245528, whatwg/html#6472 Change-Id: I9a902504cf692caa73ae7e49fd65895156bbf197 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3133553 Commit-Queue: Tsuyoshi Horo <horo@chromium.org> Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/main@{#918474} -- wpt-commits: e02f4a5db0a268cb888edf0abbf90eff3cd98d3a wpt-pr: 30284
Bug: 1245528, whatwg/html#6472 Change-Id: I9a902504cf692caa73ae7e49fd65895156bbf197 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3133553 Commit-Queue: Tsuyoshi Horo <horo@chromium.org> Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/main@{#918474}
Closes whatwg#6472. See also the explainer at https://github.com/horo-t/explainers/blob/main/script_element_supports.md.
Bug: 1245528, whatwg/html#6472 Change-Id: I9a902504cf692caa73ae7e49fd65895156bbf197 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3133553 Commit-Queue: Tsuyoshi Horo <horo@chromium.org> Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/main@{#918474} NOKEYCHECK=True GitOrigin-RevId: b8b24648e5716bd4e7f7cb77cb792163e8599149
Currently there is no simple way to know what kind of types can be used for
HTMLScriptElement
’stype
attribute.There are several new feature proposals using the script element.
We can use the
nomodule
attribute to detect themodule
type support as this example shows.But there is no unified method to detect such new features. (E.g.: WICG/import-maps#171)
If we have the
HTMLScriptElement.supports(type)
method which is likeHTMLLinkElement.relList.supports()
, we can easily detect such features.The change of the spec will be like this.
The text was updated successfully, but these errors were encountered: