-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add tests for Optimize Embeds #979
Add tests for Optimize Embeds #979
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
tests/modules/js-and-css/optimize-embeds/optimize-oembeds-test.php
Outdated
Show resolved
Hide resolved
tests/modules/js-and-css/optimize-embeds/optimize-oembeds-test.php
Outdated
Show resolved
Hide resolved
tests/modules/js-and-css/optimize-embeds/optimize-oembeds-test.php
Outdated
Show resolved
Hide resolved
tests/modules/js-and-css/optimize-embeds/optimize-oembeds-test.php
Outdated
Show resolved
Hide resolved
tests/modules/js-and-css/optimize-embeds/optimize-oembeds-test.php
Outdated
Show resolved
Hide resolved
tests/modules/js-and-css/optimize-embeds/optimize-oembeds-test.php
Outdated
Show resolved
Hide resolved
tests/modules/js-and-css/optimize-embeds/optimize-oembeds-test.php
Outdated
Show resolved
Hide resolved
tests/modules/js-and-css/optimize-embeds/optimize-oembeds-test.php
Outdated
Show resolved
Hide resolved
// Twitter embed. | ||
array( | ||
'<blockquote class="twitter-tweet" data-width="500" data-dnt="true"><p lang="en" dir="ltr"Feedback <a href="https://t.co/anGk6gWkbc">https://t.co/anGk6gWkbc</a></p>— <a href="https://twitter.com/ChromiumDev/status/1636796541368139777?ref_src=twsrc%5Etfw">March 17, 2023</a></blockquote><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>', | ||
'<blockquote class="twitter-tweet" data-width="500" data-dnt="true"><p lang="en" dir="ltr"Feedback <a href="https://t.co/anGk6gWkbc">https://t.co/anGk6gWkbc</a></p>— <a href="https://twitter.com/ChromiumDev/status/1636796541368139777?ref_src=twsrc%5Etfw">March 17, 2023</a></blockquote><script data-lazy-embed-src="https://platform.twitter.com/widgets.js" async charset="utf-8"></script>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just had a thought. What if instead of converting script[src]
to script[data-lazy-embed-src]
, it instead set the type
attribute of text/x.lazy-loaded-javascript
? Clearly out of scope for this PR, but just thought of this alternative. It probably doesn't make any difference, oh except actually wouldn't it be better in that it would prevent the browser from treating this script
as an inline script? While the browser hopefully is smart enough to skip parsing an inline script that has no contents, in the worst case it could. That would be bad because inline scripts are blocking. If the src
is left-as is and the type
is used to mark such lazy-loaded scripts instead, this would be avoided. This is also what Partytown does to mark its scripts via text/partytown
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting! I haven't seen this approach but it makes sense that it would work. feel free to propose on another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you go! #983
….php Co-authored-by: Weston Ruter <[email protected]>
….php Co-authored-by: Weston Ruter <[email protected]>
….php Co-authored-by: Weston Ruter <[email protected]>
….php Co-authored-by: Weston Ruter <[email protected]>
….php Co-authored-by: Weston Ruter <[email protected]>
….php Co-authored-by: Weston Ruter <[email protected]>
Summary
Adds some tests for Optimize Embeds; also complete rename. Using Optimize Embeds because this could broaden scope beyond just "lazy".
Follow up to https://github.com/WordPress/performance/pull/886/files
Checklist
[Focus]
orInfrastructure
label.[Type]
label.no milestone
label.