I have an app which allows the user to change the theme at runtime.
Before the new CSS is loaded, this code removes the old CSS:
jQuery('head > link').each(function () {
if (this.href.includes('styles/kendo.')) {
DOM.removeNode(this);
}
});
This looks OK to me, but when it runs, something gets broken (not sure what) and later CSS does not load properly.
If I comment out this code, then the CSS loads just fine. Makes no sense to me.
Maybe there is a completely different way to remove CSS from the DOM that would be better?