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

Discussion in 'Javascript' started by VK, Mar 13, 2007.

  1. VK

    VK Guest

    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, Mar 13, 2007
    #1
    1. Advertising

  2. VK

    VK Guest

    On Mar 13, 7:09 pm, "VK" <> 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?
    VK, Mar 14, 2007
    #2
    1. Advertising

  3. VK <> 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.
    Richard Cornford, Mar 14, 2007
    #3
  4. In comp.lang.javascript message <et9njv$phl$1$>
    , Wed, 14 Mar 2007 20:57:38, Richard Cornford
    <> posted:
    >VK <> 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)?



    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.
    Dr J R Stockton, Mar 15, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,747
    Smokey Grindel
    Dec 2, 2006
  2. owl
    Replies:
    2
    Views:
    862
  3. Devin Jeanpierre
    Replies:
    2
    Views:
    427
    Devin Jeanpierre
    Feb 14, 2012
  4. VK
    Replies:
    19
    Views:
    145
    Dr J R Stockton
    Jan 30, 2007
  5. VK
    Replies:
    3
    Views:
    73
    David Mark
    Feb 11, 2008
Loading...

Share This Page