views:

852

answers:

4

im currently working on the Tips.js from mootools library and my code breaks on the line that has those el.$tmp and console says its undefined can anybody help me?

+1  A: 

I'd suggest taking your question and posting it, along with a link to the page to either/or/and:

http://mooforum.net

http://groups.google.com/group/mootools-users/topics

That's the community that swarms with it.

Now as for answering it here - I'd need a lot more information (code example?)

keif
A: 

Hmmm. I'm not exactly sure what el.$tmp is a reference to in MooTools but a message stating "console is undefined" is probably because someone was trying to log to the Firebug (or another) console and that object does not exist if you don't have Firebug and friends.

If you don't have http://getfirebug.com'>Firebug installed for Firefox then you might give it a shot. See if you can find the console statement and remove it. Also, if you aren't using Firefox, you can use Firebug Lite in IE, Safari, or Opera.

Eric Wendelin
he said that the console was saying that el.$tmp is undefined, not that console was undefined.
nickf
A: 

oh im currently using mootools 1.11 (for the sake of other third party plugins) so i guess i cant check out the official forums anyway it seems i've found my answer,

it's really hard to convince my workmates to provide me with valid html markups and to think that im working on a non-table less page imagine the crap i had to work on lols thanks anyways :)

lock
+1  A: 

in 1.11 (haven't checked in 1.2+) $tmp is a reference to the element itself, created and used internally by the garbage collector:

var Garbage = {

    elements: [],

    collect: function(el){
     if (!el.$tmp){
      Garbage.elements.push(el);
      el.$tmp = {'opacity': 1};
     }
     return el;
    },

    trash: function(elements){
     for (var i = 0, j = elements.length, el; i < j; i++){
      if (!(el = elements[i]) || !el.$tmp) continue;
      if (el.$events) el.fireEvent('trash').removeEvents();
      for (var p in el.$tmp) el.$tmp[p] = null;
      for (var d in Element.prototype) el[d] = null;
      Garbage.elements[Garbage.elements.indexOf(el)] = null;
      el.htmlElement = el.$tmp = el = null;
     }
     Garbage.elements.remove(null);
    },

    empty: function(){
     Garbage.collect(window);
     Garbage.collect(document);
     Garbage.trash(Garbage.elements);
    }

};

the lines el.$tmp = {'opacity': 1}; (in collect method above) and el.htmlElement = el.$tmp = el = null; (in trash method above) are the only places in the source where this property is assigned that i could find, although it's called by various other methods, such as Element.setOpacity and Element.getStyle (specifically, only to return opacity value), as well as methods in the Tips class

1.2 might not have this issue, but in any case, hope that helps and sorry i couldn't help more

brillyfresh