OscarGodson / HTML6

A spec to HTML6
http://html6spec.com
169 stars 25 forks source link

Self-closing tags #8

Closed cshaa closed 11 years ago

cshaa commented 11 years ago

I think HTML6 should use more of XML's self-closing tags - eg. <script src="s.js" /> would be great. Of course this is not the best example because it's a file import - can be done using <html:include /> or something like that. But I think you understand me. Older HTML versions had single tags and double tags but there was no way to recognize them.

OscarGodson commented 11 years ago

I think making it optional to use either would be cool. If you send a PR with an explanation and sample or something I'll merge it in :)

cshaa commented 11 years ago

Do you think that CSS can be used to explain document restrictions? We need something like DTD but no one knows it nowadays so I think we shouldn't use it. Example of my idea - CDS, the cascading description sheet:

@namespace {
 html {
  childs: namespaced element("head", "body");
  /* html:html can contain html:head and html:body */
 }
 head {
  childs: both element("meta", "title");
  display: none;
 }
 body {
  childs: both element("anchor", "link", "media");
 }

 anchor, link {
  text-decoration: underline;
  cursor: pointer;
  color: #00f;
 }
}
OscarGodson commented 11 years ago

I don't mean a literal spec, I just mean put it in the README.md file and run the build.sh script. :)

cshaa commented 11 years ago

Yeah, I know, maybe I should start a new thread for this but we need a way how to define single elements. So what do you think about CDS?

OscarGodson commented 11 years ago

That could be it's own syntax, and I do like it, but there's no way to parse it unless you wrote a parser too. It'd make more sense, until there's a parser, to use something like JSON:

{
  "head": {
    "children": [
      "meta",
      "title"
    ]
    "styles": {
      "display": "none"
    }
  }
}
cshaa commented 11 years ago

Yep, that's true. I just didn't want to create a new language - nobody wants to learn a new one. But for your purposes, the JSON version would be better. I will start making the syntax.

exabrial commented 9 years ago

From #34:

A tag like

<html:link src="js/main.js" title="Main Script" type="text/javascript"> Does not communicate developer intent. Is the next tag a child of <html:link> or a peer?

Simply closing the tag with one additional, JUST ONE, just one extra, keystroke simplifies parsing of the document and sends an extremely clear message. Simplifying the document structure should also lead to improved render times, as browsing engines don't have to look ahead and make all sorts of guesses.

<html:link src="js/main.js" title="Main Script" type="text/javascript" />

cshaa commented 9 years ago

Personally, I'm comfortable with deprecating single tags. But for the browser vendors it's quite easy to keep a list of single tags and parse them correctly.

exabrial commented 9 years ago

The advantage to Single tags is they reduce unnecessary wordiness that came with <xml></xml>. A single slash is a nice compromise IMHO.