Remove usage of getElementProp #3757
Labels
1 - assigned
Issues that are assigned to a sprint and a team member.
Calcite (dev)
Issues logged by Calcite developers.
epic
Large scale issues to be broken up into sub-issues and tracked via sprints and/or project.
refactor
Issues tied to code that needs to be significantly reworked.
Milestone
Summary
Remove usage of the
getElementProp
util.getElementProp
is misleading from a naming and implementation perspective and needs to be revisited.Current implementation
getElementProp
reads as a helper to get a prop, but it will actually get an attribute (string) OR whatever fallback value is provided.prop
argument is used to build the selector for searching. This will only work for single-word props, e.g., will always fail forsomeName
(prop), where the attribute issome-name
.value
argument have non-string types. This will lead to a mismatch or confusion on the expected value:Proposal
Refactor
getElementProp
to:export function getElementProp(el: HTMLElement, prop: string, value: T): T ;
Introduce
getElementAttr
, which would be based on ☝export function getElementAttr(el: HTMLElement, attr: string, value: string): string ;
attr
arg to build selectorgetAttribute
returns)Related Issues:
getElementProp
to setstatus
#3755Which Component
Other files that reference
getElementProp
:The text was updated successfully, but these errors were encountered: