-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With autogenerate_stylesheet=true, many redundant styles are generated #294
Comments
I did a small modification in the gridster code to fix that, I added an id to the css node generated, then I check if the node was previously generated to avoid added again
fn.add_style_tag = function(css) {
var d = document;
var current_css = $('#_gridster_auto_css');
if (current_css === 'undefined' || current_css.length == 0){
var tag = d.createElement('style');
d.getElementsByTagName('head')[0].appendChild(tag);
tag.setAttribute('type', 'text/css');
tag.setAttribute('id', '_gridster_auto_css');
if (tag.styleSheet) {
tag.styleSheet.cssText = css;
}else{
tag.appendChild(document.createTextNode(css));
}
this.$style_tags = this.$style_tags.add(tag);
}
return this;
};
|
Hopefully fixes ducksboard#211 and ducksboard#294.
* dasmall/gridster.js.git/master: Removing previously added style tags before adding new one. Hopefully fixes ducksboard#211 and ducksboard#294.
Every time a widget is added dynamically, the stylesheet is reconstructed and added to the DOM (rather than replacing what's already there or building only the additional styles needed). After this happens a few times, the browser starts to have noticeable performance issues when dragging tiles around. If the redundant styles are not generated, the dragging behavior doesn't experience any performance penalty (using Chrome Version 31.0.1650.63 m).
The text was updated successfully, but these errors were encountered: