News for hackers. Stuff that matters.
Re:How a new HTML element will make the Web faster by possibilistic on Tuesday September 02, 2014 @01:53AM (#8256008)
This all seems horrific. Why can't HTML be properly extended to support attribute arrays or dictionaries as values? Having a value encode a DSL is so messed up. This is yet more to parse...

HTML keeps getting pulled in so many directions. I wish XHTML had won. It was modular, pluggable, extensible, and semantic. The last bit might have eventually made entering the search space easy for new competitors, too.

Re:How a new HTML element will make the Web faster by pjmlp on Tuesday September 02, 2014 @04:37AM (#8256384)
Fully agree. XHTML was a sane way to have a proper application development model, instead of this document as applications hack.

But the browser vendors failed to make a stand against bad HTML.

Re:How a new HTML element will make the Web faster by disjointrevelry on Tuesday September 02, 2014 @09:58AM (#8257552)
'bad HTML' could easily have just been an ego clash and pissing contest between developers of competing browsers. It was arguably more difficult to implement than just well-structured syntax.
Re:How a new HTML element will make the Web faster by iopq on Tuesday September 02, 2014 @05:52AM (#8256664)
this is why attributes are really a stupid ass way to do things

  <img>
    <srcset>
      <source><width>1024</width><src>large-image.jpg</source>
      <source><width>512</width><src>small-image.jpg</source>
    </srcset>
    <src>image.jpg</src> <*>fallback</*>
    <alt>My image</alt>
  </img>
Re:How a new HTML element will make the Web faster by aubergene on Tuesday September 02, 2014 @11:19AM (#8258043)
That isn't well formed, you're missing two </src>.

I dislike XML, the confusion between attributes and sub elements is one of the worst bits.

Re:How a new HTML element will make the Web faster by ianburrell on Tuesday September 02, 2014 @01:19PM (#8258848)
"1024 large-image.jpg 512 small-image.jpg image.jpg fallback My Image"

That is what your code would look like to browsers that didn't know about the new elements. HTML is defined such that browsers can ignore unknown elements for compatibility and still display the text. Using contents for the metadata means that browsers need to know about the elements to at least hide the text.

Re:How a new HTML element will make the Web faster by Pxtl on Tuesday September 02, 2014 @10:17AM (#8257679)
Holy crap that's verbose.

This is why *ML is a stupid-ass way to do things. "the problem it solves is not hard, and it does not solve the problem well."

Re:How a new HTML element will make the Web faster by mercurial on Tuesday September 02, 2014 @07:49AM (#8257008)
"Attributes are stupid" is also Maven's approach, but this results in unnecessarily verbose XML files.
Re:How a new HTML element will make the Web faster by est on Tuesday September 02, 2014 @09:27AM (#8257367)
<imgset w1024="large.jpg" w640="medium.jpg" />
Re:How a new HTML element will make the Web faster by palakchokshi on Tuesday September 02, 2014 @01:01PM (#8258751)
not practical since you'd have to define attributes for every conceivable size in the spec and that's just asking for trouble. e.g. w2048, h1024, w320, w240,h320, wPleaseShootMe :)
Re:How a new HTML element will make the Web faster by hrktb on Tuesday September 02, 2014 @06:29AM (#8256794)
But now it's a PITA properly handle and escape for any toolset that don't have good xml support. Imagine people starting to put <![CDATA[ ]] blocks into this.
Re:How a new HTML element will make the Web faster by iopq on Tuesday September 02, 2014 @07:01AM (#8256876)
I meant if I had designed it from the start. Then everything is a tag, no attributes, no quotes, equal signs, etc.
Re:How a new HTML element will make the Web faster by johnlbevan2 on Tuesday September 02, 2014 @08:21AM (#8257107)
How about JsonML; i.e. XHTML but in JSON format to make it less verbose / further improve integration with javascript?
Re:How a new HTML element will make the Web faster by mckamey on Wednesday September 03, 2014 @01:20PM (#8264127)
JsonML is pretty efficient when auto-generated from HTML source. I use it as an intermediate form for client side templates ( http://duelengine.org ) but I don't write it by hand. Its regularity makes it a perfect candidate for output from a parser/compiler.
Re:How a new HTML element will make the Web faster by yoklov on Tuesday September 02, 2014 @05:20PM (#8260229)
You'd want to kill yourself pretty quickly.

JSON is great as an interchange format, but there are many reasons editing it by hand is painful, lack of comments and lack of newlines in strings not being the least of them.

Re:How a new HTML element will make the Web faster by aubergene on Tuesday September 02, 2014 @11:21AM (#8258056)
There's no syntactic difference between an attribute, an object and an array.
Re:How a new HTML element will make the Web faster by iopq on Monday September 08, 2014 @07:53AM (#8284274)
you can't nest tags into attributes
Re:How a new HTML element will make the Web faster by tobyhinloopen on Tuesday September 02, 2014 @06:00AM (#8256695)
I really dislike your approach.
Re:How a new HTML element will make the Web faster by idlewords on Tuesday September 02, 2014 @02:52AM (#8256122)
XML Parsing Failed
Re:How a new HTML element will make the Web faster by insertnickname on Tuesday September 02, 2014 @03:24AM (#8256177)
I really hate when my code doesn't compile. If my code is wrong, the compiler should just figure out what to do.
Re:How a new HTML element will make the Web faster by possibilistic on Tuesday September 02, 2014 @03:39AM (#8256218)
You hit the nail on the head.

HTML5 got one thing right though: standardization of the DOM failure behavior. As an implementation detail of their design, they went with "sensible recovery" for failures over stricter failure modes.

In going with the WHATWG over the W3C, we ultimately chose "easy to author, (slow to evolve) living standard" over "strictly typed yet developer extensible". I was disappointed, but it's good for some parties I suppose. (It certainly keeps the browser vendors in charge of the core tech...)

The W3C over-engineered to a fault. They had a lot of the right ideas, but were too enamored by XML and RDF.

Re:How a new HTML element will make the Web faster by domenicd on Tuesday September 02, 2014 @06:04AM (#8256716)
It wasn't really a choice in favor of "easier to author." It was a choice in favor of "will this actually get implemented, or just be fancy theorycraft?"

No browser vendor was going to ship new features only in XML parsing mode, because that was author-hostile enough that it would lose them authors, and thus users. (Browser game theory.) The choice of HTML over XML syntax was purely practical, in this sense.

Re:How a new HTML element will make the Web faster by yuhong on Tuesday September 02, 2014 @04:32AM (#8256362)
HTML5 got one thing right though: standardization of the DOM failure behavior. As an implementation detail of their design, they went with "sensible recovery" for failures over stricter failure modes.

It was browsers that did that in the first place. HTML5 just standardized the exact behavior on failures.

Re:How a new HTML element will make the Web faster by domenicd on Tuesday September 02, 2014 @12:26PM (#8258533)
Incorrect. HTML5 synthesized the exact behavior that was closest to the majority of browsers. But not all browsers agreed (e.g. Mozilla would change its HTML parsing behavior depending on network packet boundaries), so there was still effort aligning with the newly-specced common parsing algorithm. At the time there was much skepticism that such alignment was even possible.
Re:How a new HTML element will make the Web faster by TheLoneWolfling on Tuesday September 02, 2014 @02:05PM (#8259130)
> Mozilla would change its HTML parsing behavior depending on network packet boundaries

I want to know more...

Re:How a new HTML element will make the Web faster by possibilistic on Tuesday September 02, 2014 @04:49AM (#8256414)
Which is what I said, right?

HTML 4 - vendors implemented the spec incongruently and failed in their own special ways. XHTML strict - standard parsing rules with strict failure mode. HTML 5 - standard parsing rules, suggested (but not required) rendering behavior for browser uniformity, and well-defined failure behavior.

Re:How a new HTML element will make the Web faster by lutusp on Tuesday September 02, 2014 @04:08AM (#8256298)
> I really hate when my code doesn't compile. If my code is wrong, the compiler should just figure out what to do.

There's something you're overlooking in the above. If a compiler was smart enough to know what to do with your erroneous code and compile in spite of the errors, that would be the end of programming and programmers.

Re:How a new HTML element will make the Web faster by wtetzner on Tuesday September 02, 2014 @10:03AM (#8257591)
I'm pretty sure that comment was sarcasm. It's a complaint about how HTML5 isn't just specified to fail on bad input, but instead gives rules on how to recover.
Re:How a new HTML element will make the Web faster by eru on Tuesday September 02, 2014 @07:09PM (#8260696)
And that would be a good thing!
Re:How a new HTML element will make the Web faster by lutusp on Tuesday September 02, 2014 @07:39PM (#8260793)
Well .... now that you mention it ... yes, it would. :)
Re:How a new HTML element will make the Web faster by johnlbevan2 on Tuesday September 02, 2014 @08:23AM (#8257114)
Sarcasm? I can't tell anymore :/

I love it when my code doesn't compile (i.e. if I've made a mistake). Much worse if when something tries to be "intelligent" and makes my code do something I never asked for - then I spend hours trying to figure out what the issue is (assuming I've noticed) rather than seeing that I made a mistake and fixing it.

Re:How a new HTML element will make the Web faster by insertnickname on Tuesday September 02, 2014 @11:49AM (#8258242)
Yes, I was being sarcastic. Web designers should stop whining and write proper markup code.
Re:How a new HTML element will make the Web faster by tolmasky on Tuesday September 02, 2014 @02:43PM (#8259357)
The problem has nothing to do with web devs but rather that no one wants to use a browser that spits out "error 5" on malformed HTML, which is necessarily what you're implying. The other option is to do your best with the bad HTML, and now we're right back where we started, regardless of how "strict" you make the rules.
Re:How a new HTML element will make the Web faster by yuhong on Tuesday September 02, 2014 @02:27AM (#8256077)
Here, don't confuse what was XHTML1 with XHTML2.
Re:How a new HTML element will make the Web faster by possibilistic on Tuesday September 02, 2014 @02:59AM (#8256135)
I'm speaking more in terms of the goals the markup dialects had, irrespective of the ultimate implementation. I think we can all agree that those suffered from misguided engineering choices (bloaty XML culture).

Responsive images could have been an XHTML module with a javascript implementation. The browser vendors could catch up and provide native implementations in their own time, but that would not postpone immediate usage.

If it were done right, anyone could have defined a markup module/schema with parsing rules and scripting. The evolution of those extensions would have been pretty damned fast due to forking, quick vetting/optimization, etc. It would have been well timed with the recent javascript renaissance, if it had happened. It might have meant browser vendor independence at the level of the developer.

HTML should really have been modular with an efficient, lightweight core spec. It should have also paid lots of attention to being semantic so that others could compete with Google on search. I am still curious if that's why Google got involved in the WHATWG. I'm rambling about things I don't know about though...

Re:How a new HTML element will make the Web faster by domenicd on Tuesday September 02, 2014 @06:07AM (#8256725)
> Responsive images could have been an XHTML module with a javascript implementation. The browser vendors could catch up and provide native implementations in their own time, but that would not postpone immediate usage.

This is exactly what happened, except without the XHTML nonsense. JavaScript polyfills of the picture element were created and in use before native implementations eventually caught up. (And native implementations are very necessary, in this case, because they need to hook in to the preload scanner, which is not JS-exposed.)

More generally, custom elements and extensible web principles in general enable all of this. Again, without XML being involved.