Skip to content

Instantly share code, notes, and snippets.

@brianjmiller
Created March 23, 2011 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianjmiller/883760 to your computer and use it in GitHub Desktop.
Save brianjmiller/883760 to your computer and use it in GitHub Desktop.
YUI positive/negative Node method
Y.Node.prototype.setNumberSignClass = function (value) {
var POSITIVE = 'positive',
NEGATIVE = 'negative';
if (value < 0) {
this.replaceClass(POSITIVE, NEGATIVE);
}
else if (value > 0) {
this.replaceClass(NEGATIVE, POSITIVE);
}
else {
this.removeClass(POSITIVE);
this.removeClass(NEGATIVE);
}
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment