Skip to content

New HTML Style Guide #117

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

Closed
wants to merge 6 commits into from
Closed

New HTML Style Guide #117

wants to merge 6 commits into from

Conversation

handasolo
Copy link

No description provided.


## Spacing

In general, the jQuery style guide encourages liberal spacing for improved human readability. The minification process creates a file that is optimized for browsers to read and process.
Copy link
Member

Choose a reason for hiding this comment

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

This isn't relevant. We don't ship minified HTML.

@arthurvr
Copy link
Member

Common knowledge but worth emphasizing, the order of the charset declaration and the <title> is important.

- Always use the minimal, versionless doctype.
- Always define which language the page is written in.
- Always include `html`, `head`, and `body` tags.
- Always define the character encoding. The encoding should be defined as early as possible.
Copy link
Member

Choose a reason for hiding this comment

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

The encoding should be defined as early as possible.

IMHO it would be worth it to emphasise that it should be in the first 1024 bytes of the document.

@arthurvr
Copy link
Member

Thanks for the hard work on this, @Slayslot!

@handasolo
Copy link
Author

It's a pleasure @arthurvr :D and how can I remove the CLA:Error? I did sign it.

@handasolo
Copy link
Author

And a note on the second commit: Any bad examples that I didn't remove, I believe that either they are common problems that should be mentioned or that without those bad examples the section wouldn't be understood as well. For eg: The separation of concerns section wouldn't be understood as good as it is with the bad example.

@arthurvr
Copy link
Member

@Slayslot The CLA check fails because you don't have your full name in your git config (currently you only have your username). Please see contribute.jquery.org on how to update your git config.

@arthurvr
Copy link
Member

This PR is meant to fix #92.

@@ -4,74 +4,170 @@

Copy link
Member

Choose a reason for hiding this comment

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

While extending this page it might be better to add a TOC similar to the JavaScript style guide? (possible by adding "toc": true).

Would it be a good idea here too?

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, I didn't get that.

Copy link
Member

Choose a reason for hiding this comment

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

Add a Table of Contents, Basically add this to the top of your page:
<script>{ "title": "HTML Style Guide", "toc": true }</script>

You can see an example here

Copy link
Author

Choose a reason for hiding this comment

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

Done. Thank you!

@handasolo
Copy link
Author

@arthurvr Anything I can do to get this merged?

```
<!doctype html>
```
Use [grunt-html](https://www.npmjs.com/package/grunt-html) to detect errors and potential problems. Most jQuery projects have a Grunt task for linting all HTML files: `grunt htmllint`.
Copy link
Member

Choose a reason for hiding this comment

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

I don't think Chassis has this (although I could be missing it). Might be useful to add that validation, especially with the documentation/style guides in Chassis.

@handasolo handasolo force-pushed the master branch 2 times, most recently from 6d9f0a1 to e0cc9c5 Compare October 17, 2015 17:31
@handasolo
Copy link
Author

Sorry about the CLA: Error reoccurring. I forgot that the last time I pushed on the repository I was using Windows. When I pushed the commit from linux it used my default username. Anyhow, please let me know if there are any further changes required.

@handasolo
Copy link
Author

Still willing to get this merged. Please let me know if there are any changes required here. @arthurvr @sfrisk @scottgonzalez . Thanks.


## Indentation
## HTML Semantics:
Copy link
Member

Choose a reason for hiding this comment

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

Remove the colon.

@handasolo
Copy link
Author

Updated. Sorry for the bad commit name, couldn't think of anything better :|

@handasolo
Copy link
Author

@scottgonzalez Would love it if you can review this. Apologies that this one PR has taken so long.


```html
<!-- Bad Example -->
<label>First<input type="radio" name="input" value="first"></label>
Copy link
Member

Choose a reason for hiding this comment

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

Move the label text after the input so the two examples are consistent.

@scottgonzalez
Copy link
Member

Just one minor issue remaining.

@scottgonzalez
Copy link
Member

I can fix that issue when I merge this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants