Review main Merged

64384[TASK] Use getElementById where feasible

Andreas Kienast CR +2 V +2 Normal +26 −26 updated 05/09/20, 13:01

Commit message

It's safe to use getElementById() instead of querySelector() in case an
element is fetched by its ID.

Numbers for nerds:
getElementById() is nearly 1.5x faster than querySelector(). To be fair,
both functions are really fast with executing multiple million operations
per second, thus nobody will notice a performance impact.
See https://www.measurethat.net/Benchmarks/ShowResult/106740

Review

  • Code review CR +2 Done
    • Daniel Goerz +2
    • Benjamin Franzke +1
  • Verified V +2 Done
    • Daniel Goerz +2
    • Benjamin Franzke +1
    • TYPO3com +1 CI

Issues 2

Files 24

Show 4 more files

Review log 1517

  1. Andreas Kienast uploaded patch set 1 05/01/20, 11:47

  2. TYPO3com voted on patch set 1 V +1 05/01/20, 11:58 Completed build in 10m 53s on Fri, 1 May, 11:58 AM Test Summary: 73663 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3148

  3. Georg Ringer commented on patch set 1 V +1 CR +1 05/04/20, 11:12

    ToggleSearchToolbox.ts:41

    shouldn't this be kept?

    BackendUserListing.ts:24 Unresolved

    shouldn't this be kept?
  4. Andreas Kienast commented on patch set 1 05/04/20, 11:13

    ToggleSearchToolbox.ts:41 Reply

    It doesn't hurt to change it to getElementById()
  5. Benjamin Franzke commented on patch set 1 CR -1 05/04/20, 11:30

    There is document.querySelector(`#dashboardModal-${this.dataset.modalIdentifier}`) left in Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/DashboardModal.ts And some document.querySelector('#' + …) calls in Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/InlineControlContainer.ts Those should be feasible as well. See: git grep "document.querySelector(.#" | grep -v "define(\|/Documentation
  6. Benjamin Franzke commented on patch set 1 05/04/20, 11:33

    ToggleSearchToolbox.ts:41 Reply

    @Georg: I'm wondering why you think that these should be kept? Because of the HTMLInputElement type assertion?
  7. Andreas Kienast commented on patch set 1 05/04/20, 11:35

    > There is > > document.querySelector(`#dashboardModal-${this.dataset.modalIdentifier}`) > > left in Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/DashboardModal.ts Ack > And some document.querySelector('#' + …) calls in Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/InlineControlContainer.ts Those should've been fixed in another patch. Are you sure your checkout is up-to-date? Your command also reveals just the DashboardModal for me (thx by the way for providing this).
  8. Benjamin Franzke commented on patch set 1 05/04/20, 12:50

    Ah, I see https://review.typo3.org/c/Packages/TYPO3.CMS/+/64343 fixed InlineControlContainer.ts and was merged in the meantime and I used `git checkout`, not `git cherry-pick`. Maybe you could also git-rebase when fixing DashboardModel.ts (to reflect the dependency of this patch to the one that has already been merged).
  9. Georg Ringer commented on patch set 1 05/04/20, 14:29

    ToggleSearchToolbox.ts:41 Reply

    yes reffering the "as HTMLInputElement"
  10. Andreas Kienast commented on patch set 1 05/04/20, 15:47

    ToggleSearchToolbox.ts:41 Reply Unresolved

    I don't get what you want. the `as HTMLInputElement` is required here, otherwise the code won't compile due to type mismatches.
  11. Andreas Kienast uploaded patch set 2 05/04/20, 15:52

  12. TYPO3com voted on patch set 2 V +1 05/04/20, 16:04 Completed build in 11m 38s on Mon, 4 May, 04:04 PM Test Summary: 73663 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3194

  13. Benjamin Franzke voted on patch set 2 CR +1 05/05/20, 08:04

  14. Daniel Goerz voted on patch set 2 CR +1 05/07/20, 16:41

  15. Benjamin Franzke voted on patch set 2 V +1 05/08/20, 09:23

  16. Daniel Goerz voted on patch set 2 V +2 CR +2 05/09/20, 13:00

  17. Daniel Goerz merged patch set 3 05/09/20, 13:01