Permalink
Browse files

Build WidgetButtons.

  • Loading branch information...
1 parent 05ecd63 commit d35e25d28d25a487c6ae3f99ba9a0208c6cca2a0 @ericf committed Apr 26, 2012
View
29 build/widget-buttons/widget-buttons-debug.js
@@ -22,6 +22,12 @@ var YArray = Y.Array,
isString = YLang.isString,
isValue = YLang.isValue;
+// Utility to determine if an object is a Y.Node instance, even if it was
+// created in a different YUI sandbox.
+function isNode(node) {
+ return !!node.getDOMNode;
+}
+
/**
Provides header/body/footer button support for Widgets that use the
`WidgetStdMod` extension.
@@ -353,7 +359,7 @@ WidgetButtons.prototype = {
sectionButtons, atIndex;
// Makes sure we have the full config object.
- if (!Y.instanceOf(button, Y.Node)) {
+ if (!isNode(button)) {
button = this._mergeButtonConfig(button);
section || (section = button.section);
}
@@ -525,9 +531,10 @@ WidgetButtons.prototype = {
var config, buttonConfig, nonButtonNodeCfg,
i, len, action, context, handle;
- // Plug and return an existing Y.Node instance.
- if (Y.instanceOf(button, Y.Node)) {
- return button.plug(ButtonPlugin);
+ // Makes sure the exiting `Y.Node` instance is from this YUI sandbox and
+ // is plugged with `Y.Plugin.Button`.
+ if (isNode(button)) {
+ return Y.one(button.getDOMNode()).plug(ButtonPlugin);
}
// Merge `button` config with defaults and back-compat.
@@ -626,7 +633,7 @@ WidgetButtons.prototype = {
@since 3.5.0
**/
_getButtonDefault: function (button) {
- var isDefault = Y.instanceOf(button, Y.Node) ?
+ var isDefault = isNode(button) ?
button.getData('default') : button.isDefault;
if (isString(isDefault)) {
@@ -656,7 +663,7 @@ WidgetButtons.prototype = {
_getButtonName: function (button) {
var name;
- if (Y.instanceOf(button, Y.Node)) {
+ if (isNode(button)) {
name = button.getData('name') || button.get('name');
} else {
name = button && (button.name || button.type);
@@ -701,7 +708,7 @@ WidgetButtons.prototype = {
@method _mapButton
@param {Node} button The button node to map.
- @param {String} section The `WidgetStdMod` section.
+ @param {String} section The `WidgetStdMod` section (header/body/footer).
@protected
@since 3.5.0
**/
@@ -867,7 +874,7 @@ WidgetButtons.prototype = {
button = buttonConfigs[i];
section = currentSection;
- if (!Y.instanceOf(button, Y.Node)) {
+ if (!isNode(button)) {
button = this._mergeButtonConfig(button);
section || (section = button.section);
}
@@ -1101,11 +1108,13 @@ WidgetButtons.prototype = {
},
/**
- Removes the specified `button` to the buttons map, and nulls-out the
- `defaultButton` if it is currently the default button.
+ Removes the specified `button` from the buttons map (both name -> button and
+ section:name -> button), and nulls-out the `defaultButton` if it is
+ currently the default button.
@method _unMapButton
@param {Node} button The button node to remove from the buttons map.
+ @param {String} section The `WidgetStdMod` section (header/body/footer).
@protected
@since 3.5.0
**/
View
4 build/widget-buttons/widget-buttons-min.js
@@ -1,2 +1,2 @@
-YUI.add("widget-buttons",function(c){var i=c.Array,k=c.Lang,f=c.Object,a=c.Plugin.Button,j=c.Widget,m=c.WidgetStdMod,d=c.ClassNameManager.getClassName,e=k.isArray,l=k.isNumber,b=k.isString,h=k.isValue;function g(){if(!this._stdModNode){c.error("WidgetStdMod must be added to a Widget before WidgetButtons.");}this._buttonsHandles={};}g.ATTRS={buttons:{getter:"_getButtons",setter:"_setButtons",value:{}},defaultButton:{readOnly:true,value:null}};g.CLASS_NAMES={button:d("button"),buttons:j.getClassName("buttons"),primary:d("button","primary")};g.HTML_PARSER={buttons:function(n){return this._parseButtons(n);}};g.NON_BUTTON_NODE_CFG=["action","classNames","context","events","isDefault","section"];g.prototype={BUTTONS:{},BUTTONS_TEMPLATE:"<span />",DEFAULT_BUTTONS_SECTION:m.FOOTER,initializer:function(){this._mapButtons(this.get("buttons"));this._updateDefaultButton();this.after("buttonsChange",c.bind("_afterButtonsChange",this));c.after(this._bindUIButtons,this,"bindUI");c.after(this._syncUIButtons,this,"syncUI");},destructor:function(){f.each(this._buttonsHandles,function(n){n.detach();});delete this._buttonsHandles;delete this._buttonsMap;delete this._defaultButton;},addButton:function(p,s,n){var r=this.get("buttons"),q,o;if(!c.instanceOf(p,c.Node)){p=this._mergeButtonConfig(p);s||(s=p.section);}s||(s=this.DEFAULT_BUTTONS_SECTION);q=r[s]||(r[s]=[]);l(n)||(n=q.length);q.splice(n,0,p);o=i.indexOf(q,p);this.set("buttons",r,{button:p,section:s,index:o,src:"add"});return this;},getButton:function(n,q){if(!h(n)){return;}var p=this._buttonsMap,o;q||(q=this.DEFAULT_BUTTONS_SECTION);if(l(n)){o=this.get("buttons");return o[q]&&o[q][n];}return arguments.length>1?p[q+":"+n]:p[n];},removeButton:function(o,q){if(!h(o)){return this;}var p=this.get("buttons"),n;if(l(o)){q||(q=this.DEFAULT_BUTTONS_SECTION);n=o;o=p[q][n];}else{if(b(o)){o=this.getButton.apply(this,arguments);}f.some(p,function(r,s){n=i.indexOf(r,o);if(n>-1){q=s;return true;}});}if(o&&n>-1){p[q].splice(n,1);this.set("buttons",p,{button:o,section:q,index:n,src:"remove"});}return this;},_bindUIButtons:function(){var n=c.bind("_afterContentChangeButtons",this);this.after({defaultButtonChange:c.bind("_afterDefaultButtonChange",this),visibleChange:c.bind("_afterVisibleChangeButtons",this),headerContentChange:n,bodyContentChange:n,footerContentChange:n});},_createButton:function(s){var p,o,v,r,u,q,n,t;if(c.instanceOf(s,c.Node)){return s.plug(a);}p=c.merge({context:this,events:"click",label:s.value},s);o=c.merge(p);v=g.NON_BUTTON_NODE_CFG;for(r=0,u=v.length;r<u;r+=1){delete o[v[r]];}s=a.createNode(o);n=p.context;q=p.action;if(b(q)){q=c.bind(q,n);}t=s.on(p.events,q,n);this._buttonsHandles[c.stamp(s,true)]=t;s.setData("name",this._getButtonName(p));s.setData("default",this._getButtonDefault(p));i.each(i(p.classNames),s.addClass,s);return s;},_getButtonContainer:function(s,q){var t=m.SECTION_CLASS_NAMES[s],r=g.CLASS_NAMES.buttons,p=this.get("contentBox"),n,o;n="."+t+" ."+r;o=p.one(n);if(!o&&q){o=c.Node.create(this.BUTTONS_TEMPLATE);o.addClass(r);}return o;},_getButtonDefault:function(n){var o=c.instanceOf(n,c.Node)?n.getData("default"):n.isDefault;if(b(o)){return o.toLowerCase()==="true";}return !!o;},_getButtonName:function(o){var n;if(c.instanceOf(o,c.Node)){n=o.getData("name")||o.get("name");}else{n=o&&(o.name||o.type);}return n;},_getButtons:function(o){var n={};f.each(o,function(p,q){n[q]=p.concat();});return n;},_mapButton:function(o,r){var q=this._buttonsMap,n=this._getButtonName(o),p=this._getButtonDefault(o);if(n){q[n]=o;q[r+":"+n]=o;}p&&(this._defaultButton=o);},_mapButtons:function(n){this._buttonsMap={};this._defaultButton=null;f.each(n,function(q,r){var p,o;for(p=0,o=q.length;p<o;p+=1){this._mapButton(q[p],r);}},this);},_mergeButtonConfig:function(q){var n,t,p,s,r,o;q=b(q)?{name:q}:c.merge(q);if(q.srcNode){s=q.srcNode;r=s.get("tagName").toLowerCase();o=s.get(r==="input"?"value":"text");n={disabled:!!s.get("disabled"),isDefault:this._getButtonDefault(s),name:this._getButtonName(s)};o&&(n.label=o);c.mix(q,n,false,null,0,true);}p=this._getButtonName(q);t=this.BUTTONS&&this.BUTTONS[p];if(t){c.mix(q,t,false,null,0,true);}return q;},_parseButtons:function(p){var n="."+g.CLASS_NAMES.button,q=["header","body","footer"],o=null;i.each(q,function(u){var r=this._getButtonContainer(u),t=r&&r.all(n),s;if(!t||t.isEmpty()){return;}s=[];t.each(function(v){s.push({srcNode:v});});o||(o={});o[u]=s;},this);return o;},_setButtons:function(p){var o=this.DEFAULT_BUTTONS_SECTION,q={};function n(u,w){if(!e(u)){return;}var t,r,s,v;for(t=0,r=u.length;t<r;t+=1){s=u[t];v=w;if(!c.instanceOf(s,c.Node)){s=this._mergeButtonConfig(s);v||(v=s.section);}s=this._createButton(s);v||(v=o);(q[v]||(q[v]=[])).push(s);}}if(e(p)){n.call(this,p);}else{f.each(p,n,this);}return q;},_syncUIButtons:function(){this._uiSetButtons(this.get("buttons"));this._uiSetDefaultButton(this.get("defaultButton"));this._uiSetVisibleButtons(this.get("visible"));},_uiInsertButton:function(p,s,o){var r=g.CLASS_NAMES.button,n=this._getButtonContainer(s,true),q=n.all("."+r);n.insertBefore(p,q.item(o));this.setStdModContent(s,n,"after");},_uiRemoveButton:function(r,u,o){var q=c.stamp(r,this),p=this._buttonsHandles,t=p[q],n,s;t&&t.detach();delete p[q];r.remove();o||(o={});if(!o.preserveContent){n=this._getButtonContainer(u);s=g.CLASS_NAMES.button;if(n&&n.all("."+s).isEmpty()){n.remove();this._updateContentButtons(u);}}},_uiSetButtons:function(n){var o=g.CLASS_NAMES.button,p=["header","body","footer"];i.each(p,function(x){var v=n[x]||[],s=v.length,y=this._getButtonContainer(x,s),w=false,r,t,u,q;if(!y){return;}r=y.all("."+o);for(t=0;t<s;t+=1){u=v[t];q=r?r.indexOf(u):-1;if(q>-1){r.splice(q,1);if(q!==t){y.insertBefore(u,t+1);w=true;}}else{y.appendChild(u);w=true;}}r.each(function(z){this._uiRemoveButton(z,x,{preserveContent:true});w=true;},this);if(s===0){y.remove();this._updateContentButtons(x);return;}if(w){this.setStdModContent(x,y,"after");}},this);},_uiSetDefaultButton:function(p,o){var n=g.CLASS_NAMES.primary;p&&p.addClass(n);
-o&&o.removeClass(n);},_uiSetVisibleButtons:function(o){if(!o){return;}var n=this.get("defaultButton");if(n){n.focus();}},_unMapButton:function(p,r){var q=this._buttonsMap,o=this._getButtonName(p),n;if(o){if(q[o]===p){delete q[o];}n=r+":"+o;if(q[n]===p){delete q[n];}}if(this._defaultButton===p){this._defaultButton=null;}},_updateDefaultButton:function(){var n=this._defaultButton;if(this.get("defaultButton")!==n){this._set("defaultButton",n);}},_updateContentButtons:function(o){var n=this.getStdModNode(o).get("childNodes");this.set(o+"Content",n.isEmpty()?null:n,{src:"buttons"});},_afterButtonsChange:function(r){var p=r.newVal,q=r.section,n=r.index,s=r.src,o;if(s==="add"){o=p[q][n];this._mapButton(o,q);this._updateDefaultButton();this._uiInsertButton(o,q,n);return;}if(s==="remove"){o=r.button;this._unMapButton(o,q);this._updateDefaultButton();this._uiRemoveButton(o,q);return;}this._mapButtons(p);this._updateDefaultButton();this._uiSetButtons(p);},_afterContentChangeButtons:function(o){var p=o.src,q=o.stdModPosition,n=!q||q===m.REPLACE;if(n&&p!=="buttons"&&p!==j.UI_SRC){this._uiSetButtons(this.get("buttons"));}},_afterDefaultButtonChange:function(n){this._uiSetDefaultButton(n.newVal,n.prevVal);},_afterVisibleChangeButtons:function(n){this._uiSetVisibleButtons(n.newVal);}};c.WidgetButtons=g;},"@VERSION@",{requires:["button-plugin","cssbutton","widget-stdmod"]});
+YUI.add("widget-buttons",function(c){var i=c.Array,k=c.Lang,f=c.Object,a=c.Plugin.Button,j=c.Widget,n=c.WidgetStdMod,d=c.ClassNameManager.getClassName,e=k.isArray,m=k.isNumber,b=k.isString,h=k.isValue;function l(o){return !!o.getDOMNode;}function g(){if(!this._stdModNode){c.error("WidgetStdMod must be added to a Widget before WidgetButtons.");}this._buttonsHandles={};}g.ATTRS={buttons:{getter:"_getButtons",setter:"_setButtons",value:{}},defaultButton:{readOnly:true,value:null}};g.CLASS_NAMES={button:d("button"),buttons:j.getClassName("buttons"),primary:d("button","primary")};g.HTML_PARSER={buttons:function(o){return this._parseButtons(o);}};g.NON_BUTTON_NODE_CFG=["action","classNames","context","events","isDefault","section"];g.prototype={BUTTONS:{},BUTTONS_TEMPLATE:"<span />",DEFAULT_BUTTONS_SECTION:n.FOOTER,initializer:function(){this._mapButtons(this.get("buttons"));this._updateDefaultButton();this.after("buttonsChange",c.bind("_afterButtonsChange",this));c.after(this._bindUIButtons,this,"bindUI");c.after(this._syncUIButtons,this,"syncUI");},destructor:function(){f.each(this._buttonsHandles,function(o){o.detach();});delete this._buttonsHandles;delete this._buttonsMap;delete this._defaultButton;},addButton:function(q,t,o){var s=this.get("buttons"),r,p;if(!l(q)){q=this._mergeButtonConfig(q);t||(t=q.section);}t||(t=this.DEFAULT_BUTTONS_SECTION);r=s[t]||(s[t]=[]);m(o)||(o=r.length);r.splice(o,0,q);p=i.indexOf(r,q);this.set("buttons",s,{button:q,section:t,index:p,src:"add"});return this;},getButton:function(o,r){if(!h(o)){return;}var q=this._buttonsMap,p;r||(r=this.DEFAULT_BUTTONS_SECTION);if(m(o)){p=this.get("buttons");return p[r]&&p[r][o];}return arguments.length>1?q[r+":"+o]:q[o];},removeButton:function(p,r){if(!h(p)){return this;}var q=this.get("buttons"),o;if(m(p)){r||(r=this.DEFAULT_BUTTONS_SECTION);o=p;p=q[r][o];}else{if(b(p)){p=this.getButton.apply(this,arguments);}f.some(q,function(s,t){o=i.indexOf(s,p);if(o>-1){r=t;return true;}});}if(p&&o>-1){q[r].splice(o,1);this.set("buttons",q,{button:p,section:r,index:o,src:"remove"});}return this;},_bindUIButtons:function(){var o=c.bind("_afterContentChangeButtons",this);this.after({defaultButtonChange:c.bind("_afterDefaultButtonChange",this),visibleChange:c.bind("_afterVisibleChangeButtons",this),headerContentChange:o,bodyContentChange:o,footerContentChange:o});},_createButton:function(t){var q,p,w,s,v,r,o,u;if(l(t)){return c.one(t.getDOMNode()).plug(a);}q=c.merge({context:this,events:"click",label:t.value},t);p=c.merge(q);w=g.NON_BUTTON_NODE_CFG;for(s=0,v=w.length;s<v;s+=1){delete p[w[s]];}t=a.createNode(p);o=q.context;r=q.action;if(b(r)){r=c.bind(r,o);}u=t.on(q.events,r,o);this._buttonsHandles[c.stamp(t,true)]=u;t.setData("name",this._getButtonName(q));t.setData("default",this._getButtonDefault(q));i.each(i(q.classNames),t.addClass,t);return t;},_getButtonContainer:function(t,r){var u=n.SECTION_CLASS_NAMES[t],s=g.CLASS_NAMES.buttons,q=this.get("contentBox"),o,p;o="."+u+" ."+s;p=q.one(o);if(!p&&r){p=c.Node.create(this.BUTTONS_TEMPLATE);p.addClass(s);}return p;},_getButtonDefault:function(o){var p=l(o)?o.getData("default"):o.isDefault;if(b(p)){return p.toLowerCase()==="true";}return !!p;},_getButtonName:function(p){var o;if(l(p)){o=p.getData("name")||p.get("name");}else{o=p&&(p.name||p.type);}return o;},_getButtons:function(p){var o={};f.each(p,function(q,r){o[r]=q.concat();});return o;},_mapButton:function(p,s){var r=this._buttonsMap,o=this._getButtonName(p),q=this._getButtonDefault(p);if(o){r[o]=p;r[s+":"+o]=p;}q&&(this._defaultButton=p);},_mapButtons:function(o){this._buttonsMap={};this._defaultButton=null;f.each(o,function(r,s){var q,p;for(q=0,p=r.length;q<p;q+=1){this._mapButton(r[q],s);}},this);},_mergeButtonConfig:function(r){var o,u,q,t,s,p;r=b(r)?{name:r}:c.merge(r);if(r.srcNode){t=r.srcNode;s=t.get("tagName").toLowerCase();p=t.get(s==="input"?"value":"text");o={disabled:!!t.get("disabled"),isDefault:this._getButtonDefault(t),name:this._getButtonName(t)};p&&(o.label=p);c.mix(r,o,false,null,0,true);}q=this._getButtonName(r);u=this.BUTTONS&&this.BUTTONS[q];if(u){c.mix(r,u,false,null,0,true);}return r;},_parseButtons:function(q){var o="."+g.CLASS_NAMES.button,r=["header","body","footer"],p=null;i.each(r,function(v){var s=this._getButtonContainer(v),u=s&&s.all(o),t;if(!u||u.isEmpty()){return;}t=[];u.each(function(w){t.push({srcNode:w});});p||(p={});p[v]=t;},this);return p;},_setButtons:function(q){var p=this.DEFAULT_BUTTONS_SECTION,r={};function o(v,x){if(!e(v)){return;}var u,s,t,w;for(u=0,s=v.length;u<s;u+=1){t=v[u];w=x;if(!l(t)){t=this._mergeButtonConfig(t);w||(w=t.section);}t=this._createButton(t);w||(w=p);(r[w]||(r[w]=[])).push(t);}}if(e(q)){o.call(this,q);}else{f.each(q,o,this);}return r;},_syncUIButtons:function(){this._uiSetButtons(this.get("buttons"));this._uiSetDefaultButton(this.get("defaultButton"));this._uiSetVisibleButtons(this.get("visible"));},_uiInsertButton:function(q,t,p){var s=g.CLASS_NAMES.button,o=this._getButtonContainer(t,true),r=o.all("."+s);o.insertBefore(q,r.item(p));this.setStdModContent(t,o,"after");},_uiRemoveButton:function(s,v,p){var r=c.stamp(s,this),q=this._buttonsHandles,u=q[r],o,t;u&&u.detach();delete q[r];s.remove();p||(p={});if(!p.preserveContent){o=this._getButtonContainer(v);t=g.CLASS_NAMES.button;if(o&&o.all("."+t).isEmpty()){o.remove();this._updateContentButtons(v);}}},_uiSetButtons:function(o){var p=g.CLASS_NAMES.button,q=["header","body","footer"];i.each(q,function(y){var w=o[y]||[],t=w.length,z=this._getButtonContainer(y,t),x=false,s,u,v,r;if(!z){return;}s=z.all("."+p);for(u=0;u<t;u+=1){v=w[u];r=s?s.indexOf(v):-1;if(r>-1){s.splice(r,1);if(r!==u){z.insertBefore(v,u+1);x=true;}}else{z.appendChild(v);x=true;}}s.each(function(A){this._uiRemoveButton(A,y,{preserveContent:true});x=true;},this);if(t===0){z.remove();this._updateContentButtons(y);return;}if(x){this.setStdModContent(y,z,"after");}},this);},_uiSetDefaultButton:function(q,p){var o=g.CLASS_NAMES.primary;q&&q.addClass(o);p&&p.removeClass(o);
+},_uiSetVisibleButtons:function(p){if(!p){return;}var o=this.get("defaultButton");if(o){o.focus();}},_unMapButton:function(q,s){var r=this._buttonsMap,p=this._getButtonName(q),o;if(p){if(r[p]===q){delete r[p];}o=s+":"+p;if(r[o]===q){delete r[o];}}if(this._defaultButton===q){this._defaultButton=null;}},_updateDefaultButton:function(){var o=this._defaultButton;if(this.get("defaultButton")!==o){this._set("defaultButton",o);}},_updateContentButtons:function(p){var o=this.getStdModNode(p).get("childNodes");this.set(p+"Content",o.isEmpty()?null:o,{src:"buttons"});},_afterButtonsChange:function(s){var q=s.newVal,r=s.section,o=s.index,t=s.src,p;if(t==="add"){p=q[r][o];this._mapButton(p,r);this._updateDefaultButton();this._uiInsertButton(p,r,o);return;}if(t==="remove"){p=s.button;this._unMapButton(p,r);this._updateDefaultButton();this._uiRemoveButton(p,r);return;}this._mapButtons(q);this._updateDefaultButton();this._uiSetButtons(q);},_afterContentChangeButtons:function(p){var q=p.src,r=p.stdModPosition,o=!r||r===n.REPLACE;if(o&&q!=="buttons"&&q!==j.UI_SRC){this._uiSetButtons(this.get("buttons"));}},_afterDefaultButtonChange:function(o){this._uiSetDefaultButton(o.newVal,o.prevVal);},_afterVisibleChangeButtons:function(o){this._uiSetVisibleButtons(o.newVal);}};c.WidgetButtons=g;},"@VERSION@",{requires:["button-plugin","cssbutton","widget-stdmod"]});
View
29 build/widget-buttons/widget-buttons.js
@@ -22,6 +22,12 @@ var YArray = Y.Array,
isString = YLang.isString,
isValue = YLang.isValue;
+// Utility to determine if an object is a Y.Node instance, even if it was
+// created in a different YUI sandbox.
+function isNode(node) {
+ return !!node.getDOMNode;
+}
+
/**
Provides header/body/footer button support for Widgets that use the
`WidgetStdMod` extension.
@@ -353,7 +359,7 @@ WidgetButtons.prototype = {
sectionButtons, atIndex;
// Makes sure we have the full config object.
- if (!Y.instanceOf(button, Y.Node)) {
+ if (!isNode(button)) {
button = this._mergeButtonConfig(button);
section || (section = button.section);
}
@@ -525,9 +531,10 @@ WidgetButtons.prototype = {
var config, buttonConfig, nonButtonNodeCfg,
i, len, action, context, handle;
- // Plug and return an existing Y.Node instance.
- if (Y.instanceOf(button, Y.Node)) {
- return button.plug(ButtonPlugin);
+ // Makes sure the exiting `Y.Node` instance is from this YUI sandbox and
+ // is plugged with `Y.Plugin.Button`.
+ if (isNode(button)) {
+ return Y.one(button.getDOMNode()).plug(ButtonPlugin);
}
// Merge `button` config with defaults and back-compat.
@@ -626,7 +633,7 @@ WidgetButtons.prototype = {
@since 3.5.0
**/
_getButtonDefault: function (button) {
- var isDefault = Y.instanceOf(button, Y.Node) ?
+ var isDefault = isNode(button) ?
button.getData('default') : button.isDefault;
if (isString(isDefault)) {
@@ -656,7 +663,7 @@ WidgetButtons.prototype = {
_getButtonName: function (button) {
var name;
- if (Y.instanceOf(button, Y.Node)) {
+ if (isNode(button)) {
name = button.getData('name') || button.get('name');
} else {
name = button && (button.name || button.type);
@@ -701,7 +708,7 @@ WidgetButtons.prototype = {
@method _mapButton
@param {Node} button The button node to map.
- @param {String} section The `WidgetStdMod` section.
+ @param {String} section The `WidgetStdMod` section (header/body/footer).
@protected
@since 3.5.0
**/
@@ -867,7 +874,7 @@ WidgetButtons.prototype = {
button = buttonConfigs[i];
section = currentSection;
- if (!Y.instanceOf(button, Y.Node)) {
+ if (!isNode(button)) {
button = this._mergeButtonConfig(button);
section || (section = button.section);
}
@@ -1101,11 +1108,13 @@ WidgetButtons.prototype = {
},
/**
- Removes the specified `button` to the buttons map, and nulls-out the
- `defaultButton` if it is currently the default button.
+ Removes the specified `button` from the buttons map (both name -> button and
+ section:name -> button), and nulls-out the `defaultButton` if it is
+ currently the default button.
@method _unMapButton
@param {Node} button The button node to remove from the buttons map.
+ @param {String} section The `WidgetStdMod` section (header/body/footer).
@protected
@since 3.5.0
**/

0 comments on commit d35e25d

Please sign in to comment.