react-helmet icon indicating copy to clipboard operation
react-helmet copied to clipboard

Add onLoad attribute to `<link>` tag

Open kesava opened this issue 8 years ago • 25 comments

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.

kesava avatar Jul 05 '17 22:07 kesava

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jul 05 '17 22:07 CLAassistant

Codecov Report

Merging #299 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          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 data Powered by Codecov. Last update c102586...54676f1. Read the comment docs.

codecov[bot] avatar Jul 05 '17 23:07 codecov[bot]

Please merge this ! Highly needed when used in combination with react-static !

crubier avatar Oct 11 '17 17:10 crubier

Any word on releasing this update? It would be nice to use this for loading of stylesheets like in @kesava 's example.

yowakita avatar Nov 28 '17 01:11 yowakita

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?

acusti avatar Feb 07 '18 04:02 acusti

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.

stevecosta avatar Apr 09 '18 19:04 stevecosta

@kesava @potench Any news about this PR? Will script tags be support onLoad too?

Grmiade avatar Jun 07 '18 11:06 Grmiade

@acusti @Grmiade @potench fixed the CLA agreement issue and the commit now passes all the tests.

kesava avatar Jun 08 '18 22:06 kesava

Let's go !

romainquellec avatar Jul 18 '18 09:07 romainquellec

When is this getting merged...? @kesava

swathitadak avatar Aug 16 '18 19:08 swathitadak

Hey, great PR, would be really handy if it could be merged. Any news on this? @cwelch5, maybe?

Tom-Bonnike avatar Oct 12 '18 12:10 Tom-Bonnike

@kesava can you merge master into your PR? I'll have some time this week to review.

tmbtech avatar Nov 16 '18 08:11 tmbtech

We also have this issue, @kesava could you merge this?

sheerun avatar Dec 10 '18 15:12 sheerun

@kesava +1 for this to be merged!! 🥇 👍

jmarkotter avatar Jan 28 '19 11:01 jmarkotter

@tmbtech can we merge this 🙏 Blocked on this issue and without this PR I'm going to need a pretty nasty workaround.

DavidChouinard avatar Apr 21 '19 00:04 DavidChouinard

+1, why don't merged? How can we handle load events on Helmet-wrapped scripts?

koutsenko avatar Jul 01 '19 12:07 koutsenko

Hello, Is there anything I can help with to get this merged

sgnl avatar Dec 06 '19 20:12 sgnl

Thank you @sgnl, if you could merge with master and resolve the conflicts, I can work to get this merged this week.

cwelch5 avatar Dec 10 '19 18:12 cwelch5

@sgnl @cwelch5 Is there any word on when this will be merged / released? Thanks 👍

jahilldev avatar May 20 '20 17:05 jahilldev

I'll focus on this after updating the dependencies.

cwelch5 avatar May 20 '20 17:05 cwelch5

➕ 1️⃣ Please merge this! We would really like to use this feature to improve percieved performance on our website.

endymion1818 avatar May 26 '20 08:05 endymion1818

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?

panzacoder avatar Jun 09 '22 04:06 panzacoder

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.

endymion1818 avatar Jun 09 '22 06:06 endymion1818

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.

kesava avatar Jun 09 '22 15:06 kesava

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!

panzacoder avatar Jun 09 '22 17:06 panzacoder