Opened 7 years ago

Closed 7 years ago

#14839 closed defect (invalid)

Recreating dijit.tooltip after DESTROY not working if position is defined

Reported by: eX0du5 Owned by: eX0du5
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 after destruction of my dijit.tooltip with the code below. First create the tooltip and it works as expected. Now destroy the widget to free the ID for it. Tooltip does no longer work - as expected. Now create a new tooltip with the same ID as the destroyed one and you will get problems in certain cases.

My referenced ticket 14833 was closed and I could not reopen it. The only choice I had was to add a comment but "leave ticket closed".

If you still think that it must be impossible to create a tooltip with the same ID - after - the tooltip was destroyed (and its ID), please clarify what "destroy()" is useful for.

Also calling destroyRecursive() makes no difference here. But the documentation states: "This is the generic "destructor" function that all widget users should call to cleanly discard with a widget. Once a widget is destroyed, it is removed from the manager object."

So I would expect no side effects at all after destroyRecursive() has been called.

<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 7 years ago by bill

Owner: set to eX0du5
Status: newpending

Test case looks invalid because position is supposed to be an array. After I change it to an array, it's working fine for me.

BTW, please attach files using the attach file button.

comment:2 Changed 7 years ago by eX0du5

Status: pendingnew

I wasn't aware that it is an array. I copied the creation from some documentation site (not yours) and did not notice the exception until 1.7.1. But thanks for pointing it out.

comment:3 Changed 7 years ago by bill

Resolution: invalid
Status: newclosed

OK, glad that solves it.

Note: See TracTickets for help on using tickets.