whole_func_string: function($input, settings_element) {
  		var i, n, tagName, $children, order = 0;
  		var options = settings_element.options;
  		var optionsMap = {};
  
  		var readData = function($el) {
  			var data = attr_data && $el.attr(attr_data);
  			if (typeof data === 'string' && data.length) {
  				return JSON.parse(data);
  			}
  			return null;
  		};
  
  		var addOption = function($option, group) {
  			$option = $($option);
  
  			var value = hash_key($option.val());
  			if (!value && !settings.allowEmptyOption) return;
  
  			// if the option already exists, it's probably been
  			// duplicated in another optgroup. in this case, push
  			// the current group to the "optgroup" property on the
  			// existing option so that it's rendered in both places.
  			if (optionsMap.hasOwnProperty(value)) {
  				if (group) {
  					var arr = optionsMap[value][field_optgroup];
  					if (!arr) {
  						optionsMap[value][field_optgroup] = group;
  					} else if (!$.isArray(arr)) {
  						optionsMap[value][field_optgroup] = [arr, group];
  					} else {
  						arr.push(group);
  					}
  				}
  				return;
  			}
  
  			var option             = readData($option) || {};
  			option[field_label]    = option[field_label] || $option.text();
  			option[field_value]    = option[field_value] || value;
  			option[field_disabled] = option[field_disabled] || $option.prop('disabled');
  			option[field_optgroup] = option[field_optgroup] || group;
  
  			optionsMap[value] = option;
  			options.push(option);
  
  			if ($option.is(':selected')) {
  				settings_element.items.push(value);
  			}
  		};
  
  		var addGroup = function($optgroup) {
  			var i, n, id, optgroup, $options;
  
  			$optgroup = $($optgroup);
  			id = $optgroup.attr('label');
  
  			if (id) {
  				optgroup = readData($optgroup) || {};
  				optgroup[field_optgroup_label] = id;
  				optgroup[field_optgroup_value] = id;
  				optgroup[field_disabled] = $optgroup.prop('disabled');
  				settings_element.optgroups.push(optgroup);
  			}
  
  			$options = $('option', $optgroup);
  			for (i = 0, n = $options.length; i < n; i++) {
  				addOption($options[i], id);
  			}
  		};
  
  		settings_element.maxItems = $input.attr('multiple') ? null : 1;
  
  		$children = $input.children();
  		for (i = 0, n = $children.length; i < n; i++) {
  			tagName = $children[i].tagName.toLowerCase();
  			if (tagName === 'optgroup') {
  				addGroup($children[i]);
  			} else if (tagName === 'option') {
  				addOption($children[i]);
  			}
  		}
  	}
func_code_string: function($input, settings_element) {
  		var i, n, tagName, $children, order = 0;
  		var options = settings_element.options;
  		var optionsMap = {};
  
  		var readData = function($el) {
  			var data = attr_data && $el.attr(attr_data);
  			if (typeof data === 'string' && data.length) {
  				return JSON.parse(data);
  			}
  			return null;
  		};
  
  		var addOption = function($option, group) {
  			$option = $($option);
  
  			var value = hash_key($option.val());
  			if (!value && !settings.allowEmptyOption) return;
  
  			// if the option already exists, it's probably been
  			// duplicated in another optgroup. in this case, push
  			// the current group to the "optgroup" property on the
  			// existing option so that it's rendered in both places.
  			if (optionsMap.hasOwnProperty(value)) {
  				if (group) {
  					var arr = optionsMap[value][field_optgroup];
  					if (!arr) {
  						optionsMap[value][field_optgroup] = group;
  					} else if (!$.isArray(arr)) {
  						optionsMap[value][field_optgroup] = [arr, group];
  					} else {
  						arr.push(group);
  					}
  				}
  				return;
  			}
  
  			var option             = readData($option) || {};
  			option[field_label]    = option[field_label] || $option.text();
  			option[field_value]    = option[field_value] || value;
  			option[field_disabled] = option[field_disabled] || $option.prop('disabled');
  			option[field_optgroup] = option[field_optgroup] || group;
  
  			optionsMap[value] = option;
  			options.push(option);
  
  			if ($option.is(':selected')) {
  				settings_element.items.push(value);
  			}
  		};
  
  		var addGroup = function($optgroup) {
  			var i, n, id, optgroup, $options;
  
  			$optgroup = $($optgroup);
  			id = $optgroup.attr('label');
  
  			if (id) {
  				optgroup = readData($optgroup) || {};
  				optgroup[field_optgroup_label] = id;
  				optgroup[field_optgroup_value] = id;
  				optgroup[field_disabled] = $optgroup.prop('disabled');
  				settings_element.optgroups.push(optgroup);
  			}
  
  			$options = $('option', $optgroup);
  			for (i = 0, n = $options.length; i < n; i++) {
  				addOption($options[i], id);
  			}
  		};
  
  		settings_element.maxItems = $input.attr('multiple') ? null : 1;
  
  		$children = $input.children();
  		for (i = 0, n = $children.length; i < n; i++) {
  			tagName = $children[i].tagName.toLowerCase();
  			if (tagName === 'optgroup') {
  				addGroup($children[i]);
  			} else if (tagName === 'option') {
  				addOption($children[i]);
  			}
  		}
  	}
func_documentation_string: Initializes selectize from a <select> element.
  
  @param {object} $input
  @param {object} settings_element