M Falanga
M Falanga

Reputation: 2077

IE11 Can't Tell that Two Strings are Equal

For whatever reason, a condition is returning false when by all my accounts, it should be true. It's just a simple string comparison; and Chrome gets it right.

In the IE developer tools, I put a breakpoint on the line, and tried different things. Here's the output: enter image description here

The code this is getting called from is a jQueryUI widget. Here's the full block that the code is running in. I can post the entire widget if that's helpful.

this.element.children('option').each(function() {
    if ($(this).text() === select.val()) {  // Why does this evaluate to false?!?!?
        $(this).text(value)
        ctl._trigger('select', event, {
            item: this
        });
        return false;
    }
});

Upvotes: 5

Views: 1652

Answers (1)

plalx
plalx

Reputation: 43728

Does $(this).text.match(/[\w ]+/)[0] and select.val().match(/[\w ]+/)[0] return the same thing?

I believe some of you space-like characters aren't spaces.

Upvotes: 4

Related Questions