dom icon indicating copy to clipboard operation
dom copied to clipboard

Define a "has listeners for" algorithm on EventTarget

Open gterzian opened this issue 7 years ago • 16 comments

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.

gterzian avatar Jun 28 '18 10:06 gterzian

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?

gterzian avatar Jun 28 '18 10:06 gterzian

@annevk ready for review(I think).

gterzian avatar Jun 28 '18 10:06 gterzian

@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...

gterzian avatar Jul 30 '18 07:07 gterzian

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(...)

gterzian avatar Aug 06 '18 14:08 gterzian

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 avatar Aug 08 '18 09:08 annevk

@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...

gterzian avatar Aug 08 '18 18:08 gterzian

Thanks! @TimothyGu since you've been looking at events and similar algorithms, would you please double check?

annevk avatar Aug 09 '18 09:08 annevk

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.)

TimothyGu avatar Aug 10 '18 01:08 TimothyGu

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"...

gterzian avatar Aug 10 '18 08:08 gterzian

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).

annevk avatar Aug 10 '18 12:08 annevk

Ok, I've added a note, let me know what you think.

gterzian avatar Aug 10 '18 14:08 gterzian

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.

annevk avatar Aug 13 '18 13:08 annevk

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 avatar Aug 13 '18 20:08 gterzian

@gterzian As a note there are many alternatives, like "could not" or "would not." "Can not" isn't really a word.

TimothyGu avatar Aug 13 '18 21:08 TimothyGu

@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 :)

gterzian avatar Aug 13 '18 21:08 gterzian

The reason I wanted to avoid "can not" is that an API designer certainly can rely on it, but they are not supposed to.

annevk avatar Aug 14 '18 07:08 annevk