Skip to content

Commit

Permalink
Fix selector SVGs (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
tunetheweb authored Jun 12, 2023
1 parent 32919e4 commit 1d2c191
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/getSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ export const getSelector = (node: Node | null | undefined, maxLen?: number) => {
const part = el.id
? '#' + el.id
: getName(el) +
(el.className && el.className.trim().length
? '.' + el.className.trim().replace(/\s+/g, '.')
(el.classList &&
el.classList.value &&
el.classList.value.trim() &&
el.classList.value.trim().length
? '.' + el.classList.value.trim().replace(/\s+/g, '.')
: '');
if (sel.length + part.length > (maxLen || 100) - 1) return sel || part;
sel = sel ? part + '>' + sel : part;
Expand Down

0 comments on commit 1d2c191

Please sign in to comment.