Define a "has listeners for" algorithm on EventTarget
Fix #453
:boom: Error: 500 Internal Server Error :boom:
PR Preview failed to build. (Last tried on Jan 15, 2021, 7:33 AM UTC).
More
PR Preview relies on a number of web services to run. There seems to be an issue with the following one:
:rotating_light: CSS Spec Preprocessor - CSS Spec Preprocessor is the web service used to build Bikeshed specs.
:link: Related URL
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at
[no address given] to inform them of the time this error occurred,
and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.4.10 (Debian) Server at api.csswg.org Port 443</address>
</body></html>
If you don't have enough information above to solve the error by yourself (or to understand to which web service the error is related to, if any), please file an issue.
curl: (22) The requested URL returned error: 400 Bad Request
make: *** [deploy] Error 22
Is this the result of a failed check, or is there a problem with the build?
@annevk ready for review(I think).
@annevk Ping on this one. From your Github timeline it looks like you were away for a couple of weeks, hope you had a nice holiday...
Ok thanks, I think an example of callers would be Step 9 of unload a document, which I guess could read like: If document's Window object has any event listeners that were triggered by the earlier unload event step(...)
Sorry for the continued delay in replies, it'll hopefully get better soon.
I'd expect we'd update that caller to be more specific and no longer reference the previous step. (This might also mean it has to be moved, in case the listeners removing themselves at that step still counts.)
@annevk thanks, comment addressed. Yes you are right about the unload steps, we could reword it and put the link to here in a step before the actual firing of the event. I'd be happy to follow up on that too...
Thanks! @TimothyGu since you've been looking at events and similar algorithms, would you please double check?
It should be fine. I don't know the event dispatching process too well, but could it be possible that when "firing an event at the Window object with legacy target override flag set", event listeners registered on another object were also invoked? I'm guessing no, but it happened to be true then merely checking if the Window object has an unload event listener wouldn't been enough… (body.onload doesn't count, as the event listener is registered on Window still.)
Reminds me of a discussion we had previously at https://github.com/whatwg/dom/issues/453#issuecomment-394246176, because I assumed one would have to check the entire "event-path"...
Actually, we should probably also add a note here to discourage new usage as checking for listeners is bad practice (as we point out in https://dom.spec.whatwg.org/#observing-event-listeners).
Ok, I've added a note, let me know what you think.
Thanks, I tweaked that a bit in a follow-up commit (will squash before landing). Let me know what you think.
As per above, I'm going to wait with landing until Service Workers / HTML are closer to adopting this.
Looks good to me, I previously got a warning when using should not, since it's apparently a non-normative section, and your 'can not' is a nice way around that :)
@gterzian As a note there are many alternatives, like "could not" or "would not." "Can not" isn't really a word.
@TimothyGu thanks! By the way the change is from my use of 'can not'(which was an attempt at avoiding the use of 'should'), to a 'is not', so definitely progress if 'can not' is not a word :)
The reason I wanted to avoid "can not" is that an API designer certainly can rely on it, but they are not supposed to.