Debugged it to some more extent ...even created a small jfiddle code -

http://jsfiddle.net/MnYgN/

Found to my surprise that the 'clone' method works fine in IE8 in jFiddle
sample I created. But in my code, this doesn't work in IE8. Please take a
look. Quoting code below:

       this.dragcolors.each(function(item)
        {
            item.addEvent('mousedown', function(e)
             {
                e = new Event(e).stop();
                var el = e.target;
                el = $(el);
                var clone = el.clone()
                            .setStyles(el.getCoordinates()) // this returns
an object with left/top/bottom/right, so its perfect
                            .setStyles({'opacity': 0.7, 'position':
'absolute'})
                            .addEvent('emptydrop', function() {
                                     this.dispose();
                             }).inject(document.body);

                this.drag_source = el;
                this.drag_object = clone;
                var drag_colors = clone.makeDraggable({
                                               droppables: [this.dropZone]
                                            }); // this returns the dragged
element

                drag_colors.start(e); // start the event manual
            }.bind(this));
        }.bind(this)
       );



2010/6/30 Fábio M. Costa <[email protected]>

> What is being detected as a string with $type?
> Can you show us some code?
>
>
> --
> Fábio Miranda Costa
> Solucione Sistemas
> Engenheiro de interfaces
> Twitter: fabiomiranda
> http://solucione.info
>
>
> On Wed, Jun 30, 2010 at 9:41 AM, Srinivasan M <[email protected]>wrote:
>
>> Thanks Fabio. I just did that and found that IE7 and FF are working good.
>> Only IE8 is the pain. The exact issue is that mootools '*clone*' does not
>> copy the attributes of the object being cloned. This is because of
>>
>>  clone
>>  |__ new Element(this.nodeName.
>> toLowerCase(), attributes)
>>            |___ Element.initialize
>>                                   |___ document.newElement(tag, props)
>>                                                    |__
>> $.element(this.createElement(tag)).set(props)
>>
>> |__ $type(prop)
>>
>> the $type function checks for "$obj.family.name" which strangely comes
>> out to be a string for I8 and undefined for IE7 and FF. As a result the
>> since the type comes out to be a string (in IE7 & FF) this comes out to be
>> Object, the properties are not copied over in IE8.
>>
>>
>>
>> 2010/6/30 Fábio M. Costa <[email protected]>
>>
>> Srinivasan, you don't know where you are having the problem?
>>> Try IE8 with IE7 mode on and check the console output.
>>>
>>> --
>>> Fábio Miranda Costa
>>> Solucione Sistemas
>>> Engenheiro de interfaces
>>> Twitter: fabiomiranda
>>> http://solucione.info
>>>
>>>
>>>
>>> On Wed, Jun 30, 2010 at 6:19 AM, Srinivasan M <[email protected]>wrote:
>>>
>>>> Hi Piotr - Glad to interact with the creator of jsFiddle :). A big
>>>> thanks to you for developing such a wonderful tool.
>>>>
>>>> I thought the same when Oskar requested for code to be posted in
>>>> jsFiddle. But do you have any clues as to how to make my site work for IE? 
>>>> I
>>>> debugged to the code which I had posted here using Firebug and IE8 inbuilt
>>>> JS debugger.
>>>>
>>>>
>>>> On Wed, Jun 30, 2010 at 2:40 PM, Piotr Zalewa <[email protected]> wrote:
>>>>
>>>>>  Hi Srinivasan,
>>>>>
>>>>> Although the answer is "Yes, you'll be able to do that" I wouldn't
>>>>> recommend it.
>>>>> The idea behind MooShell which is adopted by jsFiddle is to strip down
>>>>> the code to exactly show where the problem is.
>>>>> Copying whole website is pointless as I don't see anyone who will
>>>>> search for the problem in a big and messy (you mentioned mixed Prototype 
>>>>> and
>>>>> MooTools) code.
>>>>>
>>>>> Just my $0.02
>>>>>
>>>>>
>>>>> On 06/30/10 09:59, Srinivasan M wrote:
>>>>>
>>>>> The webpage where the javascript is present is
>>>>> http://www.ps-wein-neu.de/suche/wein-aromen-baukasten.htm
>>>>>
>>>>> This page has used minify library and is using a number of javascript
>>>>> libraries (Prototype, Mootools etc). Would I be able to upload them all to
>>>>> jsfiddle.net?
>>>>>
>>>>> On Wed, Jun 30, 2010 at 12:57 PM, Oskar Krawczyk <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Can you post your code on jsfiddle.net and paste back a link? This
>>>>>> will help in debugging.
>>>>>>
>>>>>> O.
>>>>>>
>>>>>> On 30 Jun 2010, at 02:53, srinigenie wrote:
>>>>>>
>>>>>> > 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
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> "The best way to make your dreams come true is to wake up." - Paul
>>>>> Valery
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> blog  http://piotr.zalewa.info
>>>>> jobs  http://webdev.zalewa.info
>>>>> twit  http://twitter.com/zalun
>>>>> face  http://facebook.com/zaloon
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> "The best way to make your dreams come true is to wake up." - Paul
>>>> Valery
>>>>
>>>
>>>
>>
>>
>> --
>> "The best way to make your dreams come true is to wake up." - Paul Valery
>>
>
>


-- 
"The best way to make your dreams come true is to wake up." - Paul Valery

Reply via email to