Opened 11 years ago

Closed 11 years ago

#7048 closed defect (wontfix)

Dojo VML generation requires attached node if calling Shape.setFill

Reported by: guest Owned by: Eugene Lazutkin
Priority: high Milestone: future
Component: DojoX GFX Version: 1.1.1
Keywords: gfx vml fill Cc: nayewah@…
Blocked By: Blocking:

Description

Tested On:

  • Dojo 1.1.1
  • nightly build (Jun 24, 2008)
  • Environment is Windows XP, Firefox 2.0.0.14, Internet Explorer 7

Affects: Browsers which use VML (i.e. Internet Explorer)

Summary: The following code should draw a red square (full HTML file is attached). If PASS == true, it works in IE and Firefox. If PASS == false, it works in Firefox but not in IE.

dojo.require("dojox.gfx");				

var PASS = false; // set to false to cause page error in IE, true otherwise

dojo.addOnLoad(startTest);

function startTest() {
	// get a real node or create an unattached node
	var node = PASS ? dojo.byId("testholder") : dojo.doc.createElement("div");

	// draw on this node				
	var surface = dojox.gfx.createSurface(node, 100, 100);
	surface.createRect({x: 20, y: 20, width: 50, height: 50}).setFill("red"); // the error is caused by setFill

	// if the node is not already attached, attach it to something
	if (!PASS) dojo.byId("testholder").appendChild(node);
}

The HTML body is:

<body>
	<div id="testholder"></div>
</body>

Detail: The VML generation libraries in Dojo expect the DOM node passed to dojox.gfx.createSurface to be attached to the main tree. One cannot create a node (dojo.doc.createElement), draw on it and then attach it later. The error occurs when Shape.setFill function is called.

This problem has been traced to dojox/gfx/vml.js:143, where "this.rawNode.fill" is unconditionally dereferenced (it is undefined if the node is unattached) causing an error.

This problem arose while trying to write a Node Creator function for dojo.dnd.Source that creates a node with graphics.

Workaround: My specific workaround was to defer drawing graphics until after the Node Creator function is completed, and the node is attached. I don't have a general workaround.

Attachments (1)

bug_VMLFillError.html (2.3 KB) - added by guest 11 years ago.

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by guest

Attachment: bug_VMLFillError.html added

comment:1 Changed 11 years ago by bill

Milestone: tbd

mark all (open) tickets w/blank milestones to be "tbd"; their milestones need to be set to a version number or to "future"

comment:2 Changed 11 years ago by Eugene Lazutkin

Milestone: tbdfuture

Moving all open ticketd to the future.

comment:3 Changed 11 years ago by Eugene Lazutkin

Resolution: wontfix
Status: newclosed

After the investigation I concluded that this is a true VML bug. We cannot watch for when surface's parent will be placed or taken out of the DOM, and therefore we cannot fix the problem. You can file a bug report with Microsoft, but I doubt they have a will to fix numerous VML bugs.

Note: See TracTickets for help on using tickets.