'DRM in HTML5 is a victory for the open Web' →
In other words, the alternative to using DRM in browser plugins on the Web is not “abandoning DRM;” it’s “abandoning the Web.”
In other words, the alternative to using DRM in browser plugins on the Web is not “abandoning DRM;” it’s “abandoning the Web.”
Sencha came along and showed Facebook the right way to use HTML5.
Super awesome book explaining how the Internet and web browsers work in layman’s terms. And, the technology powering this site is impressive, with page turning animations, and pushState.
First, the HTML5 builder tool. Now, converting your flash into HTML5. At least it’s the right direction (HTML5).
Adobe has a prototype that acts much like their Flash Pro, but generates HTML, JavaScript, and CSS.
I suspect that this will be used on most brochureware websites in the future, but there will of course still be need for optimized hand-coded solutions until browser rendering and performance is as negligible as native apps.
Internet Explorer doesn’t support HTML5 elements. You must provide a shim. But this only helps fix any markup that is in the original document. If you receive more markup via an ajax request, and want to insert it into the document, IE has a hissy fit. You can’t stick HTML like that into some elements innerHTML property and hope it parses correctly.
What I did instead, was before inserting the HTML, I’d find all HTML5 elements1, convert them to spans with an extra attribute htmlfix with the value set to the tag name it should be. Then after inserting into an innerHTML, I’d find all the spans with an htmlfix attribute, create the proper element, transfer all its attributes, set its innerHTML, and replaceNode.2
function processAjax(content) {
var spanned = content,
html5els = ['nav','header','article','footer','section','time'], //etc...
attributes = ['id', 'class', 'pubdate', 'datetime']; //etc...
html5els.forEach(function(tag) {
var re = new RegExp('<(\/?)'+tag+'([^>]*)>', 'g');
spanned = spanned.replace(re, '<$1span htmlfix="'+tag+'"$2>');
});
var el = new Element('div', { html: spanned }).getFirst();
//after IE parses the spans, createElements of all the "fixed" elements
el.getElements('span[htmlfix]').forEach(function(span) {
var tagname = span.get('htmlfix');
span.erase('htmlfix');
var newEl = new Element(tagname, { html: span.innerHTML });
//transfer attributes
attributes.forEach(function(attr) {
var val = span.get(attr);
if(val) {
newEl.set(attr, val);
}
});
newEl.replaces(span);
});
return el;
}
Yes, I used Regex to parse HTML. No, it didn’t create a rift in space. I knew what I was doing. ↩
This uses MooTools, because it’s awesome. I wasn’t feeling very masochistic this time around, so I didn’t create a vanilla JS version. ↩