gpt4 book ai didi

javascript - 这是初始化事件的默认值 "cancelable"

转载 作者:行者123 更新时间:2023-12-02 14:37:15 28 4
gpt4 key购买 nike

在我读到的规范中:

The bubbles and cancelable attributes must return the values they were initialized to.

我找不到指出事件默认行为的段落。它可以取消吗?不是吗?它是不确定的吗?

最佳答案

在每种情况下,它都可以初始化为不同的值。请参阅 Firing events 的引用:

Fire in the context of DOM is short for creating, initializing, and dispatching an event. Fire an event makes that process easier to write down. If the event needs its bubbles or cancelable attribute initialized, one could write "fire an event named submit with its cancelable attribute initialized to true".

但也可以初始化为 false。来自 HTML5 Scripting 的示例:

Fire a simple event named afterscriptexecute that bubbles (but is not cancelable) at the script element.

何时 firing a simple event ,默认不可取消:

Firing a simple event named e means that a trusted event with the name e, which does not bubble (except where otherwise stated) and is not cancelable (except where otherwise stated), and which uses the Event interface, must be created and dispatched at the given target.

关于javascript - 这是初始化事件的默认值 "cancelable",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37353437/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com