Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#14833 closed defect (invalid)

Recreating dijit.tooltip not working if position is defined

Reported by: eX0du5 Owned by:
Priority: undecided Milestone: tbd
Component: Dijit Version: 1.7.1
Keywords: Cc:
Blocked By: Blocking:

Description

Hi,

I noticed a problem with the re-creation of my dijit.tooltip with the code below:

<html>
<head>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dijit/themes/claro/claro.css">
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo.js"
                data-dojo-config="isDebug: true, parseOnLoad: true">
        </script>
</head>
<body>
<script type="text/javascript">
dojo.require("dijit.form.Button");
dojo.require("dijit.Tooltip");

function Create() {
	new dijit.Tooltip({
		 id: "my_tooltip",
	     connectId: ["my_anchor"],
	     position: "above",
	     label:  "test"
	  });	
}

function Remove() {
	try {
		dijit.byId("my_tooltip").destroy();
	} catch(e) {
		console.log(e); // comes up if you click create before remove
	}
}

</script>
<div style="margin: 50px;" id="my_anchor">content</div>

<button data-dojo-type="dijit.form.Button" type="button" onclick="Create()">Create</button>
<button data-dojo-type="dijit.form.Button" type="button" onclick="Remove()">Remove</button>

</body>
</html>

After recreation, the mouse over will throw an exception which is shown in firebug. If I remove the line "position: above", it works fine.

Change History (3)

comment:1 Changed 8 years ago by bill

Component: GeneralDijit
Resolution: invalid
Status: newclosed

It's invalid to try to create two tooltips, or two of anything, with the same id.

comment:2 Changed 8 years ago by eX0du5

Sorry, but why do I destroy the widget then? You first create it - tooltip works. Then you destroy it - tooltip no longer works (as expected). Then you create it again with equal ID which should work because the first one no longer exists.

comment:3 Changed 8 years ago by bill

OK, should have marked this as pending then. I'll comment in #14839.

Note: See TracTickets for help on using tickets.