taptapship / wiredep

Wire Bower dependencies to your source code.
MIT License
1.15k stars 142 forks source link

Remove self-closing tags for void elements #199

Closed akullpp closed 9 years ago

akullpp commented 9 years ago

It isn't idiomatic for HTML5 to allow self-closing tags for void elements such as link (source). It isn't an error, only a convention enabled by browsers.

stephenplusplus commented 9 years ago

Thanks for pointing this out. PR welcome :)

CWSpear commented 9 years ago

What is it that you're asking for exactly? What do you mean when you say "self-closing tags?" Most people consider link to be a self-closing tag (what I believe you're calling a void element), but I don't think you're asking us to remove all the link tags, are you?

stephenplusplus commented 9 years ago

The issue is just the format we're using for injected links:

<link rel="stylesheet" href="{{filePath}}" />

Where what we want is:

<link rel="stylesheet" href="{{filePath}}">
CWSpear commented 9 years ago

That's a pretty subjective thing. I personally like it the with the /> at the end as I find it easier for my eyes to quickly parse, etc.

At worst it should be an option. Currently, you can get around it with:

// ...
    html: {
      replace: {
        css: '<link rel="stylesheet" href="{{filePath}}">'
      }
    },
// ...
CWSpear commented 9 years ago

Specifically, there's nothing wrong with it in HTML5

Then, if the element is one of the void elements, or if the element is a foreign element, then there may be a single U+002F SOLIDUS character (/). This character has no effect on void elements, but on foreign elements it marks the start tag as self-closing. -- http://dev.w3.org/html5/spec-author-view/syntax.html#syntax-start-tag

But removing the / at the end should not be the default. While having the / is not invalid HTML5, it is invalid XHTML, which is still in decent use.

akullpp commented 9 years ago

Thanks for the clarification, so the common denominator is to insert the character since there is no effect for HTML5 and XHTML is still in use. Also, the workaround sounds sufficient for most use cases.