setExpression takes client processor to 100%

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jack Wright

    #1

    setExpression takes client processor to 100%

    Dear All,

    I have been trying to use the following:

    document.getEle mentById('someI d').setExpressi on('someExpress ion');

    This works ok.

    But in my actual implementation, I have over 20 different elements
    which need to be positioned using this method. When I made the code, I
    found that my CPU would be at 100% for even trival events such as
    mouseover() and mouseout()

    Am I doing something wrong?

    Thanks and regards,
    Jack
  • Richard Cornford

    #2
    Re: setExpression takes client processor to 100%

    "Jack Wright" <sunil@volcanom ail.com> wrote in message
    news:8f556eeb.0 402120004.5c228 eaf@posting.goo gle.com...[color=blue]
    >I have been trying to use the following:
    >
    >document.getEl ementById('some Id').setExpress ion('someExpres sion');
    >
    >This works ok.
    >
    >But in my actual implementation, I have over 20 different
    >elements which need to be positioned using this method.[/color]

    While you can position elements using that method (though only on recent
    IE browsers) it is doubtful that you *need* to. There are plenty of
    other ways of positioning elements, including method that will work
    across many (all) dynamic browsers.
    [color=blue]
    >When I made the code, I found that my CPU would be at 100% for even
    >trival events such as mouseover() and mouseout()[/color]

    Yes, expressions get applied frequently and repeatedly, if you use more
    than a couple it is easy to overload IE, and the more complex the
    expression the more work is needed for each.
    [color=blue]
    >Am I doing something wrong?[/color]

    The balance of probability is that you don't need to position elements
    with an expression and that identifying when you do need to position
    them will allow you to implement their positioning in a way that doesn't
    overburden the browser.

    For animated positioning some sort of timer driven activity would
    probably do. Animation is smooth at 40 millisecond intervals (though
    browser timers are rarely capable of achieving that rate, or that
    precision). Otherwise, event driven re-positioning would be better, an
    initial placement and then re-positioning in response to onresize and/or
    user interaction.

    And for some re-positioning, say in response to user's re-setting their
    display font size, an appropriate use of CSS units for positioning may
    avoid the need to involve javascript in the process at all.

    Richard.


    Comment

    Working...