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

CloseWatcher constructor is unclear on what getEnabledState should be set to. #10920

Open
keithamus opened this issue Jan 16, 2025 · 5 comments
Assignees
Labels
clarification Standard could be clearer

Comments

@keithamus
Copy link
Contributor

What is the issue with the HTML Standard?

The establish a close watcher algorithm is "given" a window, a list of steps cancelAction, a list of steps closeAction, and an algorithm that returns a boolean getEnabledState.

Step 2 of new CloseWatcher(options) is:

Let closeWatcher be the result of establishing a close watcher given this's relevant global object, with:

  1. cancelAction given canPreventClose being to return the result of firing an event named cancel at this, with the cancelable attribute initialized to canPreventClose.
  2. closeAction being to fire an event named close at this.

At no point does this mention what the getEnabledState algorithm should be. It seems as though it should be an algorithm returning true?

/cc @domenic @mfreed7

@keithamus keithamus added the clarification Standard could be clearer label Jan 16, 2025
@mfreed7
Copy link
Contributor

mfreed7 commented Jan 16, 2025

That's like a function pointer that returns a boolean that is true if the close watcher should be enabled at any given point. It's called when closewatcher wants to start running things, and it's provided by e.g. the closedby code.

@annevk
Copy link
Member

annevk commented Jan 16, 2025

Yes, but it's not being supplied for new CloserWatcher() at the moment. @keithamus is politely pointing out that 8029d4f introduced a regression.

@keithamus
Copy link
Contributor Author

keithamus commented Jan 16, 2025

I understand where I wasn't clear in my questioning.

At no point does this mention what the getEnabledState algorithm should be

Here I mean "the closewatcher construction steps do not define what the given getEnabledState is", leaving it open for interpretation if it is []() -> bool { return true; } or []() -> bool { return false; }

@lukewarlow

This comment has been minimized.

@domenic

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer
Development

No branches or pull requests

5 participants