Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Link tag helper should include original element's attributes in fallbacks #4084

Closed
dougbu opened this issue Feb 12, 2016 · 4 comments
Closed
Assignees

Comments

@dougbu
Copy link
Member

dougbu commented Feb 12, 2016

E.g. .cshtml contains:

    <link rel="stylesheet" data-extra="test"
          asp-fallback-href="~/styles/site.css"
          asp-fallback-test-class="hidden"
          asp-fallback-test-property="visibility"
          asp-fallback-test-value="hidden">

Generated HTML with a few extra newlines:

    <link rel="stylesheet" data-extra="test">
<meta name="x-stylesheet-fallback-test" content="" class="hidden" />
<script>
!function(a,b,c){
var d,e=document,
  f=e.getElementsByTagName("SCRIPT"),
  g=f[f.length-1].previousElementSibling,
  h=e.defaultView&&e.defaultView.getComputedStyle?e.defaultView.getComputedStyle(g):g.currentStyle;
if(h&&h[a]!==b)
  for(d=0;d<c.length;d++)
    e.write('<link rel="stylesheet" href="'+c[d]+'"/>')
}("visibility","hidden",["\/styles\/site.css"]);
</script>

Note the data-extra is not included in the <link> element in the JavaScript, ready to be written into the document. Should it?

@dougbu
Copy link
Member Author

dougbu commented Feb 12, 2016

/cc @DamianEdwards ??

@DamianEdwards
Copy link
Member

Given cases like http://codepen.io/tigt/post/async-css-without-javascript where you'd want extra attributes to get different behavior, then yes, it should probably preserve the extra attributes. I actually thought I remembered writing the code to do that... Does it work in the script TH?

@dougbu
Copy link
Member Author

dougbu commented Feb 12, 2016

Does it work in the script TH?

For some definition of "work" i.e. modulo #4083, yes.

@Eilon Eilon added this to the 1.0.0-rc2 milestone Feb 12, 2016
@Eilon Eilon modified the milestones: 1.0.0, 1.0.0-rc2 Mar 18, 2016
@Eilon Eilon modified the milestones: 1.0.1, 1.0.0 May 17, 2016
@NTaylorMullen NTaylorMullen changed the title Question: Should <link> tag helper include original element's attributes in fallbacks? Link tag helper should include original element's attributes in fallbacks Jul 21, 2016
NTaylorMullen added a commit that referenced this issue Jul 23, 2016
- Updated functional tests and link tag script to include modified extra attributes content.

#4084
NTaylorMullen added a commit that referenced this issue Jul 29, 2016
- Updated functional tests and link tag script to include modified extra attributes content.

#4084
@NTaylorMullen
Copy link
Member

d60ed06

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

No branches or pull requests

4 participants