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

Events don't behave correctly #50

Open
dubiousdavid opened this issue Mar 20, 2013 · 8 comments
Open

Events don't behave correctly #50

dubiousdavid opened this issue Mar 20, 2013 · 8 comments

Comments

@dubiousdavid
Copy link

The following does not work in any browser I tested.

(listen! :click (fn [evt] (log "button clicked!")))

Nor does

(listen! js/document :click (fn [evt] (log "button clicked!")))
@fwaddle
Copy link

fwaddle commented Apr 21, 2013

Hi,

You need to tell it what you want to listen to:

(listen! (domina/by-id "my-button") :click (js/alert "Woohoo"))

@dubiousdavid
Copy link
Author

js/document is the something in this scenario. It's cool, though. I ended up writing my own dom manipulation/even library. Thanks for the inspiration.

@superbobry
Copy link

@dubiousdavid so what was the problem with the above code?

@dubiousdavid
Copy link
Author

Sorry, not sure what you're referring to. My code or the code posted by fwaddle?

@superbobry
Copy link

My bad, I was referring to your code: is the current implementation of listen! causing the problem or is it the way you use listen!?

@dubiousdavid
Copy link
Author

js/document should be a valid listen target, should it not? You can do this in jQuery, and it works as expected.

@fwaddle
Copy link

fwaddle commented Apr 22, 2013

I'm know very little about jquery and therefore not sure what you're trying to do but when attempting to listen you need to get the element itself like so:

(ev/listen! (.-getElementById js/document) :click (js/alert "Hellllo"))

Anyway is your own dom manipulation library open source or available?

@dubiousdavid
Copy link
Author

My goal is to open-source a bunch of cljs libraries (browser and node.js based) I've been developing for the company I work for. I need to run it past my boss, but I would really like to share with the community, especially since much of the work is inspired by existing projects like domina.

David

On Apr 21, 2013, at 9:53 PM, fwaddle notifications@github.com wrote:

I'm know very little about jquery and therefore not sure what you're trying to do but when attempting to listen you need to get the element itself like so:

(ev/listen! (.-getElementById js/document) :click (js/alert "Hellllo"))

Anyway is your own dom manipulation library open source or available?


Reply to this email directly or view it on GitHub.

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

3 participants