Added: 2 years ago
From: GoogleWebmasterHelp
Views: 12,631
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:
see all

All Comments (39)

Sign In or Sign Up now to post a comment!
  • The Webmasters completely left out, that the browser has to compute a SGML tag-soup using HTML, whereas XHTML is interpreted using a XML-Parser, which is guaranteed to be faster.

    Leaving out tags may reduce the file-size, but it does not contribute to the overall processing speed of the browser, which has to guess where the omitted tags should be.

  • Is this advice correct? Surely it is from Google right - mmmm :0. When using STRICT XHTML the pages are parsed faster because of the precise, exact nature implicit in the document definition. Would love to hear peoples comments and understanding of this.

  • Or you can compress the files instead. Like markup is what the problem with website size is... pft.

  • I respect Jens Meiert's skills, but I love the strictness and clarity that XML brings to XHTML, and I wouldn't stop using closing tags. It would in the end make debugging and revisions harder to make... and lessen code beauty. I think people can make pages much faster by just using tabs instead of spaces. Countless times I've seen pages using four spaces just because that's dreamweaver's default. Regex those spaces out for tabs.

  • haha that guy looks like imhotep from the mummy

  • I've heard that when you leave out some tags, then the browser has to figure out them and that also takes time...

  • This micro-optimisation is dangerous. Consider this code:

    [!DOCTYPE html]

    [title]IE breaks DOM[/title]

    [div] [form action=""] [p][input]Test [/form]

    [/div]

    That is a valid HTML document (change the brackets). Now load up IE8 and open the DOM inspector. There are two [body] elements, one of them inside the [head]!

    This is an IE bug. It happens with HTML 4.01 too.

    Google has an army of coders checking for these things, so they're safe enough. But what about you?

  • Considering the page that explains the omit-ending-tag technique doesn't even *use* it, I'm skeptical.

    I don't like quirks mode.

  • @pontiuspete This does not have anything to do with quirks mode. HTML allows you to leave out certain tags while writing totally valid documents. This is of course just the first step in making your pages load faster.

  • in html (NOT XHTML) you can avoid the ending tags for lots of things, and in reality if it improves performance, why not?

  • Dude, that's horrible!

    I've always been a stickler for code that validates. What this video suggests is terrible!

  • What are you talking about? It validates just fine. You've just been taught XHTML and clear don't know HTML.

  • @DragonMasterMarf A HTML page without optional tags does actually validate. Just have a look into the specs before talking nonsense, thanks.

  • Google, teaching newbs everywhere to write messy code...

  • This really explains the "invalidity" of Google's source codes, but I'm still skeptical.

    Skipping end tags, not using so called "optional" tags, really? I find it hard to believe that you can't achieve just as fast or even faster results with XHTML. Especially, in using optimization techniques such as sprites.

  • When they say you don't need to close certain tags they are talking about HTML 4 and not XHTML where it's required for the document to validate. I think their point is that if you have a high traffic website (eg Google) this will save on bandwidth, etc.

  • Google, are you serious?! Cutting out tags? First off, most tags are 3-6 characters long. How many bytes are you really saving? The browser is going to have to render those tags anyways and if they are missing it will take longer than if you had them in there... c'mon Google, please tell me this was a late, late April fools joke.

  • Considering that google probably have more hits per second than your average site per year: skipping a few bytes probably saves them ALOT of bandwidth...

  • i did now...

  • i did not understand shit

  • Comment removed

  • wrong.

  • I trust the guy in the suit. He seems to know what's good for the web.

    Would be nice to watch a video response by people supporting even more optional tags in the formal language - just to feel safe that the document is really parseable and unambiguous.

  • Yuck...if you take out those elements, your browser will switch over to "tag soup" and render the page however. Good luck getting cross-browser consistency!

    Code for the standards, people. FAR fewer headaches.

  • I know, right? 4 tags. Seriously guys - WTF?

  • Somewhere, a web developer is having a 'conversation' with a manager - pleading not to remove ending tag elements. But the manager does not hear his pleas, for the all-wise Google says it will speed up the website.

  • Really, I'm surprised at Google. Their other tips have been great!

  • @shanedk Unless you are using XHTML with an XML mime type which will prevent IE from rendering your page, your code is actually always being parsed as tag soup, no matter if you omit optional tags or not. These optional tags *are* actually part of the HTML specifications, and this has *nothing* to do with cross-browser consistenty.

  • @e5eb14rde Um, yes, it does. If you define your DTD properly, you can force the browser into "standards" mode, meaning that it works the way the standards say it should, and you have an excellent degree of control and predictability across browsers. Once it goes to "tag soup," you have no idea WHAT the different browsers are going to do with it.

  • @shanedk Once again: Optional tags are defined very precisely in the HTML specifications, see e.g. j.mp[slash]bwLrKd, so a document w/o optional tags does of course validate. Quirks mode vs. standards mode has *nothing* to do with tag soup parsing. (If you don't believe me, just read the Wikipedia article on Quirks mode.)

  • @e5eb14rde Okay: "In Web development, tag soup refers to formatted markup written for a web page which is very much like HTML, but **does not consist of correct HTML syntax and document structure.**"

    So, I WAS right. And if you'll actually read the entry, it goes on to say what kind of things constitute tag soup, and they're EXACTLY the kind of thing advised by Google in this video.

  • @e5eb14rde In fact, the article mentions this very issue:

    "Browsers, when faced with malformed markup, must guess the intended meaning of the author. They must infer closing tags where they expect them and then infer opening tags to match other closing-tags. The interpretation can vary markedly from one browser to the next."

  • @shanedk But an HTML document e.g. w/o an [html] tag is *not* (necessarily) syntactically incorrect. It seems to me that you don't understand the difference between HTML and X(HT)ML syntax.

    "Malformed markup" means e.g. [i]asdf [b]asdf[/i] asdf[/b]. Since the HTML specs precisely specify that some tags can be omitted, there is, in this case, no room for ambiguity in creating the DOM.

    And even if you write all optional tags, your page will still be rendered as tag soup.

  • @shanedk Btw, on your Web site you use the XHTML syntax but send the page with MIME text/html which tells the browser to render it as HTML. You should be grateful that common UAs render *every* text/html page as tag soup since otherwise there would be slahes all over your page; see hixie[dot]ch/advocacy/xhtml for further information. If you really want syntactically strict XML rendering, use the application/xhtml+xml MIME type. You will of course lock out all IE < 9 users.

  • :) nice one .

  • Also did you know that if you just have a blank html document it makes your page load faster too?! :O AMAZING! Let's just take everything out of our pages!

  • @DanielDavidAllen The point is not that you should take the content out of your pages, but that you should omit optional and useless stuff to actually make your content load faster. It is the milliseconds that count.

Loading...
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more