Yeah, changing the parameter name from "target" to "targetSelector" or
"cssSelector" sounds good.

The behavior is something that changed a year or two ago,
querySelector being a more flexible way to identify a target element.
It used to denote an element ID. There was a deprecation period, an
option to flip between the two conventions, etc. and at some point the
migration was completed. You can still get to the old behavior with
Emscripten linker flag -s
DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=0.

ti 27. lokak. 2020 klo 20.17 Brion Vibber ([email protected]) kirjoitti:
>
> Even if the name 'target' is kept, the documentation for the parameter should 
> definitely be changed to indicate it's a CSS selector -- the current wording 
> is very unclear.
>
> -- brion
>
> On Tue, Oct 27, 2020 at 10:36 AM Floh <[email protected]> wrote:
>>
>> I just realized that I massively misunderstood the target parameter in 
>> functions like emscripten_webgl_create_context() (e.g. see documentation 
>> here: 
>> https://emscripten.org/docs/api_reference/html5.h.html#c.emscripten_webgl_create_context),
>>  and that all my code only worked by accident because I used the string 
>> "canvas" as target name (which doesn't work with more than one WebGL canvas 
>> on a page).
>>
>> This target parameter isn't the element **id**, but a **CSS selector** 
>> (https://www.w3schools.com/cssref/css_selectors.asp)
>>
>> I seem to remember that there was a documentation about the convention used 
>> in those target strings (e.g. what '#' actually means), and I could've sworn 
>> that the form "#canvas" was some outdated emscripten-specific 
>> special-case-name and that the "new way" to name the target element would be 
>> "canvas" instead, but I can't find this anymore no matter how much Google-fu 
>> I'm trying to conjure.
>>
>> IMHO the whole thing would be a lot less confusing if this parameter 
>> wouldn't be called 'target' but 'selector' or even 'css_selector' at least 
>> in the documentation. That says immediately what this string means for webby 
>> people, and for non-webby people it's easy to google.
>>
>> Just my 2ct :)
>> -Floh.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "emscripten-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/emscripten-discuss/bbf7a80b-733d-4430-b68b-c63a7044372ao%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/emscripten-discuss/CAFnWYTn4UKFwHgYVJQ3jFc%2B7kZCkmS2GCyfUzfYjuRVHDm6doA%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CA%2B6sJ-2Kj%3DKoYNYssEH6fG%2B_g7XPyBVvxNObp1jH7Lt1LJ6Y0Q%40mail.gmail.com.

Reply via email to