mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-03 07:51:12 +03:00
fix(selectors): :scope
combined with other css should work (#18324)
Previously, we considered root when selector has `:scope` modifier, but did not actually match it with other css specifiers, like in `:scope.selected`. Fixes #17824.
This commit is contained in:
parent
721ae2b3ed
commit
0653692a5b
@ -206,7 +206,7 @@ export class SelectorEvaluatorImpl implements SelectorEvaluator {
|
||||
if (css !== undefined) {
|
||||
elements = this._queryCSS(context, css);
|
||||
const hasScopeClause = funcs.some(f => f.name === 'scope');
|
||||
if (hasScopeClause && context.scope.nodeType === 1 /* Node.ELEMENT_NODE */)
|
||||
if (hasScopeClause && context.scope.nodeType === 1 /* Node.ELEMENT_NODE */ && this._matchesCSS(context.scope as Element, css))
|
||||
elements.unshift(context.scope as Element);
|
||||
} else {
|
||||
firstIndex = funcs.findIndex(func => this._getEngine(func.name).query !== undefined);
|
||||
|
@ -394,7 +394,6 @@ it('should work with :scope', async ({ page, server }) => {
|
||||
|
||||
it('should work with :scope and class', async ({ page }) => {
|
||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/17824' });
|
||||
it.fixme();
|
||||
await page.setContent(`<div class="apple"></div>
|
||||
<div class="apple selected"></div>`);
|
||||
const apples = page.locator('.apple');
|
||||
|
Loading…
Reference in New Issue
Block a user