2 YUI 3.13.0 (build 508226d)
3 Copyright 2013 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
8 YUI.add('scrollview-list', function (Y, NAME) {
11 * Provides a plugin, which adds support for a scroll indicator to ScrollView instances
13 * @module scrollview-list
15 var getCN = Y.ClassNameManager.getClassName,
16 SCROLLVIEW = 'scrollview',
17 LIST_CLASS = getCN(SCROLLVIEW, 'list'),
18 ITEM_CLASS = getCN(SCROLLVIEW, 'item'),
19 CONTENT_BOX = "contentBox",
23 * ScrollView plugin that adds class names to immediate descendant "<li>" to
24 * allow for easier styling through CSS
26 * @class ScrollViewList
28 * @extends Plugin.Base
31 function ListPlugin() {
32 ListPlugin.superclass.constructor.apply(this, arguments);
37 * The identity of the plugin
41 * @default 'pluginList'
44 ListPlugin.NAME = 'pluginList';
47 * The namespace on which the plugin will reside.
54 ListPlugin.NS = 'list';
58 * The default attribute configuration for the plugin
67 * Specifies whether the list elements (the immediate <ul>'s and the
68 * immediate <li>'s inside those <ul>'s) have class names attached to
71 * @attribute isAttached
73 * @deprecated No real use for this attribute on the public API
77 validator: Y.Lang.isBoolean
81 Y.namespace("Plugin").ScrollViewList = Y.extend(ListPlugin, Y.Plugin.Base, {
84 * Designated initializer
88 initializer: function() {
89 this._host = this.get(HOST);
90 this.afterHostEvent("render", this._addClassesToList);
93 _addClassesToList: function() {
94 if (!this.get('isAttached')) {
95 var cb = this._host.get(CONTENT_BOX),
99 if (cb.hasChildNodes()) {
100 //get all direct descendants of the UL's that are directly under the content box.
101 ulList = cb.all('> ul');
102 liList = cb.all('> ul > li');
104 //go through the UL's and add the class
105 ulList.each(function(list) {
106 list.addClass(LIST_CLASS);
109 //go through LI's and add the class
110 liList.each(function(item) {
111 item.addClass(ITEM_CLASS);
114 this.set('isAttached', true);
116 // We need to call this again, since sv-list
117 // relies on the "-vert" class, to apply padding.
118 // [ 1st syncUI pass applies -vert, 2nd pass re-calcs dims ]
137 }, '3.13.0', {"requires": ["plugin", "classnamemanager"], "skinnable": true});