javascript - Why is my browser freezing while doing a counting for child elements inside a container div using jQuery? -
i using jquery ganttview library generate gantt chart - https://github.com/thegrubbsian/jquery.ganttview
after gantt has been generated, executing following jquery code count child elements inside ganttchart generated html:
$('.ganttview-grid').children().length
but freezing browser 40 seconds , there aren't child elements inside container (about 460 child elements exist inside div recognized $('.ganttview-grid')
.
can tell me, how data jquery handling or reading, or there faster way compute without browser freeze?
i've tried sample page:
http://thegrubbsian.github.io/jquery.ganttview/example/index.html
and script posted doesn't showed problem (these 17 childs). i've used jquery retrieve list of thousand or ten thousands elements without problem. sure it's line freeze browser ? try placing return in line below sure problem not place after call.
generally working dom slow not slow can feel operation retrieving 500 elements. simple way speedup store elements when draw or infer them starting data. number of elements passed jquery gantt draw , count javascript elements way faster parsing generated dom. try posting code , can this.
last test, i've never done benchmark maybe faster:
$('.ganttview-block').length
hope helps
Comments
Post a Comment