Do different shimming for element.querySelector() and element.matches()

This commit is contained in:
Nazar Mokrynskyi
2015-01-29 20:58:18 +01:00
parent 7bb92937ad
commit e913ef46fe

View File

@@ -49,6 +49,10 @@
}
function shimSelector(selector) {
return String(selector).replace(/\/deep\/|::shadow/g, ' ');
}
function shimMatchesSelector(selector) {
return String(selector)
// Transform `:host(selector)` to `selector`
.replace(
@@ -206,7 +210,7 @@
var MatchesInterface = {
matches: function(selector) {
selector = shimSelector(selector);
selector = shimMatchesSelector(selector);
return scope.originalMatches.call(unsafeUnwrap(this), selector);
}
};