nelsonad/jScrollPane — comment on commit c8131d1d0cf1422cc45420d4bf9c567500b04aa7
File:  line 0
By nelsonad:

This fixes an issue that exists if the element getting jScrollPane'd has inline script that expects elements to be in the dom.

example:
document.getElementById('childElementOfScrollPane').style.display = "none";

The code above will result in a javascript error because the element will be null in previous code execution, because it's being appended to an element that is not yet in the dom tree.

This is resolved by creating the wrapper elements first, appending them to the target, and then readding the targets children after (inline scripts will be executed here via jquery append method).