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

src/preact: use URL instead of parseUrlDeprecated #37561

Merged
merged 3 commits into from Feb 4, 2022

Conversation

samouri
Copy link
Member

@samouri samouri commented Feb 3, 2022

summary
We should not use the deprecated path in new code.
This breaks IE11 compat.

bundle size diff

extensions/amp-mathml/1.0/dist/component-react.js: Δ -0.41KB
dist/v0/bento-mathml-1.0.js: Δ -0.40KB
extensions/amp-embedly-card/1.0/dist/component-react.js: Δ -0.41KB
dist/v0/bento-embedly-card-1.0.js: Δ -0.40KB
extensions/amp-embedly-card/1.0/dist/component-preact.js: Δ -0.42KB
extensions/amp-twitter/1.0/dist/component-preact.js: Δ -0.40KB
extensions/amp-facebook/1.0/dist/component-react.js: Δ -0.42KB
extensions/amp-facebook/1.0/dist/component-preact.js: Δ -0.43KB
extensions/amp-mathml/1.0/dist/web-component.js: Δ -0.39KB
extensions/amp-embedly-card/1.0/dist/web-component.js: Δ -0.39KB
extensions/amp-twitter/1.0/dist/web-component.js: Δ -0.41KB
dist/v0/amp-twitter-1.0.mjs: Δ +0.02KB
extensions/amp-facebook/1.0/dist/web-component.js: Δ -0.37KB
dist/v0/amp-embedly-card-1.0.js: Δ -0.45KB

notifications
@ampproject/wg-bento

@samouri samouri self-assigned this Feb 3, 2022
@samouri samouri marked this pull request as ready for review February 3, 2022 16:02
@kvchari
Copy link
Contributor

kvchari commented Feb 3, 2022

Out of curiosity, how do you generate your bundle size diff?

@samouri
Copy link
Member Author

samouri commented Feb 3, 2022

Out of curiosity, how do you generate your bundle size diff?

@kvchari: its in the checks tab! There were more diffs than these, but they were all relatively insignificant.

src/preact/component/3p-frame.js Outdated Show resolved Hide resolved
@@ -105,7 +104,7 @@ function ProxyIframeEmbedWithRef(
};
setNameAndSrc({
name: JSON.stringify({
'host': parseUrlDeprecated(src).hostname,
'host': new URL(src, win.location).hostname,
Copy link
Contributor

Choose a reason for hiding this comment

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

Techincally, but does TS not yell at you? The second arg needs to be a string, but location gets coerced to a string so it works in regular JS.

Copy link
Member Author

Choose a reason for hiding this comment

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

preact/component/*.js isnt' being typechecked yet. that will happen once this lands: #37463

Will preemptively call .toString() here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you're looking for .href… 😝

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.

None yet

4 participants