I need to find the closest parent that contains the following css property:
background-image: url(*here goes a link to a valid image*);
You can probably find this by selecting all the elements, filtering them in the array and then using the first / last element of the array, but I would like to know if there is a faster way to select the closest parent that fulfills the requirement that I mentioned earlier, eg:
<parent1 style="background-image:url(http://google.com/images/photo.png);">
<parent2 style="background-image:url('http://google.com/images/photo.png');">
<mydiv></mydiv>
</parent2>
</parent1>
I want parent 2 selected;
Keep in mind that I do not know background url .
source
share