Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong behavior with propagationImmediateStopped #17072

Open
smallmain opened this issue May 30, 2024 · 0 comments
Open

wrong behavior with propagationImmediateStopped #17072

smallmain opened this issue May 30, 2024 · 0 comments
Labels
Bug Needs Triage Needs to be assigned by the team

Comments

@smallmain
Copy link

smallmain commented May 30, 2024

Cocos Creator version

3.8.2

System information

MacOS

Issue description

For the sake of accuracy of expression, I will use Chinese next(without google translate).

实际行为:
node-event-processor.ts

// Event.AT_TARGET
// checks if destroyed in capturing callbacks
event.eventPhase = 2;
event.currentTarget = owner;
if (this.capturingTarget) {
    this.capturingTarget.emit(event.type, event);
}
if (!event.propagationImmediateStopped && this.bubblingTarget) {
    this.bubblingTarget.emit(event.type, event);
}

在捕获与冒泡阶段,propagationImmediateStopped 没有任何作用,仅用于阻止不向目标阶段的冒泡监听的事件,甚至在目标阶段的监听事件途中设置的话,也不影响剩余的 callbacks

文档描述:

propagationImmediateStopped: 立即停止当前事件的传递,事件甚至不会被分派到所连接的当前目标。

问题:
现在文档与代码的行为是不一致的,那么,哪个行为是正确的?

然后,事件系统的行为是否应该实现得与 W3C 规范一致?
https://dom.spec.whatwg.org/#stop-immediate-propagation-flag

顺便说句,现在的代码实现太古怪了,propagationImmediateStopped 的作用仅仅是跳过 AT_TARGET 目标阶段,后续依然会进行冒泡。

Relevant error log output

No response

Steps to reproduce

.

Minimal reproduction project

No response

@smallmain smallmain added Bug Needs Triage Needs to be assigned by the team labels May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Needs to be assigned by the team
Projects
None yet
Development

No branches or pull requests

1 participant