The Future Is Layered
Alex Russell <slightlyoff@google.com>
Twitter: @slightlylate
March 8, 2012
Alex Russell <slightlyoff@google.com>
Twitter: @slightlylate
March 8, 2012
flickr.com/photos/sifu_renka/2375478724/
flickr.com/photos/pchow98/4010171510/
flickr.com/photos/sidereal/1165292086
Not *Just* trying to make you hungry for lunch...although that's a
nice-to-have ;-)
HTTPArchive, 2012
flickr.com/photos/rintakumpu/4815039988/
flickr.com/photos/kadenis/5121129043/
learningwebgl.com
flickr.com/photos/imh/3297961043/
Throughout history
Every mystery
Ever solved has turned out to be
Not Magic.
<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js">
</script>
<script type="text/javascript">
YUI().use('calendar', 'datatype-date', function(Y) {
var calendar = new Y.Calendar({
contentBox: "#mycalendar",
width:'340px',
showPrevMonth: true,
showNextMonth: true,
date: new Date(2011, 07, 01)}).render();
});
</script>
<script
src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js">
</script>
<script>
dojo.require("dijit.dijit");
dojo.require("dijit.Calendar");
dojo.ready(function() {
var c = new dijit.Calendar({
value: new Date(),
isDisabledDate: function(d) {
// ...
}
});
document.body.appendChild(c.domNode);
});
</script>
function Comment(text) {
HTMLElement.call(this); // Makes this an Element
this.textContent = text || '...';
this.buildUI();
}
Comment.prototype = Object.create(HTMLElement.prototype);
Comment.prototype.constructor = Comment;
Comment.prototype.buildUI = function() { ... };
HTMLElement.register('x-comment', Comment);
var c = new Comment("Howdy, pardner!");
document.body.appendChild(c);
<!-- At risk in standards --> <x-comment>...</x-comment> <!-- Might instead be: --> <div is="x-comment">...</div>
function Comment(text) {
HTMLElement.call(this); // Makes this an Element
this.textContent = text || '...';
this.shadow = new ShadowRoot(this);
this.buildUI();
}
Comment.prototype = Object.create(HTMLElement.prototype);
Comment.prototype.constructor = Comment;
Comment.prototype.buildUI = function() { ... };
HTMLElement.register('x-comment', Comment);
<template id="commentTemplate">
<div class="holder">
<style scoped>
img { ... }
.text { ... }
.holder { ... }
</style>
<img class="avatar" alt="avatar">
<div class="text">
<content></content>
</div>
</div>
</template>
<script>
document.body.model = Model.get({
'items': [
{ 'name': 'Africa',
'children': [
{ 'name': 'Egypt' },
{ 'name': 'Kenya',
'children': [ { 'name': 'Nairobi' }, { 'name': 'Mombasa' } ]
} ] } ]
});
</script>
<template iterate="items" id="t">
<li>{{name}}
<ul><template ref="t" iterate="children"></template></ul>
</li>
</template>
<script>
var summary = new MutationSummary({
callback: [function], // required
rootNode: [node], // optional
observeOwnChanges: [boolean], // optional
queries: [{query}, …] // required. one query object at min.
});
// ...sometime later
summary.disconnect();
</script>
// shim layer with setTimeout fallback
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback, element){
window.setTimeout(callback, 1000 / 60);
};
})();
// usage:
// instead of setInterval(render, 16) ....
(function animloop(){
render();
requestAnimFrame(animloop, element);
})();
http://paulirish.com/2011/requestanimationframe-for-smart-animating/
addEventListener, Served Two Ways
dom.js
.length,
[Constructor]
!=