harmony icon indicating copy to clipboard operation
harmony copied to clipboard

MooTools doesn't load -- object.prototype is undefined

Open tysonmote opened this issue 14 years ago • 1 comments

require 'rubygems'
require 'harmony'
h = Harmony::Page.new
h.load 'http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools.js'

Gives me:

Johnson::Error: object.prototype is undefined

at top level    in untitled document at line 43
at top level    in untitled document at line 43
at top level    in untitled document at line 1432
method evaluate_compiled_script in runtime.rb at line 49
method evaluate in runtime.rb at line 53
method extended in runtime.rb at line 189
method call in js_land_proxy.rb at line 16
method __send__ in js_land_proxy.rb at line 16
method send_with_possible_block in js_land_proxy.rb at line 16
method call_function_property   in ruby_land_proxy.rb at line 110
at top level    in env.js at line 105
method method_missing   in ruby_land_proxy.rb at line 110
method load in page.rb at line 76
method each in page.rb at line 75
method load in page.rb at line 75
at top level    in untitled at line 4

tysonmote avatar Sep 24 '10 02:09 tysonmote

One workaround appears to be to change the lines near #42 in mootools-core.js from: if (legacy && initialize) object.prototype = legacy.prototype; object.prototype.constructor = object;

To:

if (legacy && initialize) object.prototype = legacy.prototype;
if (!object.prototype) object.prototype = {};
object.prototype.constructor = object;

tysonmote avatar Sep 24 '10 03:09 tysonmote