Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove opening tags if configured #56

Closed
jplitza opened this issue Nov 4, 2015 · 2 comments · Fixed by #62
Closed

Remove opening tags if configured #56

jplitza opened this issue Nov 4, 2015 · 2 comments · Fixed by #62
Milestone

Comments

@jplitza
Copy link

jplitza commented Nov 4, 2015

Some elements don't require opening tags if they don't have attributes (and their first child determines them uniquely in the context). Thus, I'd like to see an option "openings" that works just like the "endings" option.

In particular, <html>, <head> and <body> mostly are unnecessary if they have no attributes. (Yes, this is in the standard if you also do whitespace removal).

There are some other elements concerning tables where removing the opening element is allow (<colgroup>. <tbody>) that are more tricky to get them right (not preceeded by blargh), so they should not be included in the "all" option, which should mean [html, head, body].

@doktorbro
Copy link
Collaborator

Thank you for the great suggestion. It’s easy to implement. I could do it in the November.

I’m not sure about the all shortcut. Even the head and body elements are tricky as shown in the second example of specs:

Note that in the example above, the head element start and end tags, and the body element start tag, can't be omitted, because they are surrounded by white space.

The average compress layout user doesn’t remove all white space. By just setting openings: all she would shoot herself in the foot.

Could you now live without the all shortcut?

After a while I could analyze how people use the new option and add the all shortcut as you proposed.

@jplitza
Copy link
Author

jplitza commented Nov 5, 2015

Of course I could live without the all shortcut. I would have expected that most users use the whitespace removal.
And actually the standard says that you cannot omit the <body> if the content of <body> starts with whitespace, because the whitespace would be considered part of the <head> then. You usually don't insist on the whitespace belonging to the <body> (that would only matter if you set body {white-space: pre; } via CSS). So even without the whitespaces removal, it would be sane to remove the opening tag. Even the validator doesn't complain if it is fed with

<!DOCTYPE html>
<title>Test</title>

  <p>foo</p>

But, as stated above, if you think there should be no "all" option, that's fine with me too.

@doktorbro doktorbro added this to the v2.1 milestone Nov 8, 2015
doktorbro pushed a commit that referenced this issue Dec 5, 2015
Introduce the `startings` option. Close #56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants