Currently, I am utilizing jQuery to determine if there exists an li element within the #mainNavigation div that possesses the data-val attribute of "-1". This functionality is easily achievable with jQuery, however, I am in need of replicating the same behavior but using JavaScript. My dilemma lies in grasping how to achieve the same level of specificity in drilling down elements as facilitated by jQuery selectors.
if(document.querySelector("#mainNavigation ul li ul li[data-val='-1']")) {
document.getElementById("mainNavigation").style.paddingLeft = "10px";
};
<div id="mainNavigation">
<ul>
<li>
<ul>
<li data-val="-1">Title</li>
</ul>
</li>
</ul>
</div>