vendor/assets/javascripts/uikit/components/form-select.js in uikit-sass-rails-1.3.0 vs vendor/assets/javascripts/uikit/components/form-select.js in uikit-sass-rails-1.4.0

- old
+ new

@@ -1,27 +1,45 @@ -/*! UIkit 2.11.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ +/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ (function(addon) { var component; - if (jQuery && jQuery.UIkit) { - component = addon(jQuery, jQuery.UIkit); + if (window.UIkit) { + component = addon(UIkit); } if (typeof define == "function" && define.amd) { define("uikit-form-select", ["uikit"], function(){ - return component || addon(jQuery, jQuery.UIkit); + return component || addon(UIkit); }); } -})(function($, UI){ +})(function(UI){ + "use strict"; + UI.component('formSelect', { + defaults: { 'target': '>span:first' }, + boot: function() { + // init code + UI.ready(function(context) { + + UI.$("[data-uk-form-select]", context).each(function(){ + + var ele = UI.$(this); + + if (!ele.data("formSelect")) { + var obj = UI.formSelect(ele, UI.Utils.options(ele.attr("data-uk-form-select"))); + } + }); + }); + }, + init: function() { var $this = this; this.target = this.find(this.options.target); this.select = this.find('select'); @@ -43,19 +61,7 @@ this.element.data("formSelect", this); } }); - // init code - UI.ready(function(context) { - - $("[data-uk-form-select]", context).each(function(){ - var ele = $(this); - - if (!ele.data("formSelect")) { - var obj = UI.formSelect(ele, UI.Utils.options(ele.attr("data-uk-form-select"))); - } - }); - }); - return UI.formSelect; -}); \ No newline at end of file +});