Exemplo n.º 1
0
stylecow.run = function (css) {
	var tasks = {_: []};

	stylecow.tasks.forEach(function (task) {
		if (task.forBrowsersLowerThan && !needFix(stylecow.support, task.forBrowsersLowerThan)) {
			return;
		}

		if (task.filter) {
			if (typeof task.filter.type === 'string') {
				if (task.filter.type in tasks) {
					tasks[task.filter.type].push(task);
				} else {
					tasks[task.filter.type] = [task];
				}
			} else {
				tasks._.push(task);
			}
		} else {
			task.fn(css);
		}
	});

	executeTasks(css, tasks);

	if ('Root' in tasks) {
		for (var i = tasks.Root.length - 1; i >= 0; i--) {
			if (css.is(tasks.Root[i].filter)) {
				tasks.Root[i].fn(css);
			}
		}
	}
};
Exemplo n.º 2
0
stylecow.addTask = function (task) {
	if (!task.forBrowsersLowerThan) {
		task.forBrowsersLowerThan = defaultSupport;
	}

	stylecow.tasks.push(task);

	return stylecow;
};