This is a migrated thread and some comments may be shown as answers.

Very slow kendo.support.scrollbar()

1 Answer 111 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rowan
Top achievements
Rank 1
Rowan asked on 29 Jul 2014, 01:48 AM
Hello,

kendo.support.scrollbar() does a bunch of root node DOM manipulation behind the scenes, triggering a reflow of the entire page every time it is queried. This is despite the fact that all it does is return a fixed numeric value.

Is there any reason it needs to do the DOM manipulation every call? We have patched it as below, and a bunch of our code (including kendo elements!) now perform better.

var browserScrollbarWidth = kendo.support.scrollbar();
kendo.support.scrollbar = function () {
    return browserScrollbarWidth;
};

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 30 Jul 2014, 02:46 PM
Hello Rowan,

Thank you for bringing this to our attention.

In your case you are not calculating width every time you call .scrollbar(), but you use the already calculated value, which is a good optimization. The need of calculating it every time is due to old browser support that change the scrollbar width in some specific scenarios. However if you do not aim to support those browsers and your solution works well, then I do not see a reason not to use it.

I have forwarded this to the person responsible for this functionality, so it will be considered for implementation if its no longer need.

Thanks again for bringing this up.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
General Discussions
Asked by
Rowan
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or