Skip to content

Instantly share code, notes, and snippets.

@juandopazo
Created July 12, 2012 14:32
Show Gist options
  • Select an option

  • Save juandopazo/3098478 to your computer and use it in GitHub Desktop.

Select an option

Save juandopazo/3098478 to your computer and use it in GitHub Desktop.
Allow HTML in a YUI TabView
var _queries = Y.TabviewBase._queries,
_classNames = Y.TabviewBase._classNames;
Y.TabView.prototype._renderTabs = function(contentBox) {
var tabs = contentBox.all(_queries.tab),
panelNode = this.get('panelNode'),
panels = (panelNode) ? this.get('panelNode').get('children') : null,
tabview = this;
if (tabs) { // add classNames and fill in Tab fields from markup when possible
tabs.addClass(_classNames.tab);
contentBox.all(_queries.tabLabel).addClass(_classNames.tabLabel);
contentBox.all(_queries.tabPanel).addClass(_classNames.tabPanel);
tabs.each(function(node, i) {
var panelNode = (panels) ? panels.item(i) : null;
tabview.add({
boundingBox: node,
contentBox: node.one('.' + _classNames.tabLabel),
label: node.one('.' + _classNames.tabLabel).getHTML(),
panelNode: panelNode
});
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment