/**
 * DevExtreme (esm/renovation/component_wrapper/utils/utils.js)
 * Version: 21.2.0 (build 21200-0321)
 * Build date: Mon Jul 19 2021
 *
 * Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
import {
    each
} from "../../../core/utils/iterator";
export var addAttributes = ($element, attributes) => {
    each(attributes, (_, _ref) => {
        var {
            name: name,
            value: value
        } = _ref;
        if ("class" === name) {
            $element.addClass(value)
        } else {
            $element.attr(name, value)
        }
    })
};
export function getAriaName(name) {
    return "role" === name || "id" === name ? name : "aria-".concat(name)
}
export var removeDifferentElements = ($children, $newChildren) => {
    each($newChildren, (__, element) => {
        var hasComponent = false;
        each($children, (_, oldElement) => {
            if (element === oldElement) {
                hasComponent = true
            }
        });
        if (!hasComponent && element.parentNode) {
            element.parentNode.removeChild(element)
        }
    })
};
