Skip to content

fix(text selector): make quoted selector match by text nodes#5603

Merged
dgozman merged 1 commit into
microsoft:masterfrom
dgozman:text-quoted-case
Feb 25, 2021
Merged

fix(text selector): make quoted selector match by text nodes#5603
dgozman merged 1 commit into
microsoft:masterfrom
dgozman:text-quoted-case

Conversation

@dgozman
Copy link
Copy Markdown
Collaborator

@dgozman dgozman commented Feb 24, 2021

This change turns quoted match to be case-sensitive (as before),
but not strictly full-string for the whole element's text.

This is a fix for a case where element contains text nodes and child elements:

<div>text1<span>child node</span>text2</div>

We now match this div by text="text1" and text="text2".

This change turns quoted match to be case-sensitive (as before),
but not strictly full-string for the whole element's text.

This is a fix for a case where element contains text nodes and child elements:
```html
<div>text1<span>child node</span>text2</div>
```
We now match this div by `text="text1"` and `text="text2"`.
@dgozman dgozman merged commit 0102e08 into microsoft:master Feb 25, 2021
aslushnikov pushed a commit to aslushnikov/playwright that referenced this pull request Feb 25, 2021
…icrosoft#5603)

This change turns quoted match to be case-sensitive (as before),
but not strictly full-string for the whole element's text.

This is a fix for a case where element contains text nodes and child elements:
```html
<div>text1<span>child node</span>text2</div>
```
We now match this div by `text="text1"` and `text="text2"`.
aslushnikov pushed a commit to aslushnikov/playwright that referenced this pull request Feb 25, 2021
aslushnikov added a commit that referenced this pull request Feb 25, 2021
…5603) (#5608)

Cherry-pick 0102e08

Fixes #5583

Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
@niranjan-borawake
Copy link
Copy Markdown

niranjan-borawake commented Feb 26, 2021

This change turns quoted match to be case-sensitive (as before),
but not strictly full-string for the whole element's text.

This is a fix for a case where element contains text nodes and child elements:

<div>text1<span>child node</span>text2</div>

We now match this div by text="text1" and text="text2".

Hello @dgozman ,

What's the recommended way to do strict full string search?

If I have -

<div>Hello World..!</div> <div>Hello</div>

What's the recommended way to select second div?
The way I chose was text=/^Hello$/

@ychaudhari
Copy link
Copy Markdown

ychaudhari commented Mar 1, 2021

I had element like this:

<h2>
	<span>Title:</span>
	&nbsp;
	<span>text</span>
</h2>

My selector await expect(page).toHaveSelector('"text"'); was working in 1.8.1 but breaking in 1.9.0 and 1.9.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants