Hi Martin,

If I had to guess, I'd guess that the "array-like" list that is being
returned by dom/getElementsByClass can't be used with CLJS's "for" as
you are trying to do.  Maybe try something like:

(let [els (dom/getElementsByClass active-class-name)]
  (dotimes [i (.-length els)]
    (classes/remove (aget els i) active-class-name)))

Don't know if that will work, but from the getElementsByClass
definition, seems like it should have a length attribute at least (the
code that returns that thing is around here:
http://docs.closure-library.googlecode.com/git/local_closure_goog_dom_dom.js.source.html#line272).

To answer your question, you are not specifically in Closure-land but in
JS-land, in the sense that that error is popping up simply because
something you are calling on some object is not fully supported.  It
seems most likely to me that that's the mismatch between "for" and the
array-like list returned by getElementsByClass, but I may be wrong.

Hope this helps!

DD

(2014/09/03 1:19), Martin Zapata wrote:
> Cheers David! Massive help and definitely lead me in the right
> direction.
> 
> If I could ask for some help that would be much appreciated?
> 
> I think i've nailed it down to a function call which, when I comment
> out the call, works fine. Here is the function below.
> 
> ; Up in ns declaration (:require [goog.dom.classes :as classes] 
> [goog.dom :as dom])
> 
> (def active-class-name "nav-active")
> 
> (defn remove-active-class! [] (doall (for [n (dom/getElementsByClass
> active-class-name)] (classes/remove n active-class-name))))
> 
> What it is meant to do is remove a class on the link so that they are
> no longer in an 'active' state. Kind of implementing CSS :active
> pseudo class.
> 
> When I wrap the call with a try/catch and alert the error, I get
> "Object does not support this property or method" I guess im into
> Closure territory now?
> 
> Thanks! Martin
> 
> On Monday, 1 September 2014 06:03:26 UTC+2, David Della Costa
> wrote:
>> Also, I'm not sure it will give you much better debugging
>> information,
>> 
>> but check out Firebug lite (if you aren't already using it,
>> apologies if
>> 
>> you are) and see if that can help--
>> 
>> 
>> 
>> https://getfirebug.com/firebuglite
>> 
>> 
>> 
>> (2014/08/31 22:43), Martin Zapata wrote:
>> 
>>> Hi all,
>> 
>>> 
>> 
>>> I've got an app that I've built using cljs/quiescent/some other
>>> libs. Testing on IE 8 I'm getting errors when clicking links that
>>> come up with
>> 
>>> 
>> 
>>> "Object doesn't support this property or method cljs.js line
>>> 5054"
>> 
>>> 
>> 
>>> Looking at the file it points to a function as below (line 5054
>>> is the third line in the function).
>> 
>>> 
>> 
>>> What I'd like to know, is what is best way to start looking at
>>> this problem? What would be the best approach to tackle it?
>> 
>>> 
>> 
>>> thanks,
>> 
>>> Martin
>> 
>>> 
>> 
>>> cljs.core.str = function() {
>> 
>>> var a = null, b = function(a) {
>> 
>>> return null == a ? "" : a.toString();
>> 
>>> }, c = function() {
>> 
>>> var b = function(b, c) {
>> 
>>> for (var d = new goog.string.StringBuffer(a.call(null, b)), e =
>>> c;;) {
>> 
>>> if (cljs.core.truth_(e)) {
>> 
>>> d = d.append(a.call(null, cljs.core.first.call(null, e))), e =
>>> cljs.core.next.call(null, e);
>> 
>>> } else {
>> 
>>> return d.toString();
>> 
>>> }
>> 
>>> }
>> 
>>> }, c = function(a, c) {
>> 
>>> var e = null;
>> 
>>> 1 < arguments.length && (e =
>>> cljs.core.array_seq(Array.prototype.slice.call(arguments, 1),
>>> 0));
>> 
>>> return b.call(this, a, e);
>> 
>>> };
>> 
>>> c.cljs$lang$maxFixedArity = 1;
>> 
>>> c.cljs$lang$applyTo = function(a) {
>> 
>>> var c = cljs.core.first(a);
>> 
>>> a = cljs.core.rest(a);
>> 
>>> return b(c, a);
>> 
>>> };
>> 
>>> c.cljs$core$IFn$_invoke$arity$variadic = b;
>> 
>>> return c;
>> 
>>> }(), a = function(a, e) {
>> 
>>> switch(arguments.length) {
>> 
>>> case 0:
>> 
>>> return "";
>> 
>>> case 1:
>> 
>>> return b.call(this, a);
>> 
>>> default:
>> 
>>> return c.cljs$core$IFn$_invoke$arity$variadic(a,
>>> cljs.core.array_seq(arguments, 1));
>> 
>>> }
>> 
>>> throw Error("Invalid arity: " + arguments.length);
>> 
>>> };
>> 
>>> a.cljs$lang$maxFixedArity = 1;
>> 
>>> a.cljs$lang$applyTo = c.cljs$lang$applyTo;
>> 
>>> a.cljs$core$IFn$_invoke$arity$0 = function() {
>> 
>>> return "";
>> 
>>> };
>> 
>>> a.cljs$core$IFn$_invoke$arity$1 = b;
>> 
>>> a.cljs$core$IFn$_invoke$arity$variadic =
>>> c.cljs$core$IFn$_invoke$arity$variadic;
>> 
>>> return a;
>> 
>>> }();
>> 
>>> 
> 
> Thanks
> 

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to