~michael.nelson/ubuntu-webcatalog/1267731-import-sca-apps-error

« back to all changes in this revision

Viewing changes to src/webcatalog/static/yui/3.10.3/build/widget-skin/widget-skin-debug.js

  • Committer: Tarmac
  • Author(s): Stephen Stewart
  • Date: 2013-06-26 09:19:32 UTC
  • mfrom: (184.1.4 ubuntu-global-nav)
  • Revision ID: tarmac-20130626091932-8urtuli368k8p7ds
[r=beuno,jonas-drange] add ubuntu global nav to apps.ubuntu.com

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
YUI 3.10.3 (build 2fb5187)
 
3
Copyright 2013 Yahoo! Inc. All rights reserved.
 
4
Licensed under the BSD License.
 
5
http://yuilibrary.com/license/
 
6
*/
 
7
 
 
8
YUI.add('widget-skin', function (Y, NAME) {
 
9
 
 
10
/**
 
11
 * Provides skin related utlility methods.
 
12
 *
 
13
 * @module widget
 
14
 * @submodule widget-skin
 
15
 */
 
16
var BOUNDING_BOX = "boundingBox",
 
17
    CONTENT_BOX = "contentBox",
 
18
    SKIN = "skin",
 
19
    _getClassName = Y.ClassNameManager.getClassName;
 
20
 
 
21
/**
 
22
 * Returns the name of the skin that's currently applied to the widget.
 
23
 *
 
24
 * Searches up the Widget's ancestor axis for, by default, a class
 
25
 * yui3-skin-(name), and returns the (name) portion. Otherwise, returns null.
 
26
 *
 
27
 * This is only really useful after the widget's DOM structure is in the
 
28
 * document, either by render or by progressive enhancement.
 
29
 *
 
30
 * @method getSkinName
 
31
 * @for Widget
 
32
 * @param {String} [skinPrefix] The prefix which the implementation uses for the skin
 
33
 * ("yui3-skin-" is the default).
 
34
 *
 
35
 * NOTE: skinPrefix will be used as part of a regular expression:
 
36
 *
 
37
 *     new RegExp('\\b' + skinPrefix + '(\\S+)')
 
38
 *
 
39
 * Although an unlikely use case, literal characters which may result in an invalid
 
40
 * regular expression should be escaped.
 
41
 *
 
42
 * @return {String} The name of the skin, or null, if a matching skin class is not found.
 
43
 */
 
44
 
 
45
Y.Widget.prototype.getSkinName = function (skinPrefix) {
 
46
 
 
47
    var root = this.get( CONTENT_BOX ) || this.get( BOUNDING_BOX ),
 
48
        match,
 
49
        search;
 
50
 
 
51
    skinPrefix = skinPrefix || _getClassName(SKIN, "");
 
52
 
 
53
    search = new RegExp( '\\b' + skinPrefix + '(\\S+)' );
 
54
 
 
55
    if ( root ) {
 
56
        root.ancestor( function ( node ) {
 
57
            match = node.get( 'className' ).match( search );
 
58
            return match;
 
59
        } );
 
60
    }
 
61
 
 
62
    return ( match ) ? match[1] : null;
 
63
};
 
64
 
 
65
 
 
66
}, '3.10.3', {"requires": ["widget-base"]});