Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#14100 closed defect (fixed)

[regression][patch][cla] dojox.gfx.svg.Rect setShape no longer checks if this.shape.r has a valid value

Reported by: ben hockey Owned by: Eugene Lazutkin
Priority: high Milestone: 1.7
Component: DojoX GFX Version: 1.7.0b1
Keywords: Cc:
Blocked By: Blocking:

Description

previously in dojox.gfx.svg.Rect, setShape had some code like this:

if (this.shape.r) {
  this.rawNode.setAttribute("ry", this.shape.r);
  this.rawNode.setAttribute("rx", this.shape.r);
}

now it is:

if ("r" in this.shape) {
  this.rawNode.setAttribute("ry", this.shape.r);
  this.rawNode.setAttribute("rx", this.shape.r);
}

this causes an error if this.shape.r is undefined.

Error: Invalid value for <rect> attribute ry="undefined"
Error: Invalid value for <rect> attribute rx="undefined"

probably a better option would be:

if (this.shape.r != null) {
  this.rawNode.setAttribute("ry", this.shape.r);
  this.rawNode.setAttribute("rx", this.shape.r);
}

NOTE: intentionally using != instead of !== so that null and undefined or rejected but 0 is accepted.

Change History (3)

comment:1 Changed 8 years ago by ben hockey

Summary: [regression] dojox.gfx.svg.Rect setShape no longer checks if this.shape.r has a valid value[regression][patch][cla] dojox.gfx.svg.Rect setShape no longer checks if this.shape.r has a valid value

comment:2 Changed 8 years ago by ben hockey

Resolution: fixed
Status: newclosed

In [26881]:

fix regression from r26233. fixes #14100 !strict

comment:3 Changed 8 years ago by Adam Peller

Milestone: tbd1.7
Note: See TracTickets for help on using tickets.