Cause it seems to behave in a counter-intuitive way.
A query like:
const node = create({ scope: '.one' });
findOne(node, '.two', { scope: '.three' });
generates a selector like .one .three .two.
If a selector like this is really needed, it's possible to do it in a simpler way like:
findOne(node, '.three .two');
I think the rationale for the scope option was to support finder signatures without a string selector argument, like
findOne(node, { scope: '.three .two' });
However, as shown above, in its 3-argument form it looks broken.
Implementation plan
In order to support the 2-argument signature with options, let's implement the new option called selector.
This would be only allowed in the 2-argument signature form:
findOne(node, { selector: '.two' });
// => `.one .two`
// together with the `scope` the works exactly like it works today
findOne(node, { selector: '.two', scope: '.three' });
// => `.one .three .two`
// WRONG: passing 2 selectors should not be possible
findOne(node, '.two', { selector: '.boom' });
// => Throw!
Then we can deprecate the scope, and remove it at some point.
Cause it seems to behave in a counter-intuitive way.
A query like:
generates a selector like
.one .three .two.If a selector like this is really needed, it's possible to do it in a simpler way like:
I think the rationale for the
scopeoption was to support finder signatures without a string selector argument, likeHowever, as shown above, in its 3-argument form it looks broken.
Implementation plan
In order to support the 2-argument signature with options, let's implement the new option called
selector.This would be only allowed in the 2-argument signature form:
Then we can deprecate the
scope, and remove it at some point.