-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thirdparty javascript library Pure.js exposed methods causing error #33
Comments
looking at the pure.js code - it's possible that the Element.expose(:render) call is not exposing the correct render method as the pure.js code for jquery support looks like this: jquery:function(){
jQuery.fn.extend({
directives:function(directive){
this._pure_d = directive; return this;
},
compile:function(directive, ctxt){
return $p(this).compile(this._pure_d || directive, ctxt);
},
render:function(ctxt, directive){
return jQuery( $p( this ).render( ctxt, this._pure_d || directive ) );
},
autoRender:function(ctxt, directive){
return jQuery( $p( this ).autoRender( ctxt, this._pure_d || directive ) );
}
});
return function(n, sel){
return jQuery(n).find(sel);
};
}, |
@kingsleyh try this: require 'pure.min'
require 'native' # adds #to_n
require 'opal-jquery'
Element.expose :render
data = {
who: 'BeeBole!',
site: 'http://beebole.com'
}
directive = {
a: 'who',
'a@href'=>'site'
}
Element.find('div.template').render(data.to_n, directive.to_n) hashes are not the same as literal js objects |
Aha thanks - after a change to the require lines - this works: require "opal" Document.ready? do Element.expose :render data = { Element.find('div.template').render(data.to_n, directive.to_n) end I assumed the opal magic was translating ruby hashes into the js world. |
I hope this is the right project to log this.
I'm trying to use opal-jquery with the pure.js (http://beebole.com/pure/documentation/get-started/) library
however when I expose the :render method - I get an error from the pure.js as if it's being triggered when exposed.
This is my application.rb
and the error:
Please let me know if you have any suggestions about this.
The text was updated successfully, but these errors were encountered: