src/cm/media/js/lib/yui/yui3-3.15.0/build/autocomplete-plugin/autocomplete-plugin.js
changeset 602 e16a97fb364a
equal deleted inserted replaced
601:d334a616c023 602:e16a97fb364a
       
     1 YUI.add('autocomplete-plugin', function (Y, NAME) {
       
     2 
       
     3 /**
       
     4 Binds an AutoCompleteList instance to a Node instance.
       
     5 
       
     6 @module autocomplete
       
     7 @submodule autocomplete-plugin
       
     8 **/
       
     9 
       
    10 /**
       
    11 Binds an AutoCompleteList instance to a Node instance.
       
    12 
       
    13 @example
       
    14 
       
    15     Y.one('#my-input').plug(Y.Plugin.AutoComplete, {
       
    16         source: 'select * from search.suggest where query="{query}"'
       
    17     });
       
    18 
       
    19     // You can now access the AutoCompleteList instance at Y.one('#my-input').ac
       
    20 
       
    21 @class Plugin.AutoComplete
       
    22 @extends AutoCompleteList
       
    23 **/
       
    24 
       
    25 var Plugin = Y.Plugin;
       
    26 
       
    27 function ACListPlugin(config) {
       
    28     config.inputNode = config.host;
       
    29 
       
    30     // Render by default.
       
    31     if (!config.render && config.render !== false) {
       
    32       config.render = true;
       
    33     }
       
    34 
       
    35     ACListPlugin.superclass.constructor.apply(this, arguments);
       
    36 }
       
    37 
       
    38 Y.extend(ACListPlugin, Y.AutoCompleteList, {}, {
       
    39     NAME      : 'autocompleteListPlugin',
       
    40     NS        : 'ac',
       
    41     CSS_PREFIX: Y.ClassNameManager.getClassName('aclist')
       
    42 });
       
    43 
       
    44 Plugin.AutoComplete     = ACListPlugin;
       
    45 Plugin.AutoCompleteList = ACListPlugin;
       
    46 
       
    47 
       
    48 }, '@VERSION@', {"requires": ["autocomplete-list", "node-pluginhost"]});