src/uki-core/selector.js
function(selector, context, skipFiltering) {

        // quick return for #id case
        var match;
        if (!context && (match = selector.match(idRegexp))) {
            var element = require('./view').byId(match[1]);
            return new Collection(element ? [element] : []);
        }
        context = context || require('./attaching').Attaching.instances();
        if (context.length === undefined) { context = [context]; }

        var tokens = Selector.tokenize(selector),
            expr   = tokens[0],
            extra  = tokens[1],
            result = context,
            mapper;

        while (expr.length > 0) {
            mapper = mappers[expr[0]] ? mappers[expr.shift()] : mappers[''];
            result = mapper(result);
            if (expr.length === 0) { break; }
            result = Selector.reduce(expr.shift(), result);
        }

        if (extra) {
            result = result.concat(Selector.find(extra, context, true));
        }

        return skipFiltering ? result : new Collection(utils.unique(result));
    }
function(selector, context, skipFiltering) {

        // quick return for #id case
        var match;
        if (!context && (match = selector.match(idRegexp))) {
            var element = require('./view').byId(match[1]);
            return new Collection(element ? [element] : []);
        }
        context = context || require('./attaching').Attaching.instances();
        if (context.length === undefined) { context = [context]; }

        var tokens = Selector.tokenize(selector),
            expr   = tokens[0],
            extra  = tokens[1],
            result = context,
            mapper;

        while (expr.length > 0) {
            mapper = mappers[expr[0]] ? mappers[expr.shift()] : mappers[''];
            result = mapper(result);
            if (expr.length === 0) { break; }
            result = Selector.reduce(expr.shift(), result);
        }

        if (extra) {
            result = result.concat(Selector.find(extra, context, true));
        }

        return skipFiltering ? result : new Collection(utils.unique(result));
    }
function ( selector , context , skipFiltering ) { // quick return for #id case var match ; if ( ! context && ( match = selector . match ( idRegexp ) ) ) { var element = require ( './view' ) . byId ( match [ 1 ] ) ; return new Collection ( element ? [ element ] : [ ] ) ; } context = context || require ( './attaching' ) . Attaching . instances ( ) ; if ( context . length === undefined ) { context = [ context ] ; } var tokens = Selector . tokenize ( selector ) , expr = tokens [ 0 ] , extra = tokens [ 1 ] , result = context , mapper ; while ( expr . length > 0 ) { mapper = mappers [ expr [ 0 ] ] ? mappers [ expr . shift ( ) ] : mappers [ '' ] ; result = mapper ( result ) ; if ( expr . length === 0 ) { break ; } result = Selector . reduce ( expr . shift ( ) , result ) ; } if ( extra ) { result = result . concat ( Selector . find ( extra , context , true ) ) ; } return skipFiltering ? result : new Collection ( utils . unique ( result ) ) ; }
Finds views by CSS3 selectors in view tree.

@example
find('Label') find all labels on page
find('Box[name=main] > Label') find all immediate descendant
Labels in a box with name = "main"
find('> Slider', context) find all direct descendant
Sliders within given context
find('Slider,Checkbox') find all Sliders and Checkboxes
find('Slider:eq(3)') find 3-d slider

@param {string} selector
@param {Array.<view.Base>} context to search in

@return {Collection} found views
Finds views by CSS3 selectors in view tree .