Villhellm / custom-sidebar

Custom Sidebar for Home Assistant
115 stars 23 forks source link

Exact matching should only look at the title text #45

Open bmcclure opened 1 year ago

bmcclure commented 1 year ago

I have both "Home" and "ESPHome", and without exact matching "Home" matches both items. But when I turn on exact matching, it doesn't seem to work. I tested it on all of my items, and it only matched a few of them even though I am using the correct exact titles.

Looking at the code, I think that might be because it uses the innerHTML JavaScript function. It has some code that strips out a specific empty comment string (twice?), however many of my sidebar items have seemingly random IDs inside that comment string, so I think the entire comment is being included in the exact match condition.

Would it make more sense to use textContent instead of innerHTML so that it only includes the actual visible text? Then there should also be no need to try and strip the comment tags out.