My users have been getting a strange error in the excanvas code that
says:
"Invalid argument", and the code is happening in initElement here:
if (attrs.width && attrs.width.specified) {
// TODO: use runtimeStyle and coordsize
// el.getContext().setWidth_(attrs.width.nodeValue);
el.style.width = attrs.width.nodeValue + "px";
}
FYI, I am dynamically generating the canvas elements but am just using
them to draw a single straight line from one corner of the element to
the opposite corner, nothing fancy.
The error happens only some of the time but I haven't been able to
reproduce it myself (my users have reported it). I'm not sure if the
"invalid argument" is referring to accessing some property for attrs
or what.
Has anyone else encountered this problem or knows what "Invalid
argument" means?
James
--
erik
I was having the exact same problem in IE and went digging a little.
You are exactly correct about the where the "bug" is manifesting. Here
is the full conditional statement:
if (attrs.height && attrs.height.specified) {
// TODO: use runtimeStyle and coordsize
// el.getContext().setHeight_(attrs.height.nodeValue);
el.style.height = attrs.height.nodeValue + "px";
} else {
el.height = el.clientHeight;
}
Here is my original Canvas definition:
<canvas id="graph" height="150" width="700px"></canvas>
Because the first part of the condition appends "px" to the value of
the Width attribute, essentially "el.style.height" was receiving the
value "700pxpx"; which is an invalid argument value.
If I change my Canvas definition to:
<canvas id="graph" height="150" width="700"></canvas>
... then no worries, mate.
Hope this helps.
- Justin Knowlden