Links
Enabling
about:config
Firefox Nightly - Add a Boolean flag named
dom.webcomponents.enabled
; set to true
{block name='title'}{/block} | |
{block name='body'}{/block} |
(function() { | |
function Game() { | |
this.reset(); | |
} | |
Game.prototype = { | |
reset: function reset() { | |
this.count = 0; | |
this.guesses = []; | |
this.answer = Math.round(Math.random() * 99 + 1); | |
}, |
[{"name":"root","type": "core/template", | |
"children": [ | |
{"name": "header","type": "core/template"}, | |
{"name": "body","type":"core/template", | |
"children": [ | |
{"name": "body.left", "type": "core/template"}, | |
{"name": "body.right", "type": "core/template"}, | |
{"name": "body.main", "type": "core/template"} | |
] | |
}, |
function protofy () { | |
var args = Array.prototype.slice.call(arguments) | |
return (function objectify (obj) { | |
obj = args.shift() | |
return args.length ? protofy.x( Object.create( objectify() ), obj ) : obj | |
}()) | |
} | |
protofy.x = function ( one, two, k ) { |
about:config
dom.webcomponents.enabled
; set to truevar block = require('yayo/block') | |
var fs = require('fs') | |
function getTemplate(name) { | |
return fs.readFileSync('./tmpl/'+name+'.tmpl', 'utf8') | |
} | |
var layout = new block({ | |
template: getTemplate('layout') | |
}) |
{ | |
"name": "block.name" | |
,"type": "core/text" | |
,"blocks": [ | |
{"name": "some.block","type": "core/list"} | |
,{"name": "some.nested.block","type": "core/text"} | |
] | |
} |
var Block = require('blocks/block') | |
var TaskModel = require('app/blocks/task') | |
var TaskBlock = Block.create({ | |
template: "<input type=\"checkbox\" <%= this.model.get('doneness')?'checked':'' %>/><%= this.model.get('text') %>" | |
}, { | |
construct: function (taskId) { | |
this.setModel(new TaskModel(taskId)) | |
} | |
}) |
var Obj = require('parsed/object') | |
var LocalStorage = require('parsed/object/localstorage') | |
var Validation = require('parsed/object/validation') | |
var Task = Obj.create('Task', { | |
implement: [LocalStorage, Validation] | |
}, { | |
init: function () { | |
} |
Markup is the final presentation API.
If you're in the business of writing markup that's intended to be styled by a 3rd party, provide the interested party the most flexible environment possible: write more markup | give more hooks.
A class that has more methods is more flexible than a class with one. A document with more elements and attributes is more flexible and style-able than one that provides minimal markup.