Skip to content
This repository has been archived by the owner on Feb 7, 2021. It is now read-only.

terales/closest-parent-by-attributes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Get closest parent which has specified attributes

This module implemented to get selector of clicked nodes for web analytics configuration automated check

Build Status Coverage Status

<ul class="menu">
    <li class="menu-item">
        <a class="menu-link" title="Click to go" data-interaction-id="12345"> <!-- This node has analytics attributes -->
            <span class="click-target">Click target</span> <!-- This is click target -->
        </a>
    </li>
</ul>
getClosestParentByAttributes(clickTarget, ['class', 'title', 'data-interaction-id']
// returns [class="menu-link"][title="Click to go"][data-interaction-id="12345"] span