You can use goog.dom/getChildren to get the children (I think it will
exclude the non-Nodes such as text and comments ) but it will return
an HTMLCollection doesn t implement ISeq, so you need to transform it
to a regular js array with goog.array/toArray.

something along these lines:

(ns dom-manip-example
  (:require [goog.dom :as g-dom]
            [goog.array :as g-array]))

(defn children
  [el]
  (g-array/toArray (g-dom/getChildren el))


I would suggest you have a look at goog.dom.query it makes that kind
of stuff trivial (it s dojo.query, css selector based queries), but be
carefull it also returns HTMLCollections most of the time if not
always.


Have fun!

On Sep 10, 6:06 pm, Timothy Baldridge <tbaldri...@gmail.com> wrote:
> I'm trying to do something like this in ClojureScript:
>
>         (classes/add (nth (children (dom/getElement "topbar")) idx)
>                          "selected"))
>
> However I'm not sure what "children" should be. I tried (.children but
> that doesn't seem to work with nth. So I guess, in general, how do I
> return the children of a DOM node as a seq?
>
> Thanks,
>
> Timothy
>
> --
> “One of the main causes of the fall of the Roman Empire was
> that–lacking zero–they had no way to indicate successful termination
> of their C programs.”
> (Robert Firth)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to