function updateOptionSetSizeAndPosition() {
      var i, options;
      var hasOptGroup = $element.find('md-optgroup');
      if (!hasOptGroup.length) {
        return;
      }

      options = $element.find('md-option');

      for (i = 0; i < options.length; i++) {
        options[i].setAttribute('aria-setsize', options.length);
        options[i].setAttribute('aria-posinset', i + 1);
      }
    }
If the options include md-optgroups, then we need to apply aria-setsize and aria-posinset
to help screen readers understand the indexes. When md-optgroups are not used, we save on
perf and extra attributes by not applying these attributes as they are not needed by screen
readers.