惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
C
Check Point Blog
博客园 - Franky
月光博客
月光博客
T
Tenable Blog
博客园 - 聂微东
Cyberwarzone
Cyberwarzone
The GitHub Blog
The GitHub Blog
C
CERT Recently Published Vulnerability Notes
Scott Helme
Scott Helme
IT之家
IT之家
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
CXSECURITY Database RSS Feed - CXSecurity.com
F
Full Disclosure
博客园 - 司徒正美
Project Zero
Project Zero
Y
Y Combinator Blog
A
Arctic Wolf
美团技术团队
博客园 - 叶小钗
S
Securelist
F
Fortinet All Blogs
T
Threatpost
T
Threat Research - Cisco Blogs
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
酷 壳 – CoolShell
酷 壳 – CoolShell
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
Recorded Future
Recorded Future
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Schneier on Security
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
P
Privacy International News Feed
博客园_首页
S
SegmentFault 最新的问题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
P
Proofpoint News Feed
Cisco Talos Blog
Cisco Talos Blog
AWS News Blog
AWS News Blog
阮一峰的网络日志
阮一峰的网络日志
G
Google Developers Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
雷峰网
雷峰网
P
Proofpoint News Feed
Latest news
Latest news
G
GRAHAM CLULEY

Recent Commits to design-principles:main

Event names should use the present tense (#592) Disambiguate when to add global event handlers (#612) · w3ctag/design-principles@41fee41 Handle non-fully-active documents (#597) chore: fix bikeshed warning about multiple definitions of the <a> ele… · w3ctag/design-principles@6ec7e11 Guidance on extensibility patterns: main spec revision vs registries … Un-escape ampersands in a URL to avoid a bikeshed bug. · w3ctag/design-principles@031a3de Trim trailing whitespace. Rewrite the "removing features" section, incorporating "Support Exist… · w3ctag/design-principles@62fc770 Replace asking for users for consent with designing for user intent (… Clarify when details should go on events vs targets (#585) · w3ctag/design-principles@79c2b78 Avoid abbreviations generally (#600) · w3ctag/design-principles@9fc15ba Update ethical-web-principles links and bibrefs (#601) · w3ctag/design-principles@63b43c9 Clean up link-defaults. · w3ctag/design-principles@993e58e Remove trailing whitespace (#593) · w3ctag/design-principles@98f4a02 Ignore index.html at the root. (#586) Fix example in Keep attributes in sync (#591) · w3ctag/design-principles@afb192e Remove notion of asking for consent to reveal AT use (#589) · w3ctag/design-principles@c35b9cd Reference HTTP WG style guide (#587) · w3ctag/design-principles@81e3ff2 Add 'Choose the Appropriate WebIDL Construct for Data and Behavior' (…
Add principles for task sources (#590) · w3ctag/design-principles@444a329
marcoscacere · 2025-10-21 · via Recent Commits to design-principles:main
Original file line numberDiff line numberDiff line change

@@ -2325,6 +2325,38 @@ See also:

23252325
23262326

* [Command–query separation on Wikipedia](https://en.wikipedia.org/wiki/Command–query_separation)

23272327
2328+

<h3 id="prefer-existing-task-sources">Prefer existing task sources</h3>

2329+
2330+

Use existing [=task sources=] for dispatching work where possible.

2331+
2332+

Only create a new [=task source=] when there is a clear reason to do so.

2333+

Specs use [=task sources=] to group related work (or "[=tasks=]") so UAs can schedule them sensibly.

2334+

A task is queued on a task source,

2335+

and each task source is associated with a task queue for an [=/event loop=].

2336+

Order is guaranteed within a source, while the UA chooses which queue to service next.

2337+
2338+

Use the generic or preexisting task sources whenever possible.

2339+

HTML defines [[html#generic-task-sources|generic task sources]] meant for broad reuse across specs.

2340+

This includes, but is not limited to:

2341+

the [=DOM manipulation task source=],

2342+

the [=user interaction task source=],

2343+

and the [=networking task source=].

2344+

If your feature matches one of these categories,

2345+

queue on that source rather than creating a new one.

2346+

Doing so improves interoperability, predictability, and performance scheduling across the platform.

2347+
2348+

Adding a task source has performance and complexity costs

2349+

that all browser implementations pay.

2350+

Only mint a new task source when you have a concrete, testable need.

2351+

For example, when the feature's timing/execution model must be isolated

2352+

from the generic task sources

2353+

(e.g., media elements get their own media element event task source to align with decoder/timeline semantics).

2354+
2355+

When writing a spec, prefer HTML's wrapper algorithms

2356+

([=queue a global task=], [=queue an element task=])

2357+

and avoid relying on a particular [=/event loop=].

2358+

And only be explicit about the event loop when appropriate (see also [[#event-design]]).

2359+
23282360

<h2 id="event-design">Event Design</h2>

23292361
23302362

<h3 id="one-time-events">Use promises for one time events</h3>