Skip to content

Instantly share code, notes, and snippets.

@sdesai
Created May 21, 2010 16:58
Show Gist options
  • Save sdesai/409095 to your computer and use it in GitHub Desktop.
Save sdesai/409095 to your computer and use it in GitHub Desktop.
function MyWidget(config) {
MyWidget.superclass.constructor.apply(this, arguments);
}
MyWidget.NAME = 'mywidget';
MyWidget.ATTRS = {
nodes: {
value: null
}
};
MyWidget.HTML_PARSER = {
nodes: function(srcNode) {
var nodeList = srcNode.all('div.test');
console.log('HTML_PARSER has run and found nodes: ' + nodeList);
return nodeList;
}
};
Y.extend(MyWidget, Y.Widget, {
initializer: function() {
console.log('ATTRS value for "nodes" is: ' + this.get('nodes'));
}
});
console.log('Creating instance of MyWidget without any user configuration');
var myWidgetWithoutUserConfig = new MyWidget({srcNode:".mywidgetcontent"});
myWidgetWithoutUserConfig.render();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment