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

get-prop doesn't work on data attributes #85

Open
jacobemcken opened this issue Nov 30, 2013 · 1 comment
Open

get-prop doesn't work on data attributes #85

jacobemcken opened this issue Nov 30, 2013 · 1 comment

Comments

@jacobemcken
Copy link

I'm working with the data attributes in HTML and found something which I think is a bug.
When getting a property which isn't :value I get undefined. Even though I used set-prop to set the property. get-attr works though.

I have used the following snippet on Firefox 25 and Chrome 31 on Linux (Fedora 20).

(ef/at ["form input[type=text]"]
       (ev/listen :blur (fn [event]
                          (let [node (.-target event)]
                            (ef/at node (ef/set-prop :data-test "a string"))
                            (.log js/console (ef/from node (ef/get-prop :data-test)))
                            (.log js/console (ef/from node (ef/get-attr :data-test)))))))

The first console log outputs undefined the second outputs a string.

@ckirkendall
Copy link
Owner

I will try to reproduce the issue. It certainly would be a bug if I can confirm. I don't see how get-attr is working at all though. Did the dom contain the attribute data-test also? Get prop is very very simple:

(defn get-prop
  "returns the property on the selected element or elements.
   in cases where more than one element is selected you will
   receive a list of values"
  [prop]
  (extr-multi-node
   (fn [pnod]
     (aget pnod (name prop)))))

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