Skip to content

Commit

Permalink
Avoid regexp for better readability
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Cherniavskii <[email protected]>
Signed-off-by: Armin Mehinovic <[email protected]>
  • Loading branch information
arminmeh and cherniavskii authored Apr 23, 2024
1 parent 45bd683 commit 4cf98fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/x-data-grid/src/utils/domUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export function findHeaderElementFromField(elem: Element, field: string): HTMLDi
}

export function getFieldsFromGroupHeaderElem(colCellEl: Element): string[] {
const found = colCellEl.getAttribute('data-fields')!.match(/^\|-(.+)-\|$/);
return found ? found[1].split('-|-') : [];
const fieldsString = colCellEl.getAttribute('data-fields');
return fieldsString?.startsWith('|-') ? fieldsString!.slice(2, -2).split('-|-') : [];
}

export function findGroupHeaderElementsFromField(elem: Element, field: string): Element[] {
Expand Down

0 comments on commit 4cf98fc

Please sign in to comment.