Ticket #2530996 (accepted enhancement)

Reporter


Ryan Cannon
Opened: 08/24/11
Last modified: 07/23/12
Status: accepted
Type: enhancement

Owner


Matt Sweeney
Target Release: FUTURE
Priority: P3 (normal)
Summary: Node: unify or warn for incorrect use of setStyle method.
Description:

Conflating the syntax of the setStyle and setStyles methods of node is a simple mistake that is difficult to track down and easy to make.

Y.one(document.body).setStyles("opacity", 0); // fails silently
Y.one(document.body).setStyle({ opacity: 0 }); // fails silently

The solution is either to unify the method:

Y.Node.prototype._oldSetStyle = Y.Node.prototype.setStyle;
Y.Node.prototype.setStyle = function (key, value) {
if (Y.Lang.isString(key)) { this._oldSetStyle(key, value); }
else { this.setStyles(key); }
};

Or to throw exceptions for incorrect usage of the methods.

Type: enhancement Observed in Version: 3.4.0
Component: Node Severity: S4 (low)
Assigned To: Matt Sweeney Target Release: FUTURE
Location: API Documentation Priority: P3 (normal)
Tags: node, usability Relates To:
Browsers: All
URL:
Test Information:

Change History

Matt Sweeney

YUI Developer

Posted: 11/7/11
  • location changed to API Documentation

Matt Sweeney

YUI Developer

Posted: 11/7/11
  • milestone changed to 3.5.0
  • priority changed to P3 (normal)
  • status changed from new to accepted

Matt Sweeney

YUI Developer

Posted: 02/1/12
  • milestone changed from 3.5.0 to 3.6.0

Matt Sweeney

YUI Developer

Posted: 07/23/12
  • milestone changed from 3.6.0 to FUTURE