getify/Mock-DOM-Resources

should we add a `markup` option?

开放

#8 创建于 2017年4月7日

 (4 条评论) (0 个反应) (0 位负责人)JavaScript (6 个派生)github user discovery
help wanted

仓库指标

星标
 (26 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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.

贡献者指南