public/javascripts/yui/carousel/carousel-debug.js
function () {
            var carousel = this,
                first,
                focusEl,
                isSelectionInvisible,
                itemsTable,
                last,
                numVisible,
                selectOnScroll,
                selected,
                selItem;

            // Don't do anything if the Carousel is not rendered
            if (!carousel._hasRendered) {
                return;
            }

            if (carousel.isAnimating()) {
                // this messes up real bad!
                return;
            }

            selItem              = carousel.get("selectedItem");
            numVisible           = carousel.get("numVisible");
            selectOnScroll       = carousel.get("selectOnScroll");
            selected             = (selItem >= 0) ?
                                   carousel.getItem(selItem) : null;
            first                = carousel.get("firstVisible");
            last                 = first + numVisible - 1;
            isSelectionInvisible = (selItem < first || selItem > last);
            focusEl              = (selected && selected.id) ?
                                   Dom.get(selected.id) : null;
            itemsTable           = carousel._itemsTable;

            if (!selectOnScroll && isSelectionInvisible) {
                focusEl = (itemsTable && itemsTable.items &&
                           itemsTable.items[first]) ?
                        Dom.get(itemsTable.items[first].id) : null;
            }

            if (focusEl) {
                try {
                    focusEl.focus();
                } catch (ex) {
                    // ignore focus errors
                }
            }

            carousel.fireEvent(focusEvent);
        }
function () {
            var carousel = this,
                first,
                focusEl,
                isSelectionInvisible,
                itemsTable,
                last,
                numVisible,
                selectOnScroll,
                selected,
                selItem;

            // Don't do anything if the Carousel is not rendered
            if (!carousel._hasRendered) {
                return;
            }

            if (carousel.isAnimating()) {
                // this messes up real bad!
                return;
            }

            selItem              = carousel.get("selectedItem");
            numVisible           = carousel.get("numVisible");
            selectOnScroll       = carousel.get("selectOnScroll");
            selected             = (selItem >= 0) ?
                                   carousel.getItem(selItem) : null;
            first                = carousel.get("firstVisible");
            last                 = first + numVisible - 1;
            isSelectionInvisible = (selItem < first || selItem > last);
            focusEl              = (selected && selected.id) ?
                                   Dom.get(selected.id) : null;
            itemsTable           = carousel._itemsTable;

            if (!selectOnScroll && isSelectionInvisible) {
                focusEl = (itemsTable && itemsTable.items &&
                           itemsTable.items[first]) ?
                        Dom.get(itemsTable.items[first].id) : null;
            }

            if (focusEl) {
                try {
                    focusEl.focus();
                } catch (ex) {
                    // ignore focus errors
                }
            }

            carousel.fireEvent(focusEvent);
        }
function ( ) { var carousel = this , first , focusEl , isSelectionInvisible , itemsTable , last , numVisible , selectOnScroll , selected , selItem ; // Don't do anything if the Carousel is not rendered if ( ! carousel . _hasRendered ) { return ; } if ( carousel . isAnimating ( ) ) { // this messes up real bad! return ; } selItem = carousel . get ( "selectedItem" ) ; numVisible = carousel . get ( "numVisible" ) ; selectOnScroll = carousel . get ( "selectOnScroll" ) ; selected = ( selItem >= 0 ) ? carousel . getItem ( selItem ) : null ; first = carousel . get ( "firstVisible" ) ; last = first + numVisible - 1 ; isSelectionInvisible = ( selItem < first || selItem > last ) ; focusEl = ( selected && selected . id ) ? Dom . get ( selected . id ) : null ; itemsTable = carousel . _itemsTable ; if ( ! selectOnScroll && isSelectionInvisible ) { focusEl = ( itemsTable && itemsTable . items && itemsTable . items [ first ] ) ? Dom . get ( itemsTable . items [ first ] . id ) : null ; } if ( focusEl ) { try { focusEl . focus ( ) ; } catch ( ex ) { // ignore focus errors } } carousel . fireEvent ( focusEvent ) ; }
Set focus on the Carousel.

@method focus
@public
Set focus on the Carousel .