Skip to content

Commit 62bdb2c

Browse files
committed
MQE-1675: Remove 'Build selectors with appropriate specificity' from devdocs
1 parent 3e8ee44 commit 62bdb2c

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

docs/tips-tricks.md

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -345,33 +345,6 @@ BAD:
345345
<element name="productName" type="input" selector=".admin__field[data-index=name] input"/>
346346
```
347347

348-
### Build selectors with appropriate specificity
349-
350-
Selectors that are too general might sweep up unexpected elements.
351-
When possible, select the first parent tag and then specify the desired element within that selection.
352-
353-
**Why?** Elements that are overly specific are less flexible and may fail if unexpected DOM changes occur. It also reduces the amount of the DOM it needs to parse.
354-
355-
<span style="color:green">
356-
GOOD:
357-
</span>
358-
359-
```html
360-
form[name='myform'] > input[name='firstname']
361-
362-
//*[@id='container'][@class='dashboard-title']
363-
```
364-
365-
<span style="color:red">
366-
BAD:
367-
</span>
368-
369-
```html
370-
input[name='firstname']
371-
372-
//*[@id='container']/*[@class='dashboard-advanced-reports']/*[@class='dashboard-advanced- reports-description']/*[@class='dashboard-title']
373-
```
374-
375348
## General tips
376349

377350
### Use data references to avoid hardcoded values

0 commit comments

Comments
 (0)