Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider matching ClojureScript behavior regarding js/ #450

Closed
mk opened this issue Nov 25, 2020 · 2 comments
Closed

Consider matching ClojureScript behavior regarding js/ #450

mk opened this issue Nov 25, 2020 · 2 comments

Comments

@mk
Copy link
Collaborator

mk commented Nov 25, 2020

Is your feature request related to a problem? Please describe.
We want to use sci as a replacement for self-hosted cljs. We are passing the options {:classes {'js goog/global :allow :all} to js/ calls working.

One observed difference is property access: js/document.body.innerHTML will work in ClojureScript, but return nil in sci.

Describe the solution you'd like
Allowing me to set an option for sci to make properties work in sci as they do in ClojureScript.

Describe alternatives you've considered
Asking users to use propery access, i.e. (.. js/document -body -innerHTML) instead of js/document.body.innerHTML. For our use case of an online ClojureScript repl the fewer differences in behavior to regular ClojureScript our users need to learn, the better.

Additional context
I have not yet found this behavior documented e.g. on https://clojurescript.org/reference/javascript-api but there is at least one reference in the ClojureScript source of it: https://github.com/clojure/clojurescript/blob/0eaa19f4326f02d4dc4e8660ad5f13329b73e3af/src/main/cljs/clojure/browser/repl.cljs#L186

@mk
Copy link
Collaborator Author

mk commented Nov 25, 2020

Some more examples in ClojureScript are:

I used ag '(\(| )js/\w+\.\w+' to find them and filter out function calls like js/console.log:

borkdude added a commit that referenced this issue Nov 26, 2020
borkdude added a commit that referenced this issue Nov 26, 2020
borkdude added a commit that referenced this issue Nov 26, 2020
@borkdude
Copy link
Collaborator

borkdude commented Dec 7, 2020

@mk If you haven't found any remaining cases, I'll close the issue for now. Feel free to comment with new cases.

@borkdude borkdude closed this as completed Dec 7, 2020
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

No branches or pull requests

2 participants