Skip to content

Commit

Permalink
Trim classname selector (#328)
Browse files Browse the repository at this point in the history
  • Loading branch information
tunetheweb committed Mar 6, 2023
1 parent 5f658d4 commit 9664b8b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/getSelector.ts
Expand Up @@ -30,8 +30,8 @@ export const getSelector = (node: Node | null | undefined, maxLen?: number) => {
const part = el.id
? '#' + el.id
: getName(el) +
(el.className && el.className.length
? '.' + el.className.replace(/\s+/g, '.')
(el.className && el.className.trim().length
? '.' + el.className.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 9664b8b

Please sign in to comment.