;D
--
Daniel Baird
http://tiddlyspot.com (free, effortless TiddlyWiki hosting)
http://danielbaird.com (TiddlyW;nks! :: Whiteboard Koala :: Blog ::
Things That Suck)
I see this often. I think it's a firefox bug.
--
Cheers,
Bob McElrath [Univ. of California at Davis, Department of Physics]
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man."
-- George Bernard Shaw, Maxims for Revolutionists
I'd much appreciate any attention anyone can give to figuring out a
way to reproduce this problem reliably so that we can report it to
Mozilla. It may also be possible to fashion a workaround.
Cheers
Jeremy
--
Jeremy Ruston
mailto:jer...@osmosoft.com
http://www.tiddlywiki.com
1. Go to http://www.tiddlywiki.com
2,3. Open up options, uncheck EnableAnimations
4. Click "view" on GettingStarted
5. Close Raves
Observe
Thanks for the description.
Confirmed for Firefox 1.5.0.9 (FWIW).
-- F.
Edgar Javison
We are each of us angels with only one wing, and we can only fly by embracing one another. ~ Luciano de Crescenzo
If you've got time, do drop by my weblog at http://elj.tiddlyspot.com/
http://trac.tiddlywiki.org/tiddlywiki/ticket/301
Cheers
Jeremy
On 2/17/07, f7o7 <ewi...@gmail.com> wrote:
>
in Story.prototype.closeTiddler replace
else
tiddlerElem.parentNode.removeChild(tiddlerElem);
by
else
{
//# see Ticket #301
tiddlerElem.style.overflow = "hidden";
setTimeout(function(){tiddlerElem.parentNode.removeChild(tiddlerElem)},0);
}
EEK!
While this may seem like a simple tweak, this 'fix' means that
removing a displayed tiddler is now performed asynchronously, and any
code that was calling on closeTiddler() can no longer safely assume
that the corresponding tiddler display elements are actually gone from
the DOM tree by the time the function returns.
This problem shows up in http://www.TiddlyTools.com/#BreadcrumbsPlugin,
where pressing the "Home" link in the breadcrumbs list will close all
open tiddlers, but fails to re-display the DefaultTiddlers. Here's
what's happening:
BreadCrumbs defines "restartHome()", which includes these two lines:
story.closeAllTiddlers();
restart();
closeAllTiddlers() iterates over the story elements and invokes
closeTiddler() on each. Then, restart() checks for story.isEmpty()
before re-displaying the DefaultTiddlers. However, because the fix
for #301 defers the actual element removal, story.isEmpty() still
finds tiddler elements and reports false, even though those tiddler
elements WILL be removed as soon as the timeouts set by closeTiddler()
get triggered.
Although the problem MIGHT be isolated to this one use-case, it will
also have a similar impact on any other use-cases that relied on
closeTiddler() to have an invariant return condition that assures no
tiddler story elements remain after the call is completed.
Given TiddlyWiki's ever-increasing "installed base", it is even more
important to carefully evaluate (and test) the effect of every core
change, no matter how minor it seems, before it is added into the
official codebase where it might create more problems than it fixes!
-e
Eric Shulman
TiddlyTools / ELS Design Studios
While this may seem like a simple tweak, this 'fix' means that
removing a displayed tiddler is now performed asynchronously, and any
code that was calling on closeTiddler() can no longer safely assume
that the corresponding tiddler display elements are actually gone from
the DOM tree by the time the function returns.
... it is even more
important to carefully evaluate (and test) the effect of every core
change, no matter how minor it seems, before it is added into the
official codebase where it might create more problems than it fixes!
I think it is really important to understand why this breadcrumbs
"home" problem *doesn't* exist using the current 2.1.3 build with
animation enabled. Perhaps it is means that your assertion that
closeTiddler() is already asynchronously handled is somehow incorrect
(though your analysis does seem to make sense to me as well)
> > important to carefully evaluate (and test) the effect of every core
> > ...
> I think we all agree on that. I tested the stuff on the systems I have
> available (FireFox 1.5/IE 6, Windows), using a standard TW installation.
I didn't mean to suggest that you were lax in your testing... sorry if
it came out that way... I know that it is hard to cover all the
possible platforms and use-cases, especially in an open source project
with so many active contributors.
> In the given case I assume the fix should be done in the Breadcrumb plugin,
> function restartHome(){
> story.closeAllTiddlers();
> setTimeout(function() {...}, 0);
> }
Is a zero timeout value somehow handled differently by the browser so
that it can be queued up to trigger AFTER all timed triggers have
fired? Otherwise, what would happen if it takes a while to animate
the closing of a tiddler? If the breadcrumb handling isn't somehow
delayed until after the animation has finished, the tiddler DOM
element might still exist when the breadcrumb timeout is triggered,
and restart() should still fail.
hmm....
Perhaps this might work in the BreadcrumbsPlugin restartHome():
...
story.closeAllTiddlers();
while (!story.isEmpty()) continue; // poll for animation to finish
restart();
...
what do you think?
-e
Ah hah! I think I've sussed it!
Breadcrumbs' restartHome() function calls on story.closeAllTiddlers(),
which then invokes story.closeTiddler(title) for each displayed
tiddler. Note that there is an optional second parameter for
closeTiddler(), a boolean flag that has to be TRUE for animation to be
used.
Howvever, story.closeTiddler() is being called with only one param
(the tiddler title), so this flag defaults to FALSE and
story.closeAllTiddlers() *never* used animation. Thus, processing of
story.closeAllTiddlers() always occured synchronously, ensuring that
all tiddlers were actually gone from the DOM tree by the time the
function returns.
This means that the 301 change DOES alter the semantics of the core
behavior for story.closeAllTiddlers() by making it operate
asynchronously, even though animation is NOT used (or desired) in this
case.
I think the best way to fix this would be to re-write
closeAllTiddlers() so that it bypasses the underlying closeTiddler()
call so it can directly implement a synchronous close of all tiddlers,
regardless of timeouts that are used for animation or the #301 fix...
Story.prototype.closeAllTiddlers = function(exclude)
{
clearMessage();
this.forEachTiddler(function(title,element) {
if((title != exclude) && element.getAttribute("dirty") != "true") {
this.scrubTiddler(element);
element.parentNode.removeChild(element);
}
});
window.scrollTo(0,0);
Actually, this gets STUCK in any infinite loop if there are any open
tiddler *editors*, since closeTiddler() will NOT close those tiddlers
(to protect against throwing away any changes those editor textareas
may contain).
Infinite loops are bad. :-(
-e
As a test, I've added the #301 changes, as well as redefining
story.closeAllTiddlers():
http://www.TiddlyTools.com/#CoreTweaks
I'm happy to report that, in combination, these two changes will fix
#301 while still preserving the existing synchronous behavior needed
by the BreadcrumbsPlugin "home" button. I think we should make the
closeAllTiddlers() change part of the #301 fix, so that it won't break
the existing installed base of BreadcrumbsPlugin users (or force them
to have to patch/update the plugin) when they upgrade their core to
TW2.2. Do you concur?
-e
Note that there is an optional second parameter for
closeTiddler(), a boolean flag that has to be TRUE for animation to be
used.
I think the best way to fix this would be to re-write
closeAllTiddlers() so that it bypasses the underlying closeTiddler()
call so it can directly implement a synchronous close of all tiddlers,...
> This approach has the advantage that also the closeAllTiddlers function can
> run without Firefox artefacts, e.g. in case the "closeOthers" command or the
> "closeAll" macro are used by the user. It also avoids duplication of code in
> closeAllTiddlers (just needs to pass through the allowAsync parameter).
> What do you think?
I think that is a much nicer way to handle this... so much so, that
I've just re-written the TiddlyTools CoreTweaks to do as you have
described. It seems to be working well. If you like the code I've
written, feel free to submit it as a core patch for the #301 bug...
-e
If you like the code I've
written, feel free to submit it as a core patch for the #301 bug...
This is an intended NON-change copied as-is from the current TW2.1.3
core. The purpose of scrolling to (0,0) is to ensure that, after
closing ALL tiddlers, the very top of the page, including the header
area, will be visible.
-e
This is an intended NON-change copied as-is from the current TW2.1.3 core
Follow these steps:
1. Go to http://tiddlytools.com/#MainMenu%20Welcome
2. Open up options, display
3. Uncheck animation
4. Click "view" on Welcome
5. Click "fold" and "unfold" repeatedly on MainMenu tiddler.
Watch the text trying to catch up with textareas!