Skip to content

Conversation

@Michael-S
Copy link
Contributor

This tripped me up, I thought I would help the
next person that came along.

I could be misunderstanding the changes in
#7977
and the discussion around it.

@welcome
Copy link

welcome bot commented Apr 12, 2020

Thank you for submitting a pull request! If this is your first PR, make sure to add yourself to AUTHORS.

@kripken kripken requested a review from juj April 13, 2020 17:01
@kripken
Copy link
Member

kripken commented Apr 13, 2020

Thanks @Michael-S , I believe this is correct, but let's wait for @juj to confirm.

@juj
Copy link
Collaborator

juj commented Apr 14, 2020

Thanks for catching this, the documentation was out of date! I would propose a change along the following lines, if you'd like to update?

diff --git a/site/source/docs/api_reference/html5.h.rst b/site/source/docs/api_reference/html5.h.rst
index e4a93fa5b..aa372b282 100644
--- a/site/source/docs/api_reference/html5.h.rst
+++ b/site/source/docs/api_reference/html5.h.rst
@@ -62,12 +62,12 @@ The typical format of registration functions is as follows (some methods may omi
 
 The ``target`` parameter is the ID of the HTML element to which the callback registration is to be applied. This field has the following special meanings:
 
-  - ``0`` or ``NULL``: A default element is chosen automatically based on the event type, which should be reasonable most of the time.
-  - ``#window``: The event listener is applied to the JavaScript ``window`` object.
-  - ``#document``: The event listener is applied to the JavaScript ``document`` object.
-  - ``#screen``: The event listener is applied to the JavaScript ``window.screen`` object.
-  - ``#canvas``: The event listener is applied to the Emscripten default WebGL canvas element.
-  - Any other string **without a leading hash "#"** sign: The event listener is applied to the element on the page with the given ID.
+  - ``EMSCRIPTEN_EVENT_TARGET_WINDOW``: The event listener is applied to the JavaScript ``window`` object.
+  - ``EMSCRIPTEN_EVENT_TARGET_DOCUMENT``: The event listener is applied to the JavaScript ``document`` object.
+  - ``EMSCRIPTEN_EVENT_TARGET_SCREEN``: The event listener is applied to the JavaScript ``window.screen`` object.
+  - ``0`` or ``NULL``: If building with the option ``-s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1`` (default), ``NULL`` denotes an invalid element. If building with legacy option ``-s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=0`` (not recommended), a default element is chosen automatically based on the event type.
+  - ``#canvas``: If building with legacy option ``-s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=0`` (not recommended), the event listener is applied to the Emscripten default WebGL canvas element. If building with the option ``-s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1`` (default), ``#canvas`` is interpreted as a CSS query selector: "the first element with CSS ID 'canvas'".
+  - Any other string: A CSS selector lookup is performed to the DOM with the passed string, and the the event listener is applied to the first element that matches the query.

@Michael-S
Copy link
Contributor Author

Sorry, I made a git error locally. I've attempted to fix it.

@Michael-S
Copy link
Contributor Author

...and even with the fix, I don't have the option to reopen the pull request. I feel silly opening a second one for something so trivial, but I don't see a better option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants