opal / opal-browser

Browser support for Opal.
MIT License
115 stars 36 forks source link

Element.new uses unscoped constant for node class #20

Closed dlee closed 10 years ago

dlee commented 10 years ago
$document["some_section"] #=> instance of Element

class Section
  # not under Browser::DOM::Element
end

$document["some_section"] #=> instance of Section

I think this is a bug with Opal itself not doing module-scoped constant lookup here: https://github.com/opal/opal-browser/blob/master/opal/browser/dom/element.rb#L23

dlee commented 10 years ago

Actually, Opal is behaving properly. const_defined? and const_get return toplevel constants if there are none under the callee.

meh commented 10 years ago

Uhh, nasty bug indeed. I'll get to it soon.

meh commented 10 years ago

Fixed on master.