el-component
Advanced tools
| language: node_js | ||
| node_js: | ||
| - 0.8 | ||
| - 0.10 |
+1
-1
@@ -5,3 +5,3 @@ { | ||
| "description": "creates HTML from jade like expressions", | ||
| "version": "0.1.0", | ||
| "version": "0.1.1", | ||
| "keywords": [], | ||
@@ -8,0 +8,0 @@ "dependencies": {}, |
+8
-0
| 0.1.1 / 2014-03-10 | ||
| ================== | ||
| * fix repo references in package.json | ||
| * add Readme badges | ||
| * add travis CI config | ||
| * update docs | ||
| 0.1.0 / 2013-12-15 | ||
@@ -3,0 +11,0 @@ ================== |
+4
-4
| { | ||
| "name": "el-component", | ||
| "version": "0.1.0", | ||
| "version": "0.1.1", | ||
| "description": "create HTML from jade-like expressions", | ||
@@ -11,3 +11,3 @@ "main": "index.js", | ||
| "type": "git", | ||
| "url": "https://github.com/code42day/el-component.git" | ||
| "url": "https://github.com/code42day/el.git" | ||
| }, | ||
@@ -24,3 +24,3 @@ "keywords": [ | ||
| "bugs": { | ||
| "url": "https://github.com/code42day/el-component/issues" | ||
| "url": "https://github.com/code42day/el/issues" | ||
| }, | ||
@@ -32,2 +32,2 @@ "devDependencies": { | ||
| } | ||
| } | ||
| } |
+32
-1
@@ -0,6 +1,12 @@ | ||
| [](http://travis-ci.org/code42day/el) | ||
| [](https://gemnasium.com/code42day/el) | ||
| [](http://badge.fury.io/js/el-component) | ||
| # el | ||
| creates HTML from jade like expressions | ||
| creates HTML from jade like expressions | ||
| Particularly useful if you are a fan of [`insertAdjacentHTML`][1] but if setting `innerHTML` is your | ||
| thing `el` works just as well. | ||
| ## Installation | ||
@@ -14,6 +20,31 @@ | ||
| ### el(tag, content, attributes) | ||
| - `tag` - can be the name of HTML tag (`span`, `img` etc.) or a jade-like expression | ||
| - `content` - is an optional content of the tag | ||
| - `attributes` - object with a map of attributes added to the generated HTML, class attribute is | ||
| merged with what was parsed from tag | ||
| Some examples: | ||
| el('span', 'some text inside'); // <span>some text inside</span> | ||
| el('span.title', 'Title'); // <span class="title">Title</span> | ||
| el('span.title.car', 'Title'); // <span class="title car">Title</span> | ||
| el('span#title.car', 'Title'); // <span class="car" id="title">Title</span> | ||
| you can skip the tag name if you want `div`: | ||
| el('#title', 'Title'); // <div id="title">Title</div> | ||
| el(); // <div></div> | ||
| el knows about void elements: | ||
| el('img', { src: 'http://example.com/img.png' }); // <img src="http://example.com/img.png"> | ||
| el('iframe', { src: 'http://example.com' }); // <iframe src="http://example.com"></iframe> | ||
| ## License | ||
| MIT | ||
| [1]: https://developer.mozilla.org/en-US/docs/Web/API/Element.insertAdjacentHTML |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
5993
39.11%10
11.11%0
-100%50
163.16%