Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

<FAQENTRY>I'm changing my page but nothing is changing on the screen. Why?</FAQENTRY>

2 views
Skip to first unread message

VK

unread,
Mar 13, 2007, 12:09:50 PM3/13/07
to
As per discussion in the thread
http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/117e4f3a30f4d1c3
I'm proposing to add new FAQ entry:

----------------------------------------------------------------
I'm changing my page but nothing is changing on the screen. Why?
----------------------------------------------------------------

You may be experiencing the repaint delay problem. All existing
browsers do not update graphics context (screen content) until after
the current execution is finished. Until it's finished the DOM changes
are being accumulated but not reflected on the screen. The most
commonly used way to overcome this problem is by using micro-breaks
over setTimeout.

/* repaint delay vulnerable coding : */
function someLongProcess() {
document.getElementById('LoadingMessage').style.visibility =
'visible';
doLongProcess();
document.getElementById('LoadingMessage').style.visibility =
'hidden';
}

In the sample above nothing will work as the coder would expect.
LoadingMessage DOM element will remain invisible on the screen until
after someLongProcess function is fully executed. Only after that all
graphics context changes will be applied in one bulk, so
LoadingMessage element will be changed to visible and to hidden right
after that, so for the viewer it will not appear at all.

/* repaint delay aware coding : */
function someLongProcess() {
document.getElementById('LoadingMessage').style.visibility =
'visible';
window.setTimeout(doLongProcess, 60);
}

function doLongProcess() {
// long process;
document.getElementById('LoadingMessage').style.visibility =
'hidden';
}

----------------------------------------------------------------

Some notes to the FAQ text:
1) I'm struggling to find the right term for "the current execution is
finished". It is not really finished - that can be a few processes
over setInterval for instance. "current thread" or "current flaw" is
bad IMHO as well as because of terminology confusion (JavaScript
doesn't implement threaded model). Ideas?

2) This issue is really a "bug qualifying feature" - it forces to use
modularity based not on the programming logic but on graphics engine
weakness. So I think to file a feature request to Bugzilla based on
this FAQ. It doesn't matter that "everyone does the same" - some day a
UA should appear that does it not.

3) If anyone has timу it would be interesting to check if the "soft
break" would works, so something like:

function someLongProcess() {

window.setTimeout("document.getElementById('LoadingMessage').style.visibility
= 'visible';", 60);
doLongProcess();
document.getElementById('LoadingMessage').style.visibility =
'hidden';
}

I can tell pretty sure that it will fail for synchronious XHR calls
where the suggested "hard break" is the only option. But maybe for
some other cases like the one in the thread I linked?


P.S. Yeah, I know... Started laud on rounding FAQ and ended up will
all another unrelated FAQ. The problem with the rounding FAQ is that
it is now in E=mc^2 state. I don't mean it's so genius :-) I mean that
while the suggestion itself is short and simple, the explanation and
proof of "why?" requires a whole big article I have to write first.
But this FAQ is still in my schedule.

VK

unread,
Mar 14, 2007, 1:25:10 PM3/14/07
to
On Mar 13, 7:09 pm, "VK" <schools_r...@yahoo.com> wrote:
> As per discussion in the threadhttp://groups.google.com/group/comp.lang.javascript/browse_frm/thread...

> I'm proposing to add new FAQ entry:
>
> ----------------------------------------------------------------
> I'm changing my page but nothing is changing on the screen. Why?
> ----------------------------------------------------------------

Any comments or is it accepted as it is?

Richard Cornford

unread,
Mar 14, 2007, 4:57:38 PM3/14/07
to
VK <school...@yahoo.com> wrote
> On Mar 13, 7:09 pm, VK wrote:
<snip>

>> I'm proposing to add new FAQ entry:
<snip>

> Any comments or is it accepted as it is?

Why do you think an assertion of yours about your own intentions needs
acceptance (or, presumably, rejection)?

Richard.

Randy Webb

unread,
Mar 14, 2007, 8:51:21 PM3/14/07
to
VK said the following on 3/14/2007 1:25 PM:

Or is it that the people who might comment on it haven't had time? It is
so full of things that are incoherent that it's difficult to know where
to start. Rest assured, it is not "accepted as it is".

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

Dr J R Stockton

unread,
Mar 15, 2007, 12:59:49 PM3/15/07
to
In comp.lang.javascript message <et9njv$phl$1$8300...@news.demon.co.uk>
, Wed, 14 Mar 2007 20:57:38, Richard Cornford
<Ric...@litotes.demon.co.uk> posted:


It is presumptuous for a failed FAQ maintainer to criticise the efforts
of one who is undoubtedly active.

VK's efforts can be judged easily enough by appearances and general
response3s - there is no need for you to do a general public vendetta.

--
(c) John Stockton, Surrey, UK. REPLYyyww merlyn demon co uk Turnpike 6.05.
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes precede replies. Snip well. Write clearly. Mail no News.

0 new messages