In this example, is passed through this?

Good day! I am new to JS.
Here here , the following piece of code:
selectorMatches function(el, selector) {
 var p = Element.prototype;
 var f = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || function(s) {
 return [], this) !== -1;
 return, selector);

I understand that .call first passed parameter indicates the context.
That is, in the end
return [], this) !== -1;
will be
return document.querySelectorAll(s).IndexOf(this) !== -1;

But how this correlates with the very challenge in line with the return, selector);?
As the context is transferred to element be used? and isn't that a simple analogue querySelectorAll(selector) get?
June 8th 19 at 17:03
1 answer
June 8th 19 at 17:05
You got that right, for ideas
[], this)


But document.querySelectorAll() returns a collection of type NodeList and is not the same as Array, so it does not have its own indexOf () method. So structure [], this) - this is a tricky way to do indexOf on an object which has no method indexOf. I suspect that somewhere in the bowels of the indexOf() turns this into an array by using Array.from(). This can be seen, for example, having "1" when execution of []'abc', 'b') and "-1" when performing [], 1).

Good initial design can be rewritten in


Then it will cause less questions.

Find more questions by tags JavaScript