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 > <https://groups.google.com/d/msgid/emscripten-discuss/bbf7a80b-733d-4430-b68b-c63a7044372ao%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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.
