Skip to content

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

Description

@jacobemcken

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.

Activity

  1. ckirkendall commented on Nov 30, 2013

    @ckirkendall
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions