Small error in the console after clicking inside a loaded video

Related to:

Here is a small video showing the issue:

It looks like removing the click listener here doesn’t work. The next time a click happens, the video-placeholder-container doesn’t exist anymore:

https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/instance-initializers/video-placeholder.js#L16

Probably because of bind usage here:

https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/instance-initializers/video-placeholder.js#L85

Maybe an easy solution would be to use { once: true } in addEventListener instead?

3 Likes

Thanks for the fix @blake!

2 Likes

My pleasure! Thank you for reporting it and for the suggestion :slight_smile:

3 Likes