Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix a bug with negative sizes in Internet Explorer 6, 7, 8, and 9 #583

Closed
wants to merge 1 commit into from

2 participants

Curtis Schlak Tomas Alabes
Curtis Schlak

When setting the size of the canvas size in IE to a negative value, the dreaded warning sign appears in the lower left corner of the browser with the "Error on page" message. This commit checks for a negative sign on the width and height and, if one exists, does not set the width or height.

Tomas Alabes
Collaborator

With svg would happen the same. We can't check everywhere if the user inputs invalid values. Thanks anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 4 deletions.
  1. +6 −2 raphael.js
  2. +6 −2 raphael.vml.js
8 raphael.js
View
@@ -5690,8 +5690,12 @@ window.Raphael.vml && function (R) {
this.height = height;
width == +width && (width += "px");
height == +height && (height += "px");
- cs.width = width;
- cs.height = height;
+ if(width[0] !== '-') {
+ cs.width = width;
+ }
+ if(height[0] !== '-') {
+ cs.height = height;
+ }
cs.clip = "rect(0 " + width + " " + height + " 0)";
if (this._viewBox) {
R._engine.setViewBox.apply(this, this._viewBox);
8 raphael.vml.js
View
@@ -848,8 +848,12 @@ window.Raphael.vml && function (R) {
this.height = height;
width == +width && (width += "px");
height == +height && (height += "px");
- cs.width = width;
- cs.height = height;
+ if(width[0] !== '-') {
+ cs.width = width;
+ }
+ if(height[0] !== '-') {
+ cs.height = height;
+ }
cs.clip = "rect(0 " + width + " " + height + " 0)";
if (this._viewBox) {
R._engine.setViewBox.apply(this, this._viewBox);
Something went wrong with that request. Please try again.