javascript - Do Backbone.js views require jQuery or Zepto? (Or: why am I getting “Uncaught TypeError: undefined is not a function”?) -
javascript - Do Backbone.js views require jQuery or Zepto? (Or: why am I getting “Uncaught TypeError: undefined is not a function”?) -
i’m starting out backbone.js. i’ve subclassed backbone.model
, backbone.view
:
var message = backbone.model.extend(); var messageview = backbone.view.extend({ tagname: 'div', classname: 'message', template: _.template('{{ html }}'), render: function(){ this.template({ html: this.model.html }); this.el.classname.append(' ' + this.model.type); homecoming this; } });
i’ve attempted create instance of each:
var message = new message({html: html, type: type}); var messageview = new messageview({model: message});
the lastly line line causes error (in chrome 12): uncaught typeerror: undefined not function
. traces error function f.extend.make
in backbone.js.
the backbone.js documentation on view.make
says:
convenience function creating dom element of given type (tagname), optional attributes , html content. used internally create initial view.el
.
view.make
in phone call backbone.view.extend
?
1) documentation states requires
either jquery ( > 1.4.2) or zepto.
2) view component tightly coupled jquery/zepto api. reimplement it, if utilize backbone.js extensively, reimplement whole interface.
but maybe works little use-case, becuase of tight coupling not guarantee works.
javascript jquery backbone.js zepto
Comments
Post a Comment