javascript - Does manipulating a hidden DOM element affect performance? -


i have page 3 charts rendered via highcharts. users access page via tablet. charts "live data" charts, update every second new data. @ given time, 1 chart visible.

when charts hidden (display:none), html still being updated every second, affect performance? make difference if removed chart's containing element dom while it's hidden, , appended element in when showing chart again? chart still updated every second when removed dom, wouldn't part of dom.

when charts hidden (display:none), html still being updated every second, affect performance?

yes, affects performance if it's hidden. example $('#fooelement') inside script still go through dom trying find element. when element updated while hidden doesn't have rendered browser, it's less costly.

would make difference if removed chart's containing element dom while it's hidden, , appended element in when showing chart again?

if remove dom have construct when user tries view it. imho more costly leave in dom. thing can ignore updates until it's shown. when chart displayed call refresh , update in dom new data , show afterwads. of course less resource costly same plus constructing every time.

tl;dr update elements shown.


Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -