@moomfe/zenjs
Version:
ZenJS 是一个高性能的 JavaScript 工具库。
15 lines (12 loc) • 420 B
JavaScript
import inBrowser from "../const/inBrowser";
import ElementProto from "../global/DomElement/prototype/index";
if( inBrowser && !ElementProto.matches ){
[ 'webkit', 'o', 'ms', 'moz' ].$each( core => {
const matchesKey = core + 'MatchesSelector';
const matchesValue = ElementProto[ matchesKey ];
if( matchesValue ){
ElementProto.matches = matchesValue;
return false;
}
});
}