Ticket #1159 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

findContainingTiddler doesn't work with popups

Reported by: EricShulman Owned by: MartinBudden
Priority: undefined Milestone: 2.6
Component: core Version:
Severity: undefined Keywords:
Cc:

Description

The standard core function, story.findContainingTiddler(elem), does not currently work if invoked from content displayed in a TW popup. This is because the popup DIV itself is actually a child of the document body element, rather than the tiddler in which the popup's 'root element' was rendered.

The current code for findContainingTiddler() is:

Story.prototype.findContainingTiddler = function(e)
{
	while(e && !hasClass(e,"tiddler"))
		e = e.parentNode;
	return e;
};

The following change will add the ability find the containing tiddler when starting from within a popup:

Story.prototype.findContainingTiddler = function(e)
{
    while(e && !hasClass(e,"tiddler"))
        e = hasClass(e,"popup")?Popup.stack[0].root:e.parentNode;
    return e;
};

Basically, it will follow the 'parentNode' branch as usual, unless it encounters a popup... in which case, it uses the popup stack's associated root element instead of the parentNode (which, for a popup would just be the document.body element)

Change History

Changed 2 years ago by FND

  • milestone set to 2.5.4

Changed 2 years ago by MartinBudden

  • owner changed from JeremyRuston to MartinBudden
  • status changed from new to assigned

Changed 2 years ago by MartinBudden

  • status changed from assigned to closed
  • resolution set to fixed

Fixed in changeset:11189

Note: See TracTickets for help on using tickets.