ducksboard / gridster.js

gridster.js is a jQuery plugin that makes building intuitive draggable layouts from elements spanning multiple columns
http://gridster.net/
MIT License
6.03k stars 1.2k forks source link

add_widget doesn't remove old CSS #185

Open RoelN opened 11 years ago

RoelN commented 11 years ago

When adding a new widget with _addwidget, the old CSS injected in the head isn't removed. This results in dupilcate CSS for every added widget.

See screenshot: I added three widgets with _addwdiget. This results in four style tags (one on init, the other three after adding a widget), with only the last one containing all the updated styles. The previous three are irrelevant:

example

This can easily be fixed by adding

this.remove_style_tag();

to the function _add_styletag.

I believe this might also fix some performance issues with _addwidget.

Related to this fix: https://github.com/ducksboard/gridster.js/pull/77#issuecomment-13882888