diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-04-08 20:54:09 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-04-08 20:54:09 +0100 |
| commit | 0695263132193745d7f543fb1a20b63dbfe00075 (patch) | |
| tree | 83677e0fe5037879992fd0dfb4fba63b9b7c70a5 /lib/html-paths.js | |
| parent | f4d7f2e4d6b38485ccdd954a73004b7adfc68e32 (diff) | |
Rename styles module to htmlPaths
Diffstat (limited to 'lib/html-paths.js')
| -rw-r--r-- | lib/html-paths.js | 29 |
1 files changed, 29 insertions, 0 deletions
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 + }; +} + |
