Skip to content

Commit

Permalink
Convert format of attribute selector
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-plummer committed Feb 5, 2024
1 parent 84c7a7b commit 91a41d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { getParents } from './getParents';
import { getAttribute } from './getAttribute';

const dataRegex = /^data-.+/;
const attrRegex = /^attribute-(.+)/m;
const attrRegex = /^attribute:(.+)/m;

/**
* Returns all the selectors of the element
Expand Down
4 changes: 2 additions & 2 deletions test/unique-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ describe( 'Unique Selector Tests', () =>
$( 'body' ).get( 0 ).innerHTML = ''; // Clear previous appends
$( 'body' ).append( '<div contenteditable class="test8"></div>' );
const findNode = $( 'body' ).find( '.test8' ).get( 0 );
const uniqueSelector = unique( findNode, { selectorTypes : ['attribute-contenteditable'] } );
const uniqueSelector = unique( findNode, { selectorTypes : ['attribute:contenteditable'] } );
expect( uniqueSelector ).to.equal( '[contenteditable]' );
})

it('attribute with value', () => {
$( 'body' ).get( 0 ).innerHTML = ''; // Clear previous appends
$( 'body' ).append( '<div role="button" class="test9"></div>' );
const findNode = $( 'body' ).find( '.test9' ).get( 0 );
const uniqueSelector = unique( findNode, { selectorTypes : ['attribute-role'] } );
const uniqueSelector = unique( findNode, { selectorTypes : ['attribute:role'] } );
expect( uniqueSelector ).to.equal( '[role="button"]' );
})
})
Expand Down

0 comments on commit 91a41d4

Please sign in to comment.