Opened 13 years ago
Closed 12 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: | [email protected]… |
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)
Change History (4)
Changed 13 years ago by
Attachment: | bug_VMLFillError.html added |
---|
comment:1 Changed 13 years ago by
Milestone: | → tbd |
---|
comment:3 Changed 12 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
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.
mark all (open) tickets w/blank milestones to be "tbd"; their milestones need to be set to a version number or to "future"