-
Notifications
You must be signed in to change notification settings - Fork 74
Rework HTML Style Guide #92
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
Comments
Please provide specific things that you think are missing. Broad issues with no details can't be acted on. |
Will do. Created this more to tie in with discussions over on css-framework. If it follows procedure better, I can close this task out, and open a new one when a more in depth discussion of what needs to get added has taken place. |
Suggested items to add/address in the current html style guide.
|
I'm not sure what that means. Can you give an example?
It should be valid. I guess we can explicitly state that.
We shouldn't allow
Should be avoided, but acceptable in some situations.
No rules.
Everything should be accessible. This will be nearly impossible to document other than just saying that it should be accessible.
At least for images, a missing alt attribute is invalid.
You're probably reading them wrong. You do not indent inside
Generally, yes. |
@scottgonzalez while yes there are very simple answers to these things none of this is actually in the style guide and probably should be.
I think this is probably 3 different things, whitespace, nesting, and linebreaks |
Also since UI uses HTML lint and we are adding this to mobile I'd like to see lint settings. |
As @arschmitz said, I made the list more as a suggestion of things to add to html style guide. While some of them might be common sense (such as valid html), we still aren't covering the above items at all/ at in the level of depth we do in other style guides. If we're going to be working on more potentially html heavy projects (such as css framework), expanding the html style guide to include the above items could potentially help with PRs. With the |
My responses were just meant as my answers to what should be documented for each section, not that they don't belong in the style guide. For the |
In the example there should be some nested elements to make this clear, not just a single paragraph in the body, this is not a clear example in my opinion. Also the wording Indentation |
Ahh, okay. Was just clarifying, since I wasn't quite sure. |
@scottgonzalez Bah you beat me timing... |
However, since we have a list of action items to work off of for the html style guide, I can start working on it. |
Accessibility
I would definitely include references to proper accessible markup and how to properly write an Maybe something about I would potentially add a bit about adding Forms
|
http://validator.w3.org/ can be used for html validation ? |
@Slayslot this is about style not validity |
@arschmitz Yes, but @sfrisk had it in her suggested items list, so if we're going to explicitly ask the users to write valid html why not recommend them to check it from here as well? Google does the same thing in their HTML style guide. https://google-styleguide.googlecode.com/svn/trunk/htmlcssguide.xml#HTML_Validity |
Just a note about validators: While validator.w3.org is certainly useful, we do use validator.nu for our automated testing via grunt-html. |
It might be useful to list our preference for validator.nu in the html style guide, but in general the HTML style guide should focus more on style since we're looking to expand the HTML style guide to be similar to the CSS/JS ones. |
So we can just mention that we use validator.nu for automated testing via grunt-html and further recommend them to use it before posting html. |
Before posting what HTML? If it's a project that's using grunt-html, it will automatically be checked. Having to manually check validation is extremely tedious and time consuming. |
I've been reading Code Guide and Google's HTML style guide and have come up with the following things that should be included in the style guide:
The Attribute order being:
Edit 1:
and this last one is something I liked but I don't know how useful it is. Adding TODOs in comments just as mentioned in Google's HTML style guide. We can append a contact in parenthesis and action items after a colon. |
We need evidence this is a good idea. This has historically been bad for accessibility.
You mean
Only needed if you're using multiple submit elements on the same form.
Is there an explanation of why this order is chosen? |
Point taken.
I, quite frankly didn't know that. On a bit research I found this . So at least radio buttons and checkboxes take advantage from this method.
Would it hurt if a type attribute is included for text field? I'm honestly asking here? Because if it won't hurt then it only makes it easier for everyone to write and understand. Similarly I couldn't understand the Indentation section from the existing HTML style guide.
Well, let me just quote Codeguide |
That answer says nothing about accessibility, but note that the comments on the answer say to use the
It doesn't hurt, it's just not necessary. It's the same as explicitly passing the same values as default options in your JavaScript.
Because it doesn't actually improve readability and instead just pushes everything further out.
I'll go on record as saying that I would absolutely hate for any of our style guides to require 2 spaces. I honestly don't understand how the world hasn't settled on tabs by now. |
As you noted though, it's necessary if you want to style text inputs since |
I was focusing more on the increased hit zone but I do get your point. What, in your opinion, would be the best way for this?
okay, but this extra effort will make it easier to style them in CSS.
Frankly speaking, I too use tabs. And, now that you've pointed out your hate for 2 spaces I realize that I hated it too. For the fact that the deeper the element, that you're working on, is nested the tedious it gets to add spaces. Adding 2*n spaces after every line will obviously be tedious than adding n tabs. I would really like to see others view on this and the second list I've added in my comments edit. As both of these have their pros and cons. |
Keep them separate and use the
I would prefer if we didn't require |
Alright, we can keep that.
HTML validation wouldn't check for that? |
I'm not aware of any validator that checks for an optional attribute to be required. |
Hmm, didn't think so. This will be problematic then. |
Just to move things further and for everyone's ease I've made these lists consisting everything that has been discussed here so far. Changes that nobody has any objection against:
Changes that have had no discussion:
Changes with conflict:
|
I'm not really convinced an order is necessary. There are a few attributes (
I'm not really sure how this is tied to an HTML style guide.
I'm not sure what the intention is.
How is this different from separation of concerns?
That's a highly dependent question, isn't it?
Why?
If it's a TODO, yes. I don't see why this would be included in a style guide.
I would expect that jQuery projects won't follow the style guide if the rule isn't tabs. |
Phrased another way: Every project that this is intended to apply to already has a rule to use tabs. |
Alright, if not an extensive order at least we can tell people to keep the few attributes that you stated(and maybe add
include it in the JS guide then?
Makes sense.
That's my bad.
Dependent on whether the asset is available for both protocols?
To make it clear as to what the alternate stylesheet is there for. I am not sure if this is entirely necessary or if it will help in any way, hence, it was placed in the dilemma list.
To define a proper way to write TODOs. Taking the example from Google's style guide
Fair enough, tabs it is. But we'll have to make the wordings in the existing style guide clearer and with a better example. |
I'm not sure it belongs there either. This is a project by project decision. It's highly dependent on what you're trying to accomplish.
We don't have a single project that currently writes TODOs in that format. I think this is overkill. Most TODOs belong in issues anyway. |
Sure, but markup written in JS makes the markup just hard to find and edit if need be. So, if it can be avoided, then why not?
Just thought it was a decent idea. You are correct though, Most TODOs do belong in issues. |
@slayslot Because if this is to be used by projects like jQuery Mobile and UI, this makes no sense, they are projects that create JS based widgets and so intentionally generate markup. This is something that needs to be evaluated on a case by case basis, and so makes no sense in a style guide. |
That does make sense. Don't I feel stupid now. I'll update the list. |
Before updating the list, I wanted to confirm the status of these two:
|
The current html style guide is very limited (http://contribute.jquery.org/style-guide/html/). Rework html style guide to be more robust to handle future development for html heavy projects.
The text was updated successfully, but these errors were encountered: