Finally, I did what I had to do a week ago: try the same application in other web browsers .
Exactly the same code in Firefox, Internet Explorer 11, and Edge works as expected: it does not tolerate the problem explained in my question.
The joke here is a simple snippet that does not demonstrate the problem, because with this simple markup, Chrome 47 returns 0 nodes when requesting a selector using document.querySelectorAll . In my actual markup, it finds the whole element.
document.addEventListener("DOMContentLoaded", function() { document.getElementById("result").textContent = "elements found: " + document.querySelectorAll("md-input-container:not(.md-input-has-value) input:not(:focus)").length; });
<md-input-container class="md-input-has-value"> <label>Some label</label> <input ng-model="model.someProperty"> </md-input-container> <div id="result"></div>
Update
I upgraded Chrome to 48 and the problem was resolved. In the end, this is a problem with the browser with the :not selector when the elements are very nested. If someone can find an open / closed problem in Chrome trackers, it would be great to add a link to my answer.
Update 2
Argh! Now some <input> fields work well, while others are still experiencing this problem. These are those that are inside the directives.
Everything still works in Firefox, Explorer, and Edge.
source share