From f8b04f298e12e46ca9b07f0bae0abc6b08ed6e18 Mon Sep 17 00:00:00 2001 From: vieron Date: Tue, 11 Feb 2014 01:03:10 +0100 Subject: [PATCH] fix(generated-styles): cleaning cached serializations properly --- src/jquery.gridster.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 2c2803281a..2fddd35e31 100644 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -128,6 +128,7 @@ this.min_widget_height = (this.options.widget_margins[1] * 2) + this.options.widget_base_dimensions[1]; + this.generated_stylesheets = []; this.$style_tags = $([]); this.init(); @@ -2752,6 +2753,7 @@ return false; } + this.generated_stylesheets.push(serialized_opts); Gridster.generated_stylesheets.push(serialized_opts); /* generate CSS styles for cols */ @@ -2819,7 +2821,14 @@ * @return {Object} Returns the instance of the Gridster class. */ fn.remove_style_tags = function() { + var all_styles = Gridster.generated_stylesheets; + var ins_styles = this.generated_stylesheets; + this.$style_tags.remove(); + + Gridster.generated_stylesheets = $.map(all_styles, function(s) { + if ($.inArray(s, ins_styles) === -1) { return s; } + }); };