From d4ecfa12ff80110e522c2a9a19e287563b4884a6 Mon Sep 17 00:00:00 2001 From: Jack Lukic Date: Sat, 27 Feb 2016 12:24:56 -0500 Subject: [PATCH] Fixes issue with extending settings with --- RELEASE-NOTES.md | 1 + src/definitions/behaviors/api.js | 7 ++++++- src/definitions/behaviors/state.js | 7 ++++++- src/definitions/modules/accordion.js | 7 ++++++- src/definitions/modules/checkbox.js | 7 ++++++- src/definitions/modules/dimmer.js | 9 +++++++-- src/definitions/modules/dropdown.js | 7 ++++++- src/definitions/modules/embed.js | 7 ++++++- src/definitions/modules/modal.js | 7 ++++++- src/definitions/modules/nag.js | 7 ++++++- src/definitions/modules/progress.js | 7 ++++++- src/definitions/modules/rating.js | 7 ++++++- src/definitions/modules/shape.js | 9 +++++++-- src/definitions/modules/sidebar.js | 7 ++++++- src/definitions/modules/tab.js | 10 ++++++---- src/definitions/modules/transition.js | 7 ++++++- 16 files changed, 93 insertions(+), 20 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 420902187..c850f991f 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -5,6 +5,7 @@ **Major Enhancements** - **Progress** - Progress now uses a polling interval for updates. Rapidly updating the progress bar over a period quicker than the animation duration (for example with xhr `onprogress` events say every 50ms) will now appear smooth as butter. - **Modules** - Added new setting `silent` to all modules which allows you to disable **all** console output including errors. This can be useful for preventing known errors, like a popup which cannot place itself on screen, or `sticky` content which initializes before it is visible #3713 +- **Modules** - Using `setting` on a setting that is an object literal, for example `error: {}` will now extend the existing object instead of replacing it. - **Dropdown** - All dropdowns, not just `selection dropdown`, will now select the first `menu item` that starts with a pressed keyboard key, for example "N" will select "New" - **Build Tools** - Added new `autoInstall` option to allow for Semantic to be installed without user interaction. See [docs explanation](http://www.semantic-ui.com/introduction/advanced-usage.html#Auto-Install) for how to use. #3616 **Thanks @algorithme** diff --git a/src/definitions/behaviors/api.js b/src/definitions/behaviors/api.js index 069e3fb82..b02f7f402 100644 --- a/src/definitions/behaviors/api.js +++ b/src/definitions/behaviors/api.js @@ -830,7 +830,12 @@ $.api = $.fn.api = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; diff --git a/src/definitions/behaviors/state.js b/src/definitions/behaviors/state.js index b0743167d..90968f32f 100644 --- a/src/definitions/behaviors/state.js +++ b/src/definitions/behaviors/state.js @@ -409,7 +409,12 @@ $.fn.state = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; diff --git a/src/definitions/modules/accordion.js b/src/definitions/modules/accordion.js index cdadebb5a..0758df0a6 100644 --- a/src/definitions/modules/accordion.js +++ b/src/definitions/modules/accordion.js @@ -367,7 +367,12 @@ $.fn.accordion = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; diff --git a/src/definitions/modules/checkbox.js b/src/definitions/modules/checkbox.js index 671a7becb..68c3a48c7 100644 --- a/src/definitions/modules/checkbox.js +++ b/src/definitions/modules/checkbox.js @@ -584,7 +584,12 @@ $.fn.checkbox = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; diff --git a/src/definitions/modules/dimmer.js b/src/definitions/modules/dimmer.js index e95a1027b..876a04cc5 100644 --- a/src/definitions/modules/dimmer.js +++ b/src/definitions/modules/dimmer.js @@ -446,7 +446,12 @@ $.fn.dimmer = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; @@ -694,4 +699,4 @@ $.fn.dimmer.settings = { }; -})( jQuery, window, document ); \ No newline at end of file +})( jQuery, window, document ); diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 65bacb099..99a2e2394 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -3058,7 +3058,12 @@ $.fn.dropdown = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; diff --git a/src/definitions/modules/embed.js b/src/definitions/modules/embed.js index aec4e368e..63e45ff55 100644 --- a/src/definitions/modules/embed.js +++ b/src/definitions/modules/embed.js @@ -359,7 +359,12 @@ $.fn.embed = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; diff --git a/src/definitions/modules/modal.js b/src/definitions/modules/modal.js index 66134063a..cbbed09df 100644 --- a/src/definitions/modules/modal.js +++ b/src/definitions/modules/modal.js @@ -645,7 +645,12 @@ $.fn.modal = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; diff --git a/src/definitions/modules/nag.js b/src/definitions/modules/nag.js index 331217aba..9817ad195 100644 --- a/src/definitions/modules/nag.js +++ b/src/definitions/modules/nag.js @@ -255,7 +255,12 @@ $.fn.nag = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; diff --git a/src/definitions/modules/progress.js b/src/definitions/modules/progress.js index 7af9b6191..65be87125 100644 --- a/src/definitions/modules/progress.js +++ b/src/definitions/modules/progress.js @@ -607,7 +607,12 @@ $.fn.progress = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; diff --git a/src/definitions/modules/rating.js b/src/definitions/modules/rating.js index 728a97c2e..e6dd9dc25 100644 --- a/src/definitions/modules/rating.js +++ b/src/definitions/modules/rating.js @@ -263,7 +263,12 @@ $.fn.rating = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; diff --git a/src/definitions/modules/shape.js b/src/definitions/modules/shape.js index b3d9fd159..cd4a5817c 100644 --- a/src/definitions/modules/shape.js +++ b/src/definitions/modules/shape.js @@ -650,7 +650,12 @@ $.fn.shape = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; @@ -878,4 +883,4 @@ $.fn.shape.settings = { }; -})( jQuery, window, document ); \ No newline at end of file +})( jQuery, window, document ); diff --git a/src/definitions/modules/sidebar.js b/src/definitions/modules/sidebar.js index eba56c13d..fabbec280 100644 --- a/src/definitions/modules/sidebar.js +++ b/src/definitions/modules/sidebar.js @@ -766,7 +766,12 @@ $.fn.sidebar = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; diff --git a/src/definitions/modules/tab.js b/src/definitions/modules/tab.js index 57e8eb2da..a7c003342 100644 --- a/src/definitions/modules/tab.js +++ b/src/definitions/modules/tab.js @@ -263,9 +263,6 @@ $.fn.tab = function(parameters) { }, set: { - activeTab($tab) { - - }, auto: function() { var url = (typeof settings.path == 'string') @@ -667,7 +664,12 @@ $.fn.tab = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; diff --git a/src/definitions/modules/transition.js b/src/definitions/modules/transition.js index 6fa768958..0ec152262 100644 --- a/src/definitions/modules/transition.js +++ b/src/definitions/modules/transition.js @@ -828,7 +828,12 @@ $.fn.transition = function() { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name];