lib/hyperstack/ext/component/element.rb in hyper-component-1.0.alpha1.4 vs lib/hyperstack/ext/component/element.rb in hyper-component-1.0.alpha1.5
- old
+ new
@@ -1,13 +1,11 @@
Element.instance_eval do
def self.find(selector)
- selector = begin
- selector.dom_node
- rescue
- selector
- end if `#{selector}.$dom_node !== undefined`
- `$(#{selector})`
+ if `typeof #{selector}['$respond_to?'] == 'function'` && selector.respond_to?(:dom_node)
+ selector = selector.dom_node
+ end
+ `jQuery(#{selector})`
end
def self.[](selector)
find(selector)
end
@@ -35,10 +33,10 @@
# mount_components is useful for dynamically generated page segments for example
# see react-rails documentation for more details
%x{
- $.fn.mount_components = function() {
+ jQuery.fn.mount_components = function() {
this.each(function(e) { ReactRailsUJS.mountComponents(e[0]) })
return this;
}
}
Element.expose :mount_components