[英]How to understand the event which not dispatched by task queue in event loop of spec?
If you search the HTML spec for the phrase “fire an event” , you'll see cases it says “queue a task to fire an event” and places it just says ”fire an event“ without “queue a task” .如果你在 HTML 规范中搜索短语“fire an event” ,你会看到这样的例子它说“queue a task to fire an event”,并放置它只是说“fire an event”而不是“queue a task” 。 For example :
例如:
Each document has a current document readiness .
每个文档都有一个当前的文档准备情况。 … When the value is set, the user agent must fire an event named
readystatechange
at theDocument
object .… 当该值被设置时,用户代理必须在
Document
对象上触发一个名为readystatechange
的事件。
Compare that language above to the language in the following spec excerpt :将上述语言与以下规范摘录中的语言进行比较:
… the user agent must, if the loads were successful, queue a task to fire an event named
load
at thelink
element …...用户代理必须,如果加载成功,则将任务排队以在
link
元素处触发名为load
的事件...
So when the spec instead of saying “queue a task to fire an event” just says “fire an event”, then the event doesn't go into the task queue but instead must essentially be fired synchronously.因此,当规范而不是说“将任务排入队列以触发事件”而只是说“触发事件”时,则该事件不会进入任务队列,而是本质上必须同步触发。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.