function(containerEl, attributeVal) {
      var AUTO_FOCUS = this.prefixer('md-autofocus', true);
      var elToFocus;

      elToFocus = scanForFocusable(containerEl, attributeVal || AUTO_FOCUS);

      if (!elToFocus && attributeVal != AUTO_FOCUS) {
        // Scan for deprecated attribute
        elToFocus = scanForFocusable(containerEl, this.prefixer('md-auto-focus', true));

        if (!elToFocus) {
          // Scan for fallback to 'universal' API
          elToFocus = scanForFocusable(containerEl, AUTO_FOCUS);
        }
      }

      return elToFocus;

      /**
       * Can target and nested children for specified Selector (attribute)
       * whose value may be an expression that evaluates to True/False.
       */
      function scanForFocusable(target, selector) {
        var elFound, items = target[0].querySelectorAll(selector);

        // Find the last child element with the focus attribute
        if (items && items.length){
          items.length && angular.forEach(items, function(it) {
            it = angular.element(it);

            // Check the element for the md-autofocus class to ensure any associated expression
            // evaluated to true.
            var isFocusable = it.hasClass('md-autofocus');
            if (isFocusable) elFound = it;
          });
        }
        return elFound;
      }
    }
function(containerEl, attributeVal) {
      var AUTO_FOCUS = this.prefixer('md-autofocus', true);
      var elToFocus;

      elToFocus = scanForFocusable(containerEl, attributeVal || AUTO_FOCUS);

      if (!elToFocus && attributeVal != AUTO_FOCUS) {
        // Scan for deprecated attribute
        elToFocus = scanForFocusable(containerEl, this.prefixer('md-auto-focus', true));

        if (!elToFocus) {
          // Scan for fallback to 'universal' API
          elToFocus = scanForFocusable(containerEl, AUTO_FOCUS);
        }
      }

      return elToFocus;

      /**
       * Can target and nested children for specified Selector (attribute)
       * whose value may be an expression that evaluates to True/False.
       */
      function scanForFocusable(target, selector) {
        var elFound, items = target[0].querySelectorAll(selector);

        // Find the last child element with the focus attribute
        if (items && items.length){
          items.length && angular.forEach(items, function(it) {
            it = angular.element(it);

            // Check the element for the md-autofocus class to ensure any associated expression
            // evaluated to true.
            var isFocusable = it.hasClass('md-autofocus');
            if (isFocusable) elFound = it;
          });
        }
        return elFound;
      }
    }
function ( containerEl , attributeVal ) { var AUTO_FOCUS = this . prefixer ( 'md-autofocus' , true ) ; var elToFocus ; elToFocus = scanForFocusable ( containerEl , attributeVal || AUTO_FOCUS ) ; if ( ! elToFocus && attributeVal != AUTO_FOCUS ) { // Scan for deprecated attribute elToFocus = scanForFocusable ( containerEl , this . prefixer ( 'md-auto-focus' , true ) ) ; if ( ! elToFocus ) { // Scan for fallback to 'universal' API elToFocus = scanForFocusable ( containerEl , AUTO_FOCUS ) ; } } return elToFocus ; /**
       * Can target and nested children for specified Selector (attribute)
       * whose value may be an expression that evaluates to True/False.
       */ function scanForFocusable ( target , selector ) { var elFound , items = target [ 0 ] . querySelectorAll ( selector ) ; // Find the last child element with the focus attribute if ( items && items . length ) { items . length && angular . forEach ( items , function ( it ) { it = angular . element ( it ) ; // Check the element for the md-autofocus class to ensure any associated expression // evaluated to true. var isFocusable = it . hasClass ( 'md-autofocus' ) ; if ( isFocusable ) elFound = it ; } ) ; } return elFound ; } }
Finds the proper focus target by searching the DOM.

@param containerEl
@param attributeVal
@returns {*}
Finds the proper focus target by searching the DOM .
Returns the last child element that has the specified attribute value.