$.fn.input = function(options) { var inputApis = []; this.each(function() { var inputApi = null; var actions = []; var row = findRow(this.parentNode); if (this.type === 'range' && row.classList.contains('mui-input-range')) { actions.push('slider'); } else { var classList = this.classList; if (classList.contains('mui-input-clear')) { actions.push('clear'); } if (!($.os.android && $.os.stream) && classList.contains('mui-input-speech')) { actions.push('speech'); } if (classList.contains('mui-input-password')) { actions.push('password'); } if (this.type === 'search' && row.classList.contains('mui-search')) { actions.push('search'); } } var id = this.getAttribute('data-input-' + actions[0]); if (!id) { id = ++$.uuid; inputApi = $.data[id] = new Input(this, { actions: actions.join(',') }); for (var i = 0, len = actions.length; i < len; i++) { this.setAttribute('data-input-' + actions[i], id); } } else { inputApi = $.data[id]; } inputApis.push(inputApi); }); return inputApis.length === 1 ? inputApis[0] : inputApis; }; $.ready(function() { $('.mui-input-row input').input(); });