Focuses on element itself if it has "focus" method.
Searches and focuses on select's button or input if element is rg-select
@param element
193293
function focusOnElement(element) {
    if (!element) {
      return;
    }

    if (element.hasAttribute(RING_SELECT) || element.tagName.toLowerCase() === RING_SELECT) {
      focusOnElement(element.querySelector(RING_SELECT_SELECTOR));
      return;
    }

    if (element.matches(FOCUSABLE_ELEMENTS) && element.focus) {
      element.focus();
      return;
    }

    const focusableChild = element.querySelector(FOCUSABLE_ELEMENTS);

    if (focusableChild && focusableChild.focus) {
      focusableChild.focus();
    }
  }
189541
public void setSelector(String selector)
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "setSelector", selector);

    this.selector = selector;

    if (tc.isEntryEnabled())
      SibTr.exit(tc, "setSelector");
  }
510519
function() {

        var activeElement = this.__activeElement;
        var now = getActiveElement();
        var isBlur = arguments[0];
        var node = this.node;

        if (isBlur !== false && node.contains(now)) {
            this.__focus(activeElement);
        }

        this.__autofocus = false;
        removeClass(node, this.__name('focus'));

        return this;
    }
224499
function setFocusedElement(cstOption) {
    if (focusedElement) {
      focusedElement.classList.remove(builderParams.hasFocusClass);
    }
    if (typeof cstOption !== 'undefined') {
      focusedElement = cstOption;
      focusedElement.classList.add(builderParams.hasFocusClass);
      // Offset update: checks if the focused element is in the visible part of the panelClass
      // if not dispatches a custom event
      if (isOpen) {
        if (cstOption.offsetTop < cstOption.offsetParent.scrollTop
          || cstOption.offsetTop >
            (cstOption.offsetParent.scrollTop + cstOption.offsetParent.clientHeight)
            - cstOption.clientHeight) {
          cstOption.dispatchEvent(new CustomEvent('custom-select:focus-outside-panel', { bubbles: true }));
        }
      }
    } else {
      focusedElement = undefined;
    }
  }
558552
public static void setDocumentElement(final Document document, final Element element) {
        Element documentElement = document.getDocumentElement();
        if (documentElement != null) {
            document.removeChild(documentElement);
        }
        if (element != null) {
            if (element.getOwnerDocument().equals(document)) {
                document.appendChild(element);
                return;
            }
            Node node = document.adoptNode(element);
            document.appendChild(node);
        }
    }
1307870
function( element, index ) {
			if ( typeof index == 'undefined' ) {
				index = this._.focusList.length;
				this._.focusList.push( new Focusable( this, element, index ) );
			} else {
				this._.focusList.splice( index, 0, new Focusable( this, element, index ) );
				for ( var i = index + 1; i < this._.focusList.length; i++ )
					this._.focusList[ i ].focusIndex++;
			}
		}
1163147
function (element, delegate) {
        if (this.eventManager) this.eventManager.unbind();
        this.eventManager = events(this.el, this);
        this.delegateEvents();
        this._applyBindingsForKey();
        return this;
    }
714014
public void add(IRenderingElement element) {
        if (element != null) {
            if (element.getClass().equals(ElementGroup.class))
                elements.addAll(((ElementGroup) element).elements);
            else
                elements.add(element);
        }
    }
994230
function setFocus (hash) {
    var element = document.getElementById(hash.substring(1))

    if (element) {
      if (!/^(?:a|select|input|button|textarea)$/i.test(element.tagName)) {
        element.tabIndex = -1
      }

      element.focus()
    }
  }
1044309
def element_focused(self, id_):
    

    try:
        elem = world.browser.find_element_by_id(id_)
    except NoSuchElementException:
        raise AssertionError("Element with ID '{}' not found.".format(id_))

    focused = world.browser.switch_to.active_element

    # Elements don't have __ne__ defined, cannot test for inequality
    if not elem == focused:
        raise AssertionError("Expected element to be focused.")
1151014
function (element, options) {
		this.$element      = $(element)
		this.options       = $.extend({}, Drawer.DEFAULTS, options)
		this.$trigger      = $(this.options.trigger).filter('[href="#' + element.id + '"], [data-target="#' + element.id + '"]')
		this.transitioning = null

		if (this.options.parent) {
			this.$parent = this.getParent()
		} else {
			this.addAriaAndDrawerdClass(this.$element, this.$trigger)
		}

		if (this.options.toggle) this.toggle()
	}
1169669
function (event) {
            this._toggleValue();
            if (!this._hasFocus) {
                this._focus();
            }
            if (event.target.tagName.toLowerCase() != "input") {
                event.preventDefault(true);
            }
        }
722968
function(select){
        var focusElement = this.tmpl ? this.tmpl.focus || this.element : null;

        if (focusElement)
        {
          if (focusTimer)
            focusTimer = basis.clearImmediate(focusTimer);

          focusTimer = basis.setImmediate(function(){
            try {
              focusElement.focus();
              if (select)
                focusElement.select();
            } catch(e) {}
          });
        }
      }
153439
function(element) {

            var parent = element.parentNode;

            // If input already have parent just pass through
            if (parent.tagName.toLowerCase() === 'i' && parent.classList.contains('waves-effect')) {
                return;
            }

            // Put element class and style to the specified parent
            var wrapper       = document.createElement('i');
            wrapper.className = element.className + ' waves-input-wrapper';
            element.className = 'waves-button-input';

            // Put element as child
            parent.replaceChild(wrapper, element);
            wrapper.appendChild(element);

            // Apply element color and background color to wrapper
            var elementStyle    = window.getComputedStyle(element, null);
            var color           = elementStyle.color;
            var backgroundColor = elementStyle.backgroundColor;

            wrapper.setAttribute('style', 'color:' + color + ';background:' + backgroundColor);
            element.setAttribute('style', 'background-color:rgba(0,0,0,0);');

        }
967232
function(element) {
    var element = $(element);
    for (var i = 0; i < element.childNodes.length; i++) {
      var node = element.childNodes[i];
      if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) 
        Element.remove(node);
    }
  }
1208383
function setFocus(document, element) {
  const inFocus = document._inFocus;
  if (element !== inFocus) {
    const inputElementImpl = idlUtils.implForWrapper(element || inFocus);
    if (inFocus) {
      const onblur = document.createEvent('HTMLEvents');
      onblur.initEvent('blur', false, false);
      const dispatchResult = inFocus.dispatchEvent(onblur);
      inFocus._blur && inFocus._blur(onblur);
    }
    if (element) { // null to blur
      const onfocus = document.createEvent('HTMLEvents');
      onfocus.initEvent('focus', false, false);
      const dispatchResult = element.dispatchEvent(onfocus);
      element._focus && element._focus(onfocus);
      document._inFocus = element;
      document.defaultView.browser.emit('focus', element);
    }
  }
}
287969
function (el, setFocus) {
            var children,
                cssClass = this.CLASSES,
                grandParent,
                parent   = el.parentNode;

            if (!parent) {
                return;
            }
            grandParent = parent.parentNode;

            if (el.nodeName.toUpperCase() == "BUTTON" &&
                Dom.hasClass(parent, cssClass.BUTTON)) {
                if (setFocus) {
                    if (grandParent) {
                        children = Dom.getChildren(grandParent);
                        if (children) {
                            Dom.removeClass(children, cssClass.FOCUSSED_BUTTON);
                        }
                    }
                    Dom.addClass(parent, cssClass.FOCUSSED_BUTTON);
                } else {
                    Dom.removeClass(parent, cssClass.FOCUSSED_BUTTON);
                }
            }
        }