Skip to content

refactor: use helper function to iterate DOM children - #5059

Merged
web-padawan merged 2 commits into
masterfrom
refactor/iterate-children
Nov 22, 2022
Merged

web-padawan merged 2 commits into
masterfrom
refactor/iterate-children

Conversation

@web-padawan

@web-padawan web-padawan commented Nov 21, 2022 •

Copy link
Copy Markdown
Member

Description

While working on #5020, I noticed that we use Array.from(row.children) and [...row.children] in grid quite a lot.
Created a small helper function to make the code a bit cleaner and updated a couple of occurrences to use it.

Type of change

  • Refactor

Comment on lines -374 to -378
Array.from(this.$.items.children)
.filter((row) => !row.hidden)
.forEach((row) => {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the code here and elsewhere to use forEach and if instead of filter() + forEach().

@web-padawan
web-padawan force-pushed the refactor/iterate-children branch 3 times, most recently from 4d65c2b to 5b1a722 Compare November 21, 2022 12:06
@web-padawan
web-padawan force-pushed the refactor/iterate-children branch from 5b1a722 to 7bcf40d Compare November 22, 2022 09:35
@web-padawan
web-padawan marked this pull request as ready for review November 22, 2022 09:35
@sissbruecker

Copy link
Copy Markdown
Member

Found one more occurrence here:

Array.from(this.$.items.children).forEach((row) => {

@web-padawan

Copy link
Copy Markdown
Member Author

Found one more occurrence here

Thanks, updated.

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 24.0.0.alpha5 and is also targeting the upcoming stable 24.0.0 version.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants