(el: HTMLElement, attributes: string[] = [])
| 101 | * does not trigger a re-render. |
| 102 | */ |
| 103 | export const inheritAttributes = (el: HTMLElement, attributes: string[] = []) => { |
| 104 | const attributeObject: Attributes = {}; |
| 105 | |
| 106 | attributes.forEach((attr) => { |
| 107 | if (el.hasAttribute(attr)) { |
| 108 | const value = el.getAttribute(attr); |
| 109 | if (value !== null) { |
| 110 | attributeObject[attr] = el.getAttribute(attr); |
| 111 | } |
| 112 | el.removeAttribute(attr); |
| 113 | } |
| 114 | }); |
| 115 | |
| 116 | return attributeObject; |
| 117 | }; |
| 118 | |
| 119 | /** |
| 120 | * List of available ARIA attributes + `role`. |
no outgoing calls
no test coverage detected