create3000 / cobweb

Cobweb is now X_ITE
https://github.com/create3000/x_ite
Other
10 stars 5 forks source link

X3D.getBrowser arguments #40

Closed andreasplesch closed 7 years ago

andreasplesch commented 7 years ago

http://create3000.de/cobweb/accessing-the-external-browser/

documents the argument to getBrowser as a string: getBrowser(selector : String)

On the other hand, getBrowser also accepts a dom element object as an argument value: getBrowser(dom)

It works because jquery $(selectorStringOrDom) accepts both selector strings and dom objects. In case of multiple X3DCanvases, this is often convenient when unique selector strings are not immediately available. For example, cobweb_dom uses getBrowser in this way. The SAI spec. does not have a requirement one way or the other.

Intended or not, this behaviour could be explained on the web page since it is useful.

There is also the question which browser is returned in case the selector matches multiple X3DCanvas elements. The first one? This could be a separate issue.

create3000 commented 7 years ago

I agree with you, this feature is very usefull. I updated the documentation and wrote a simple example how to use. Thanks!