Opened 11 years ago

Closed 11 years ago

#9330 closed defect (fixed)

dijit tooltip.js open function references nonexistant _connectNodes

Reported by: darekana Owned by: bill
Priority: high Milestone: 1.4
Component: Dijit Version: 1.3.1
Keywords: Cc:
Blocked By: Blocking:

Description

dijit/Tooltip.js open function references nonexistant _connectNodes: line 327 in http://svn.dojotoolkit.org/src/dijit/trunk/Tooltip.js

maybe should be "target = target
this._connectNode"?

Change History (5)

comment:1 Changed 11 years ago by bill

Component: GeneralDijit
Milestone: tbd1.4
Owner: changed from anonymous to bill
Status: newassigned

Oh sorry, my fault from [17437].

I removed that attribute but forgot about that reference.

comment:2 Changed 11 years ago by bill

Hmm, the only time this is an issue is when/if open() is called without an argument. Is that what you are doing?

Open() is commented as private (although forgot to use an underscore in the name), and also the target parameter is *not* marked optional, so I'm tempted to just remove this code for finding a default value.

comment:3 in reply to:  2 Changed 11 years ago by darekana

I wanted to wire and create Tooltips on first mouseenter in which case some sort of way to trigger display (either open(target) or _onHover(event)) would be nice.

Probably what I really want is a public onHover(target)... so the delay and stuff works as if it was mouseover a regular tooltip target and the event doesn't have to be there.

	createTooltip: function(target, evt, key) {
		if (typeof key == "undefined") { // try to get from target.id
			var idParts = target.id.split("_");
			key = idParts[idParts.length - 1];
		}
		var wId = "tt_" + key;
		var tip = dijit.byId(wId);
		if (!tip) 
			tip = new ch.Tooltip({
					label: chGlobal.getTooltipLabel(key),
					id: wId
				});
		if (!tip.hasTarget(target)) {
			tip.addTarget(target);
			tip.open(target);
		}
	},

then in onload connect

  dojo.query(".tooltipEnabled")
    .connect("onmouseenter", function(e) {
           createTooltip(e.target);
        })

or html

  <a href="#" onmouseover="createTooltip(this)">...

Maybe there is a better way to handle tons of tooltips?

Thanks for the fast response!

Replying to bill:

Hmm, the only time this is an issue is when/if open() is called without an argument. Is that what you are doing?

Open() is commented as private (although forgot to use an underscore in the name), and also the target parameter is *not* marked optional, so I'm tempted to just remove this code for finding a default value.

comment:4 Changed 11 years ago by bill

I see... although that doesn't explain how you came across this defect, since the problem is only when you *don't* pass an argument to open(), isn't it?

Anyway, I see what you are saying about deferring tooltip creation to speed up page load, although it seems like maybe you would be better off creating a single Tooltip object, connected to all the relevant nodes, and then in the onShow() handler deal w/customizing the tooltip text? That would eliminate the initial cost of creating a bunch of Tooltip objects, although it will take some time to create all the onmouseenter/onmouseleave handlers (but you need those anyway, right?).

comment:5 Changed 11 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [17691]) Remove some unused code from Tooltip. open() is always called w/a target parameter.

Fixes #9330 !strict.

Note: See TracTickets for help on using tickets.