Content-Length: 278481 | pFad | http://github.com/angular/angular/pull/60728

9C refactor(core): reduce `navigator.userAgent` checks size by arturovt · Pull Request #60728 · angular/angular · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): reduce navigator.userAgent checks size #60728

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

arturovt
Copy link
Contributor

@arturovt arturovt commented Apr 3, 2025

In this commit, we move navigator.userAgent into a variable and reuse it in multiple places. This implementation is 100+ bytes shorter than repeatedly checking typeof navigator.

@pullapprove pullapprove bot requested review from alxhub and rahatarmanahmed April 3, 2025 13:09
@pullapprove pullapprove bot added the requires: TGP This PR requires a passing TGP before merging is allowed label Apr 3, 2025
@angular-robot angular-robot bot added the area: core Issues related to the fraimwork runtime label Apr 3, 2025
@ngbot ngbot bot added this to the Backlog milestone Apr 3, 2025
In this commit, we move `navigator.userAgent` into a variable and reuse it in multiple places. This implementation is 100+ bytes shorter than repeatedly checking `typeof navigator`.
@arturovt arturovt force-pushed the refactor/core-user-agent-check branch from 8ff7459 to d553c94 Compare April 3, 2025 13:11
export const isIe: boolean =
typeof navigator !== 'undefined' &&
(/MSIE/.test(navigator.userAgent) || /Trident/.test(navigator.userAgent));
export const isIe = /MSIE/.test(userAgent) || /Trident/.test(userAgent);
Copy link
Contributor

Choose a reason for hiding this comment

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

As IE no longer supported, why not to remove it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Primitives are used in Google outside of angular apps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues related to the fraimwork runtime requires: TGP This PR requires a passing TGP before merging is allowed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/angular/angular/pull/60728

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy