So the problem is that you are making decisions based upon the text in the elements, and the text contains encoded HTML entities, correct?
That's correct.
Why aren't you using element classes to tag elements for comparisons and processing?
I'm not sure of this method. Can you please show some simple example using Javascript?