You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicfunctiontestIsDepth() : void
{
$dom = html5qp('<p><span>foo</span></p>');
self::assertTrue($dom->is('p'), "Should match element held directly in the collection");
self::assertFalse($dom->is('span'), "Should not match a descendant of element held in the collection");
}
->is($selector) will return true if any descendant of an element held in the collection matches the selector. This diverges from jQuery specification, as evidenced by this filddle, and IMO that makes ->is() useless. At the very least, the original functionality of jQuery's .is() should be provided somehow.
QueryPath version
3.2.3
PHP Version and environment (server type, cli provider etc., enclosing libraries and their respective versions)
8.3.4 (cli) on up-to-date Arch Linux
Minimal reproducible PHP+HTML snippet to replicate bug
echohtml5qp('<p><span>foo</span></p>')->is('span') ? "Is, but shouldn't be\n" : "Isn't, and that's fine\n";
The text was updated successfully, but these errors were encountered:
Thank you for reporting this issue @rulatir. I agree that is() should act like the jQuery equivalent (where possible). It looks like QueryPath's ->is($selector) currently works like ->has($selector), but returns a boolean.
Guidelines
Description of the bug
As demonstrated by this failing test:
->is($selector)
will return true if any descendant of an element held in the collection matches the selector. This diverges from jQuery specification, as evidenced by this filddle, and IMO that makes->is()
useless. At the very least, the original functionality of jQuery's.is()
should be provided somehow.QueryPath version
3.2.3
PHP Version and environment (server type, cli provider etc., enclosing libraries and their respective versions)
8.3.4 (cli) on up-to-date Arch Linux
Minimal reproducible PHP+HTML snippet to replicate bug
The text was updated successfully, but these errors were encountered: