Add onLoad attribute to `<link>` tag
This PR is to address the issue of absence of onLoad attribute on <link> tags.
The code changes involve adding new tag property, onload, to HelmetConstants.js
This allows the ability to add the following variations of <link> tags.
<div>
<Helmet>
{/* link elements */}
<link onLoad="doSomethingInteresting()" rel="stylesheet" media="all" type="text/css" href="critical-style.css" />
<link onLoad="if(media!='all')media='all'" rel="stylesheet" media="none" type="text/css" href="non-critical-style.css" />
</Helmet>
</div>
Two new tests have also been added to both declarative API. They test the rendered output of the tag elements.
Codecov Report
Merging #299 into master will not change coverage. The diff coverage is
100%.
@@ Coverage Diff @@
## master #299 +/- ##
======================================
Coverage 97.6% 97.6%
======================================
Files 3 3
Lines 292 292
======================================
Hits 285 285
Misses 7 7
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/HelmetConstants.js | 100% <ø> (ø) |
:arrow_up: |
| src/Helmet.js | 100% <ø> (ø) |
:arrow_up: |
| src/HelmetUtils.js | 96.87% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update c102586...54676f1. Read the comment docs.
Please merge this ! Highly needed when used in combination with react-static !
Any word on releasing this update? It would be nice to use this for loading of stylesheets like in @kesava 's example.
I’m also looking for the ability to use onLoad and onError on <link /> elements. @kesava This looks great. Also looks like the license/cla check is reporting that you haven’t yet signed the CLA. Maybe doing so could help this excellent PR get merged and released?
This seems to be stuck because of the License Agreement, can you comment @kesava? This feature would really help out a few of our teams as well.
@kesava @potench Any news about this PR?
Will script tags be support onLoad too?
@acusti @Grmiade @potench fixed the CLA agreement issue and the commit now passes all the tests.
Let's go !
When is this getting merged...? @kesava
Hey, great PR, would be really handy if it could be merged. Any news on this? @cwelch5, maybe?
@kesava can you merge master into your PR? I'll have some time this week to review.
We also have this issue, @kesava could you merge this?
@kesava +1 for this to be merged!! 🥇 👍
@tmbtech can we merge this 🙏 Blocked on this issue and without this PR I'm going to need a pretty nasty workaround.
+1, why don't merged? How can we handle load events on Helmet-wrapped scripts?
Hello, Is there anything I can help with to get this merged
Thank you @sgnl, if you could merge with master and resolve the conflicts, I can work to get this merged this week.
@sgnl @cwelch5 Is there any word on when this will be merged / released? Thanks 👍
I'll focus on this after updating the dependencies.
➕ 1️⃣ Please merge this! We would really like to use this feature to improve percieved performance on our website.
So.. I should give up on this library and look for other script-handling libraries since this 4-file change has been open for 5 years now, right?
So.. I should give up on this library and look for other script-handling libraries since this 4-file change has been open for 5 years now, right?
Looks like it.
I just checked and react-helmet-async, a fork which had some improvements, hasn't had a release for 4 years either.
So.. I should give up on this library and look for other script-handling libraries since this 4-file change has been open for 5 years now, right?
I am sorry, I updated the PR a couple of times (i think) and it never got merged, and I gave up.
So.. I should give up on this library and look for other script-handling libraries since this 4-file change has been open for 5 years now, right?
I am sorry, I updated the PR a couple of times (i think) and it never got merged, and I gave up.
I don't blame you! Disappointed that such a widely used and recommended repo wasn't able to keep or get maintainers that could support PRs by the community. Important ones at that!