UNPKG

@progress/kendo-angular-common

Version:

Kendo UI for Angular - Utility Package

45 lines (44 loc) 1.44 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { isPresent } from "./ng-class-parser"; import { take } from "rxjs/operators"; /** * @hidden */ export const setHTMLAttributes = (attributes, renderer, element, zone) => { zone ? zone.onStable.pipe(take(1)).subscribe(() => { applyAttributes(attributes, renderer, element); }) : applyAttributes(attributes, renderer, element); }; /** * @hidden */ export const removeHTMLAttributes = (attributes, renderer, element) => { for (const attribute in attributes) { if (attribute) { renderer.removeAttribute(element, attribute); } } }; /** * @hidden */ export const parseAttributes = (target, source) => { const targetObj = target; Object.keys(source).forEach(key => { delete targetObj[key]; }); return targetObj; }; /** * @hidden */ export const applyAttributes = (attributes, renderer, element) => { for (const attribute in attributes) { if (attribute && isPresent(attributes[attribute])) { renderer.setAttribute(element, attribute, attributes[attribute]); } } };