Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Allow to use ‘as’ attribute on HTML ‘link’ element #138

Closed
wants to merge 3 commits into from
Closed

Allow to use ‘as’ attribute on HTML ‘link’ element #138

wants to merge 3 commits into from

Conversation

gszy
Copy link
Contributor

@gszy gszy commented Sep 14, 2017

This patch allows to use the as attribute by the HeadLink helper.

Citing from MDN:

Using as to specify the type of content to be preloaded allows the browser to:

  • Prioritize resource loading more accurately.
  • Match future requests, reusing the same resource if appropriate.
  • Apply the correct content security policy to the resource.
  • Set the correct Accept request headers for it.

‘as’ attribute can be used as additional hint for the browser when
preloading resources. This patch allows to use the ‘as’ attribute by
HeadLink helper.
@gszy
Copy link
Contributor Author

gszy commented Sep 14, 2017

@froschdesign, do you think that a unit test similar to https://github.com/zendframework/zend-view/blob/master/test/Helper/HeadLinkTest.php#L437-L444 would be enough?

@froschdesign
Copy link
Member

@gscscnd

This patch allows to use the as attribute by the HeadLink helper.

The preload links are still work in progress. (Working Draft 2017-08-30)
We should not add this new HTML attribute, because it's too early and changes are possible.

We leave the issue open and add the label "WIP".

@gszy
Copy link
Contributor Author

gszy commented Sep 14, 2017

Ok, thank you for the explanation.

@froschdesign
Copy link
Member

do you think that a unit test similar to https://github.com/zendframework/zend-view/blob/master/test/Helper/HeadLinkTest.php#L437-L444 would be enough?

Right!

@@ -51,7 +51,8 @@ class HeadLink extends Placeholder\Container\AbstractStandalone
'extras',
'itemprop',
'crossorigin',
'integrity'
'integrity',
'as'
Copy link
Member

Choose a reason for hiding this comment

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

Please add a comma after 'as'.

@thomasvargiu
Copy link

@froschdesign I need it too!

rfc5988 is not in draft stage anymore (candidate).

If browsers started implementing this feature, we should provide it too IMO.

@froschdesign
Copy link
Member

@gscscnd

I need it too!

You can always extend the view helper or write your own. This allows you to use the attribute now.

If browsers started implementing this feature…

Do you have a status overview which includes this new attribute? Thanks!

@thomasvargiu
Copy link

You’re right, I can always use my own view helper.

About browser compatibility you can see it here

@froschdesign
Copy link
Member

Next step is reached: "HTML 5.2 - W3C Recommendation, 14 December 2017"

@froschdesign froschdesign removed the WIP label Dec 14, 2017
@froschdesign froschdesign added this to the 2.10.0 milestone Dec 14, 2017
@froschdesign
Copy link
Member

froschdesign commented Jan 10, 2018

Final step is reached: "HTML 5.2 is done"

This feature will be added with the next minor release. When? I don't know. At the moment I work on some other tasks / issues. I will try to clarify this.

Thanks for your patience!

@MatthiasKuehneEllerhold
Copy link
Contributor

Any news on this? "as" is a critical part of the HTTP/2 Server Push via Apache http2 module.

weierophinney added a commit that referenced this pull request Jan 17, 2018
Allow to use ‘as’ attribute on HTML ‘link’ element
weierophinney added a commit that referenced this pull request Jan 17, 2018
weierophinney added a commit that referenced this pull request Jan 17, 2018
@weierophinney
Copy link
Member

Thanks, @gscscnd; merged to develop for release with 2.10.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants