Hi all,

 I am trying to use mootools for a drag and drop feature and found
that my code does not work in IE -

URL: http://www.ps-wein-neu.de/suche/wein-aromen-baukasten.htm

I debugged this a bit and found the place where the issue is, but
beyond that have no pointers to proceed. Any help is appreciated.

My code that calls the clone method of mootools:
 item.addEvent('mousedown', function(e)
{
   e = new Event(e).stop();
   var el = e.target;
   el = $(el);
  var clone = el.clone()
 }

 Flow inside Mootools script:
 clone
  |__ new Element(this.nodeName.toLowerCase(), attributes)
            |___ Element.initialize
                                   |___ document.newElement(tag, props)
                                                    |__ 
$.element(this.createElement(tag)).set(props)
                                                                         |__ 
Element.set(prop,value)
                                                                                
         |__ $type(prop)

 Now in this flow, the behaviour of function is different between IE &
FF:
function $type(obj){
    if (obj == undefined) return false;
    if (obj.$family) return (obj.$family.name == 'number' && !
isFinite(obj)) ? false : obj.$family.name;
    if (obj.nodeName){
        switch (obj.nodeType){
            case 1: return 'element';
            case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' :
'whitespace';
        }
    } else if (typeof obj.length == 'number'){
        if (obj.callee) return 'arguments';
        else if (obj.item) return 'collection';
    }
    return typeof obj;
};

FF has 'obj.$family' as Undefined whereas IE has value for this as
'[object Object]'. Because of this FF works as it returns back as
Object whereas IE returns as a string.

Thanks,
Srini

Reply via email to