Keeping responsive ui


I’ve a recursive function which creates tree of an iframe’s DOM elements & show it in a div. when the function is running, ui becomes unresponsive. i’ve tried to async thru setTimeout but failed to do so.

please suggest.


What happens if you overwrite it with CSS?

You probably need to supply more information. Do you have some code to show or a live example?

 function generateTree(srcElement) {
                srcElement = $(srcElement);
                if (srcElement.contents().length > 0) {
                    var temp = appendParent(oElement, srcElement.get(0));
                    oElement = temp || oElement;
                    srcElement.contents().each(function (_, e) {
                    oElement = findRoot(oElement.parentElement);
                else {
                    var temp = appendChild(oElement, srcElement.get(0));
                    oElement = findRoot(temp);

i’ve solved the issue by refactoring code. thanks for your time guys. i’m attaching refactored version of code in case you want to look at it.

 function test(src, parent) {
                src = $(src);
                if (src.contents().length > 0) {
                    var temp = appendParent(parent, src.get(0));
                    src.contents().each(function (i, e) {
                        setTimeout(test, 0, e, temp);                        
                else {
                   appendChild(parent, src.get(0));

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.