/*! HTML - v0.12.1 - 2014-10-22
* http://nbubna.github.io/HTML/
* Copyright (c) 2014 ESHA Research; Licensed MIT, GPL */
(function(window, document, Observer) {
"use strict";
var _ = {
version: "0.12.1",
slice: Array.prototype.slice,
list: function(list, force) {
if (list.length === 1){ return _.node(list[0], force); }
if (force || !list.each) {
if (!list.slice){ list = _.slice.call(list); }
_.methods(list);
if (list.length){ _.children(list[0], list); }// proxy dot-traversal into first element
}
return list;
},
node: function(node, force) {
if (force || !node.each) {
_.methods(node);
_.children(node);
}
return node;
},
methods: function(o) {
for (var method in _.fn) {
_.define(o, method, _.fn[method]);
}
},
children: function(node, list) {
var children = node._children = {};
for (var i=0, m=node.childNodes.length; i= 0 || b < 0 ?
self.slice(b, e || (b + 1) || undefined) :
self.filter(
typeof b === "function" ? b :
function(el){ return el.matches(b); }
)
);
},
all: function(prop, inclusive, _results) {
_results = _results || [];
var self = this.forEach ? this : [this];
if (inclusive){ _results.push.apply(_results, self); }
for (var i=0, m=self.length; i 0) {
var keys = key.split('.');
while (keys.length > 1 && (el = el[key = keys.shift()])){}
// if lookup failed, reset to originals
el = el || _el;
key = el ? keys[0] : _key;
}
var val = el[key];
if (val !== undefined) {
if (typeof val === "function") { return val.apply(el, args); }
else if (args) { el[key] = args[0]; }
else { return val; }
}
else if (args) {
if (args[0] === null){ _el.removeAttribute(_key); }
else { _el.setAttribute(_key, args[0]); }
} else { return _el.getAttribute(_key); }
},
fill: function(args, index, el) {
var ret = [];
for (var i=0,m=args.length; i': function(tag) {
if (tag) {
var el = document.createElement(tag);
this.appendChild(el);
return el;
}
return this;
},
'+': function(tag, root) {
return add.emmet['>'].call(this.parentNode || root, tag);
},
'*': function(count) {
var parent = this.parentNode,
els = [this];
for (var i=1; i