Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

should we add a markup option? #8

Open
getify opened this issue Apr 7, 2017 · 4 comments
Open

should we add a markup option? #8

getify opened this issue Apr 7, 2017 · 4 comments

Comments

@getify
Copy link
Owner

getify commented Apr 7, 2017

Should we add an option that pre-configures the DOM (maybe just the head?) with elements as if they had been parsed from the markup?

Notably, some elements like <script async> behave differently if parsed in markup as opposed to being added via API calls in code. This option would allow you to mock out what the initial state of that part of the DOM was and have it behave as markup instead of API calls. It would go ahead and "request" any resource URLs from <script>, <link> or <img> elements.

This would then maybe become the preferred way to emulate markup <link rel=preload> elements over what's currently required: to artificially create those with DOM API calls. The timing would of course still be controlled by resources entries.

@getify
Copy link
Owner Author

getify commented Apr 7, 2017

One element that would definitely need to be "parsed" from such an option: <base>. It would of course have to change the document.baseURI setting. Perhaps this would mean we should then remove that baseURI option, so there's no confusion if those two are allowed mismatch.

getify added a commit that referenced this issue Apr 12, 2017
…dyDelay, loadDelay, and preloadDelay, fixing some inconsistencies in tests
@getify
Copy link
Owner Author

getify commented Apr 12, 2017

Also: a challenge here is that any resource requests, except <script async>, that are encountered during the "initial DOM parsing" actually delay the DOMContentLoaded event.

Moreover, if the DOM hasn't yet fired the DOMContentLoaded event, any <script defer> elements need to have their execution set to be no earlier than its firing.

getify added a commit that referenced this issue Apr 13, 2017
@getify
Copy link
Owner Author

getify commented May 3, 2017

@getify
Copy link
Owner Author

getify commented Apr 13, 2020

We can parse the markup with https://github.com/jsdom/jsdom

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant