views:

1577

answers:

13

I've been reading about HTML5 and would like to start using some of it, particularly datasets as I've found an interesting looking jQuery plugin that I can start using...

http://www.barklund.org/blog/2009/08/28/html-5-datasets/

Now, I understand that older browsers like IE6 may not like having extra attributes in there and may not know what to do with them but if they ignore them and the site still validates using an HTML5 validator then that should be OK, no?

I especially want to make sure I'm not going to get penalised by Google etc. for not having valid markup and that I'm not going to get complaints from clients that their site is "not valid" when they check it using a bog standard W3C validator.

What are people's thoughts on this?

+7  A: 

The answer is simple:

Not Yet! But soon.

Square Rig Master
+1  A: 

Valid HTML4, Valid XHTML and Valid HTML5 are all seperate things. Their validity is defined by an XML Schema definition at the top of the page. You can create your own "CupOfTML" schema definition if you really wanted to and it could be valid. Obviously not adviseable, as irregardless of validity, the browsers still need to be able to work out what to do. Which leads nicely to HTML5...

The browser implementation and take up in even the most modern browsers is not complete yet and while some elements are there and working fine, others are less than ideal. If you / your organisation can cope with the fact that some people (not just IE6) get a less than optimal viewing experience - then go for HTML5. Better still, offer a 'gracefully degraded' version of the site that runs in everything else if HTML5 fails. But be aware you are effectively limiting your audience (those with vision disabilities may have adaptive browsers that don't support it, and anyone who still uses Win2K is stuck with IE6...).

Amadiere
HTML 4.0 and 4.01 are SGML and can't be described with a schema. I'm not aware of an XHMTL schema. HTML5 can't be described with a schema - it also isn't XML (it isn't SGML either). The Doctype (in HTML 4.x and XHTML) links the document to a DTD, not a schema. In HTML5, the Doctype is a nonsense string designed to trigger the standards mode algorithm in browsers.
David Dorward
A: 

It really depends on your user base. You can use all of the structure elements by calling them to display as block.

header, section, footer,aside,article,nav ...{display:block;}

Get's tricky with IE because it doesn't allow you to use the elements unless they are in the DOM. So to get the website to even show up you have to inject the elements into the DOM. You are relying on javascript for the page to load so you thats why I said it depends on your user base.

document.createElement("header"); document.createElement("footer");
document.createElement("nav");
document.createElement("article");
document.createElement("section"); document.createElement("aside");

You can also do some user agent detection to see if someone is using IE and prompt them to download Google Chrome Framehttp://code.google.com/chrome/chromeframe/

Chad
It's bad practice to require javascript to correctly display a page.
Hannson
@Hannson +1 and I'd like to add that I hate it when websites tell me what browser I should be using. Sometimes, I browse with lynx or w3m to download something. I don't want to have to wade through crappy javascript and the website telling me what it thinks I should use just to download something straight to my server. Thanks though.
Elizabeth Buckwalter
@Elizabeth, I too don't like software trying to impose it's will on me, but in the case of IE users, 99% of the time telling them there is a better alternative is a good thing. - Users that think the IE logo *is* the internet, they need a good slap on the back of the head. Anything that gets that done is OK by me. *(For IE7 and lower, a prompt suggesting Chrome/Chrome Frame seems fitting.)*
Atli
@elizabeth, I think as long as the content is served to the user your job is done. If a user wants the full experience the will do themselves a favor and download a modern browser. http://forabeautifulweb.com/blog/about/universal_internet_explorer_6_css/
Chad
A: 

If you develop for commercial sites then XHTML 1.0 Strict is still the recommended DocType to use, and will remain so for at least 2-3 years to come.

JavaScript is not a viable solution to make HTML5 documents work on commercial sites because you have a legal obligation to accessibility (at least in the EU, US and Australia).

  • XHTML over plain HTML for better machine readable code and no tag soup
  • Remember prior to HTML5 error handling is not well-defined so it is very important your page validates to the DocType specified, regardless of which one you choose. It is better to choose a more relaxed DocType than break the validation of a stricter one
Joseph Earl
- Who recommends XHTML 1.0 Strict?- Which machines have a problem reading “plain HTML”?
Paul D. Waite
HTML if used properly is just as machine-readable.But tag soup makes it much less readable and XHTML Strict generally avoids it.Consider the kind of processing a search spider has to do get the title, description etc if a pages markup is badly malformed
Joseph Earl
@Joseph, legal obligation to accessibility?! If that were true half the sites on the net would get sued. As much as I'd *love* to have XHTML Strict be the standard DocType, XHTML Transitional is.
Elizabeth Buckwalter
People who are going to write valid markup will write valid markup. Those that won't, won't. The choice of markup language isn't going to change that. It is as easy to write invalid, tag soup, nonsense XHTML as it is HTML.
David Dorward
Agree with David: the only way that XHTML avoids “tag soup” (I assume you mean invalid HTML) is if you serve it as application/xml+xhtml. Then, conforming browsers will display an error message instead of your page if you have any validation errors. No-one does this, because IE doesn’t support XHTML served that way.
Paul D. Waite
@Elizabeth: legal obligation is correct — in the UK, the Disability Discrimination Act applies to websites, and in Australia the website for the Sydney Olympics got sued for not being accessible. Not many sites get sued, (suing is expensive), but the legal obligation is there. As other answers mentioned though, you can use lots of HTML5 without using the new elements that’ll trip up IE 6.
Paul D. Waite
Oh, and: “Consider the kind of processing a search spider has to do get the title, description etc if a pages markup is badly malformed”. Okay. http://tidy.sourceforge.net/ Considered.
Paul D. Waite
+3  A: 

There's no such thing as 'valid HTML 5'. The specification isn't built yet. There's no normative definition of what HTML 5 even is, it's a working draft.

Rushyo
Exactly. Many other things are not finalised standards yet. But we (web devs) have used them all the while.
namespaceform
...and the web is a wonderfully stable place for it.
Rushyo
+19  A: 

I'd recommend checking out Dive Into HTML 5 and deciding for yourself if you think the tradeoffs are acceptable. So far as I've heard, there are no negative SEO implications for using HTML 5. I just ran the w3c validator on Dive Into HTML 5 and it automatically detected that it was HTML 5 and validated it, so I don't that will be a concern, either.

Hank Gay
Google themselves use HTML5 for their front page. You shouldn't have any issues with SEO, at least with Google.
Kyle Trauberman
@Kyle: where? Do you mean the HTML5 doctype? That's *just* a doctype. It doesn't use any HTML5 elements.
BalusC
@BalusC Sure they do. They don't use any HTML5 *specific* elements, but HTML5 inherits a lot of the old HTML4 elements. The fact that the HTML5 doctype is used makes them HTML5 elements, not HTML4 elements.
Atli
@Atli: I know that and you know that I didn't mean that. Using a HTML5 doctype does **not** break the webpage in older browsers not supporting HTML5, including IE6. But using HTML5 elements would do that. Google doesn't use any.
BalusC
Alan
A: 

Google could randomly start deciding it doesn’t like your site because its HTML isn’t valid, but it’d be pretty bizarre. Google, like all the other search engines, wants to give people the best search results possible. I don’t see how ignoring sites because of HTML validation errors would help them do that.

HTML5 has generally been specified so as to degrade gracefully in older browsers. I’m not super-familiar with data attributes myself (main because they haven’t been covered in Dive into HTML5 yet, but I suspect IE 6 will be fine with them.

As for your clients complaining about invalidity, that’s pretty much a people-management issue. HTML5 is a standard, published by the W3C, and there’s a validator for it (http://html5.validator.nu/). If they’re still not happy with you using it, maybe explain the benefits they’ll get from letting you use it?

Paul D. Waite
A: 

What parts of HTML5 that are expected to make the final recommendation are fine to use and, in fact, I do. I just last week finished an ecommerce site built entirely in HTML5 using CSS3 properties, too. While you do have to be careful, it was relatively easy once I was comfortable with the new stuff. I'd give a link but the new stuff won't be online till next month.

It's not the first site we've done with HTML5 but the others are much simpler. Don't fear HTML5. Go ahead with it but, as I said, don't go out on a limb but use those elements that have settled in: nav, header, footer and all that.

Rob
+4  A: 

No it's not. It's not even possible to have valid HTML5 because the specification isn't ready yet.

You can however prepare your HTML4 for the change. The first step is to start using valid HTML4 strict and CSS.

There are some stable sections of the spec, like the <canvas> tag. The <video> tag is gaining ground and has already been implemented by WebKit and Gecko. More importantly, the <video> tag allows backwards compatibility to Flash for browsers that don't support it without using javascript.

The second step is to remove all requirements for proprietary (and free) plugins from your site, wherever it's possible, this includes Flash, Silverlight and JavaFx. In other words, always use the open standards when it's possible. Converting to HTML5 is a process and possible to do one step at a time. No need to rush things.

Hannson
“The second step is to remove all Flash from your site, where it's possible”. Right. I suppose that’s following the section of the HTML5 spec that says “don’t use Flash”.
Paul D. Waite
It doesn't say that exactly, but a part of the goal of HTML5 is to eliminate the need for proprietary browser RIA plugins like flash and silverlight. The keyword being _need_, in other words. If you don't need it, there's no reason to use it.
Hannson
I'd edit your answer, because my first reaction was exactly like Paul's. There are several areas where you don't *need* flash to have fancy graphics anymore (navigation comes to mind), but it's not evil and can enhance a site if used properly. In light of your comment, however, I agree that navigation, galleries, and others should be converted back to html from flash in preparation.
Elizabeth Buckwalter
Agree with Hanson there. When a huge, and often required, part of the web is controlled by a single corporation *(Adobe or Microsoft, in this case)*, there is something very wrong. - Just take the Flash player, for instance. There is STILL no proper flash plugin available for Linux users, and there is no way to fix it because the technology is proprietary. - Getting rid of Flash and Silverlight will make the web better all-around.
Atli
@Elizabeth - I agree absolutely. I've edited my answer to say better what I meant.
Hannson
+2  A: 

With HTML 5 you're gonna run into a lot of problems, particularly on older version of Internet Explorer. Recently John Resig did a short talk (last 10 minutes) about the problems you're going to encounter.

  1. Attemping to use an unkown element causes it to be unstyled and generally malformed (inner contents escape) - However, there's a fix for that explained here HTML5 Shiv

  2. Even though, unknown elements still can't hold other unknown elements.

  3. Injecting unknown elements using innerHTML causes all sorts of weirdness to occur. It'll probably break your DOM.

RamboNo5
+3  A: 

The most important thing is to test the parts of HTML5 you wish to use against the browsers you wish to support, and confirm there are no problems. You should especially check that your JS for accessing dataset data works in IE6 etc. You could also look at Microdata or RDFa to see if they offer a better fit for what you want to do. With the exception of new elements (which require a Javascript shiv to work in Internet Explorer) almost everything else is the same as HTML4/XHTML1, or should be ignored by unsupporting browsers.

Google doesn’t care what doctype you use, and adding data to datasets will be irrelevant to Google anyway (consider another method if you want to expose this data to search engines/users).

The W3 validator automatically detects the HTML5 doctype and uses the appropriate validator. Note that it can present a spurious error/warning regarding encoding—this is a known bug.

Regarding the answers, there’s a lot of FUD here:

  • using the HTML5 doctype != using new HTML5 elements
  • using HTML (rather than say XHTML) != poorly formed code
  • HTML5 != unsupported by IE6

Most of HTML5 is HTML4 with defined error handling. This means it’s perfectly ok to use most of HTML5 now, because you already are in HTML4/XHTML1. Of course parts of HTML5 are unsupported in IE6, but so are parts of HTML4. If you want to support IE6, don’t use those parts.

Boblet
A: 

html5doctor.com Has great information about HTML5, great developers that write for it too. People like Bruce Lawson (Opera Dev) Remy Sharp.

_henry
A: 

The HTML5 DOCTYPE is certainly safe to use, but new HTML5 elements can do weird things to the DOM.

Others have said that already.

http://diveintohtml5.org/semantics.html#unknown-elements shows how browsers deal with elements they don't recognise. It's complicated. Children of <article> will appear in the IE DOM as siblings instead. And styling can be tricky. Solutions are mentioned, with links to the HTML5 Shiv (javascript) and the HTML5 Reset Stylesheet (CSS).

TRiG