diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index f832b6243..6f3fd50d9 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,10 +1,10 @@ ## RELEASE NOTES -### Version 1.12.0 - March x, 2015 +### Version 1.11.1 - March 5, 2015 -**New Components** -- **Container** - Added a simple container element that can act as an alternative to `ui page grid`. Containers have fixed sizes which make layout resizing simpler than `page grid` which uses percentage width gutters. Containers also automatically scale for table and mobile +**Enhancements** +- **Dropdown** - Calling behaviors on a dropdown `select` will now automatically route them to the appropriate parent `ui dropdown` **Bugs** diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 0c81df0ce..9c8433666 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -75,25 +75,25 @@ $.fn.dropdown = function(parameters) { module.debug('Initializing dropdown', settings); if( module.is.alreadySetup() ) { - module.error(error.alreadySetup); + module.setup.reference(); } else { module.setup.layout(); - } - module.save.defaults(); - module.set.selected(); + module.save.defaults(); + module.set.selected(); - module.create.id(); + module.create.id(); - if(hasTouch) { - module.bind.touchEvents(); - } - module.bind.mouseEvents(); - module.bind.keyboardEvents(); + if(hasTouch) { + module.bind.touchEvents(); + } + module.bind.mouseEvents(); + module.bind.keyboardEvents(); - module.observeChanges(); - module.instantiate(); + module.observeChanges(); + module.instantiate(); + } }, instantiate: function() { @@ -161,7 +161,6 @@ $.fn.dropdown = function(parameters) { }, setup: { - layout: function() { if( $module.is('select') ) { module.setup.select(); @@ -212,6 +211,21 @@ $.fn.dropdown = function(parameters) { ; } module.refresh(); + }, + reference: function() { + var + index = $allModules.index($module), + $firstModules, + $lastModules + ; + module.debug('Dropdown behavior was called on select, replacing with closest dropdown'); + // replace module reference + $module = $module.parent(selector.dropdown); + module.refresh(); + // adjust all modules + $firstModules = $allModules.slice(0, index); + $lastModules = $allModules.slice(index + 1); + $allModules = $firstModules.add($module).add($lastModules); } }, @@ -1647,10 +1661,9 @@ $.fn.dropdown = function(parameters) { } }) ; - return (returnedValue !== undefined) ? returnedValue - : this + : $allModules ; };