Attribute matchers in CSS don't work with IE11

2019-07-22 11:28发布

问题:

We noticed on our website that the CSS was broken with IE11, while it worked fine with IE10. After a look at the CSS source, it turns out that IE11 (it seems) has dropped its support for attributes matchers: we tried on our VM, we tried on BrowserStack, and the result is that these rules...

img[src$='separator.png'] { display: none; }
a[href="javascript:addBookemart()"] { text-decoration: none; }

... do work on IE10, but not anymore on IE11. I find it hard to believe that the support for this feature would've been dropped... plus, I can't find anyone talking about such a thing over the interwebs. Might there be anything else causing this issue?

Here's a pen for testing purposes:

http://codepen.io/anon/pen/GJNyJW

回答1:

In my experience, IE11 is picky about [attr="value"] having double quotes around the value.



回答2:

I found I was having this issue and it turned out that IE11 was case sensitive with the attribute values.