Both <script> and <iframe> DOM elements can trigger a lot of resource requests. It's true we don't have a real processing model in this document, but we should still probably define here what effects the importance
value given to a top-level <script> or <iframe> will have on their requested subresources. Note: this is different than the dependency graph request prioritization of a module script which is outside of the scope of this discussion.
Here are a few questions:
Should subresources be given the same importance
value as their parent?
In other words, should every request made in the below example all have importance = low
// index.html
<iframe importance=low src=doc.html></iframe>
<script importance=low src=main.js></script>
// doc.html
<img src=https://image.here alt=image>
// main.js
fetch("https://domfarolino.com")
This definitely seems logical to me to get the most benefit out of the Priority Hints effort.
What if subresources have conflicting importance
values?
In other words, what are the resolved importance
values of all of the below requests:
// index.html
<iframe importance=low src=doc.html></iframe>
<script importance=low src=main.js></script>
// doc.html
<img importance=high src=https://image.here alt=image>
// main.js
fetch("https://domfarolino.com", {importance: high})
I'm not sure what the best call to make here is. In my opinion, the two best options are:
- Leave it up to implementations
- Ignore overridden subresource
importance
values, they should just assume that of their parent
What about a script that adds an element to the DOM with a higher importance than the script itself?
<script importance=low src=main.js>
// main.js
let link = document.createElement('link');
link.importance = 'high';
link.......
.....
document.head.appendChild(link);
I'm not even sure if we could bully-down the added element's priority based on who added it to the DOM, but I don't think we should do that in this case. IMO I think it would make sense if the <link>
's ultimate importance
was high
here.
...more example? Thoughts?
I assume it would be good to specify this in the document so people can see how far-reaching and influential an importance
value is on these types of elements.