From 0695263132193745d7f543fb1a20b63dbfe00075 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 8 Apr 2013 20:54:09 +0100 Subject: Rename styles module to htmlPaths --- lib/html-paths.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 lib/html-paths.js (limited to 'lib/html-paths.js') diff --git a/lib/html-paths.js b/lib/html-paths.js new file mode 100644 index 0000000..1d3b1f4 --- /dev/null +++ b/lib/html-paths.js @@ -0,0 +1,29 @@ +var _ = require("underscore"); + +exports.topLevelElement = topLevelElement; +exports.elements = elements; +exports.element = element; + +function topLevelElement(tagName, attributes) { + return elements([element(tagName, attributes, {fresh: true})]); +} + +function elements(elementStyles) { + return elementStyles.map(function(elementStyle) { + if (_.isString(elementStyle)) { + return element(elementStyle); + } else { + return elementStyle; + } + }); +} + +function element(tagName, attributes, options) { + options = options || {}; + return { + tagName: tagName, + attributes: attributes || {}, + fresh: options.fresh + }; +} + -- cgit v1.2.3