Skip to content

Commit

Permalink
Updated _show, _hide, and _isHidden methods to remove, set, and check…
Browse files Browse the repository at this point in the history
… hidden attribute, respectively. Updated comments to show new defaults and explain back-compat for useing style: display
  • Loading branch information
gerardkcohen committed Mar 25, 2013
1 parent 3ecc2d6 commit f4f516f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/node/js/node-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,23 @@ Y.mix(Y_Node.prototype, {

/**
* The implementation for showing nodes.
* Default is to toggle the style.display property.
* Default is to remove the hidden attribute.
* @method _show
* @protected
* @chainable
*/
_show: function() {
this.removeAttribute('hidden');

// For back-compat we need to leave this in for browsers that
// do not visually hide a node via the hidden attribute
// and for users that check visibility based on style display.
this.setStyle('display', '');

},

_isHidden: function() {
return Y.DOM.getStyle(this._node, 'display') === 'none';
return Y.DOM.getAttribute(this._node, 'hidden') === 'true';
},

/**
Expand Down Expand Up @@ -96,12 +101,17 @@ Y.mix(Y_Node.prototype, {

/**
* The implementation for hiding nodes.
* Default is to toggle the style.display property.
* Default is to set the hidden attribute to true.
* @method _hide
* @protected
* @chainable
*/
_hide: function() {
this.setAttribute('hidden', true);

// For back-compat we need to leave this in for browsers that
// do not visually hide a node via the hidden attribute
// and for users that check visibility based on style display.
this.setStyle('display', 'none');
}
});
Expand Down Expand Up @@ -145,4 +155,4 @@ Y.NodeList.importMethod(Y.Node.prototype, [
* @chainable
*/
'toggleView'
]);
]);

0 comments on commit f4f516f

Please sign in to comment.