in partnership with mediatemple

Ticket #974 (closed defect: duplicate)

Opened 1 month ago

Last modified 5 days ago

arguments.callee.caller._parent_ error in Opera 9.27

Reported by: bundyo Owned by:
Type: defect Priority: major
Milestone: Mootools version 1.2 Component: Core
Keywords: _parent_ Cc:

Description

This line (1131) from SVN 1535 is spewing an error in Opera 9.27 (didn't test with others), while SVN 1482 is running fine:

return arguments.callee.caller._parent_.apply(this, arguments);

The error backtrace is:

Event thread: mousedown
Error:
name: TypeError?
message: Statement on line 1131: Could not convert undefined or null to object
Backtrace:

Line 1131 of linked script http://10.2.127.122/sadtool/modules/mootools1535nc.js

return arguments.callee.caller._parent_.apply(this, arguments);

Line 4507 of linked script http://10.2.127.122/sadtool/modules/mootools1535nc.js

this.parent(element, options);

Line 1075 of linked script http://10.2.127.122/sadtool/modules/mootools1535nc.js

var self = this.initialize ? this.initialize.apply(this, arguments) : this;

Line 4578 of linked script http://10.2.127.122/sadtool/modules/mootools1535nc.js

return new Drag.Move(this, options);

Line 1829 of inline#1 script in http://10.2.127.122/sadtool/

var drag = par.makeDraggable({droppables : [drop], handle : item});

Line 1944 of linked script http://10.2.127.122/sadtool/modules/mootools1535nc.js

if (condition.call(self, event) === false)

At unknown location

[statement source code not available]

Change History

Changed 1 month ago by bundyo

Just to clarify that

return arguments.callee.caller._parent_.apply(this, arguments);

works fine in the other browsers i tested, namely IE7 and FF2/3.

Changed 1 month ago by kasi

This is because Opera doesn't know function.caller

This would overwrite Class.Mutators.Extends for browsers that do not support caller.(just took the code from trunk 1514) Other browser take the better new way.

(function(){
    (function() {
        if (arguments.callee.caller === undefined) {
            Class.Mutators.Extends = function(self, klass){
                klass = new klass($empty);
                for (var property in klass){
                    var kp = klass[property];
                    var sp = self[property];
                    self[property] = (function(previous, current){
                        if ($defined(current) && previous != current){
                            var type = $type(current);
                            if (type != $type(previous)) return current;
                            switch (type){
                                case 'function':
                                    return function(){
                                        current.parent = this.parent = previous.bind(this);
                                        var value = current.apply(this, arguments);
                                        this.parent = current.parent;
                                        return value;
                                    };
                                case 'object': return $merge(previous, current);
                                default: return current;
                            }
                        }
                        return previous;
                    })(kp, sp);
                }
            };
        
        }
    })();  
})();

I am sure you find a more elegant solution.

KASI

Changed 5 days ago by digitarald

  • status changed from new to closed
  • resolution set to duplicate

Duplicate of #1007

Note: See TracTickets for help on using tickets.