const imgs = Array.prototype.reduce.call(
document.querySelectorAll('img'),
(acc, img, i, arr) => {
if(img.previousElementSibling !== arr[i - 1])
acc.push([img]);
else
acc[acc.length - 1].push(img);
return acc;
},
[]
);
container.querySelectorAll('[data-title]').forEach((element) => {
// eslint-disable-next-line no-param-reassign
element.closest('[data-card]').style.display = element.innerText.toLowerCase().includes(val)
? 'block'
: 'none';
});
for(const element of container.querySelectorAll('[data-title]')) {
element.closest('[data-card]').style.display = element.innerText.toLowerCase().includes(val)
? 'block'
: 'none';
}
<link rel="icon">
, если такого элемента нет - /favicon.ico
, всё.)