So I'm attempting to create a canvas object in a jQueryUI widget that has a width and height specified by the user. Then fill that canvas with a gradient.
Doing it this way doesn't work, the width of the fillrect is much too narrow
this.canvas = $("<canvas/>", { width: this.options.width, height: this.options.height }).appendTo(this.element);
However doing it this way works
this.canvas = $("<canvas width=\""+ this.options.width + "\" height=\""+ this.options.height + "\"/>").appendTo(this.element);
What is the difference between the two methods?