Opened 10 years ago

Closed 10 years ago

#10593 closed defect (wontfix)

dijit.Tooltip open() fails if no DOMNode passed in

Reported by: ebeslagic Owned by:
Priority: high Milestone: tbd
Component: Dijit Version: 1.4.0
Keywords: Cc:
Blocked By: Blocking:

Description

In version 1.4.0, dijit.Tooltip's open() method fails. When using either compressed or uncompressed version from CDN and trying to execute something like dijit.byId('test_tooltip').open(); the error message is: "No match found"

If I switch to anything from 1.1.1 to 1.3.2, this code works fine. See test case on: http://data.baltimoresun.com/tooltip.php?version=1.4.0

A working version can be seen here: http://data.baltimoresun.com/tooltip.php?version=1.3.2

To test, click on the "fire" link - it fails in 1.4.0 but works in all other tested versions.

Test code listing:

<html>
<head>
<script 
	type="text/javascript" 
	djConfig="parseOnLoad: true,isDebug: true" 
	src="http://ajax.googleapis.com/ajax/libs/dojo/1.4.0/dojo/dojo.xd.js.uncompressed.js"
></script>
<link 
	rel="stylesheet" 
	type="text/css" 
	href="http://ajax.googleapis.com/ajax/libs/dojo/1.4.0/dojo/resources/dojo.css" 
	media="all"
/>
<link 
	rel="stylesheet" 
	type="text/css" 
	href="http://ajax.googleapis.com/ajax/libs/dojo/1.4.0/dijit/themes/tundra/tundra.css" 
	media="all"
/>
<script type="text/javascript">
	dojo.require("dijit.Tooltip");
	dojo.require("dojo.parser");
	
	function fire() {
		dijit.byId('test_tooltip').open();
	}
</script>
</head>

<body class="tundra">
<div style="padding:2em">
<div>
	<span id="tooltip_anchor">Some text</span> <-- moving mouse over this always works
</div>

<div style="padding:2em">
	<a href="javascript:fire()">Fire tooltip</a> <-- clicking this fails in 1.4.0<br/>
</div>

<span 
	dojoType="dijit.Tooltip" 
	closable="false" 
	connectId="tooltip_anchor" 
	id="test_tooltip"
>Please enter your valid E-mail address</span>

</div>

</body>
</html>

Change History (3)

comment:1 Changed 10 years ago by bill

Summary: dijit.Tooltip open() method brokendijit.Tooltip open() fails if no DOMNode passed in

In general you shouldn't be calling the open() method, as dijit.showTooltip() is more appropriate when you want to manually display a tooltip.

As for your test case, open() takes a target DOMNode attribute and that has always been documented (even in 1.3). There was an undocumented feature that calling open() w/out an argument would open the tooltip on the first registered conectId (or in your test case the only registered connectId).

Can you call dijit.showTooltip("Please enter e-mail", dojo.byId("tooltip_anchor") or call open w/the right parameter (dojo.byId("tooltip_anchor"))?

comment:2 Changed 10 years ago by ebeslagic

Bill, thanks much for the follow-up. The suggestion worked well in 1.4.0:

dijit.showTooltip("new text?", dojo.byId("tooltip_anchor"));

Indeed I must have originally missed how to properly open a tooltip since 1.2, but, it was frustrating to experience an effect of version differences after hours of troubleshooting (at least hours for a novice like me.) I'm guessing that this undocumented feature was purposely phased out, but I would suggest to reinstate it for sake of future compatibility.

comment:3 Changed 10 years ago by bill

Resolution: wontfix
Status: newclosed

I wouldn't say "purposefully phased out" but there I did some refactoring on Tooltip which made it troublesome to support.

I'm going to close this ticket for now, if more people get tripped up by this I'll add in something so open() without an argument works again.

Note: See TracTickets for help on using tickets.