-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
34 lines (34 loc) · 2.84 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
"name": "h",
"version": "0.1.0",
"homepage": "https://github.com/dominictarr/h",
"repository": {
"type": "git",
"url": "git://github.com/dominictarr/h.git"
},
"dependencies": {},
"devDependencies": {
"tap": "0.3.0"
},
"scripts": {
"test": "tap test"
},
"author": {
"name": "'Dominic Tarr'",
"email": "dominic.tarr@gmail.com",
"url": "http://dominictarr.com"
},
"license": "MIT",
"readme": "# h\n\ngenerate HTML from javascript the easy way.\n\n## Example\n\n``` js\n\ndocument.body.appendChild(\n h('div#page',\n h('div#header',\n h('h1.classy', 'h')),\n h('div#menu', { style: { float: 'left', width: '200px' } },\n h('ul',\n h('li', 'one'),\n h('li', 'two'),\n h('li', 'three'))),\n h('div#content', {style: {float: 'left'} },\n h('h2', 'content title'),\n h('p', \n \"so it's just like a templating engine,\\n\",\n \"but easy to use inline with javascript\\n\"),\n h('p', \n \"the intension is for this to be used to create\\n\",\n \"reusable, interactive html widgets. \")))\n)\n\n```\n\n## h (tag, attrs, [text?, Elements?,...])\n\n\nCreate an `HTMLElement`. first argument must be the tag name.\n\n### classes & id\n\nIf the tag name is of form `name.class1.class2#id` that is a short cut\nfor setting the class and id.\n\n### attributes\n\nIf an `{}` object is passed in, it's values will be used to set attributes.\n\n``` js\nh('a', {href: 'https://npm.im/h'}, 'h')\n```\n\nIf an attribute is a function, then it will be registered as an event listener.\n\n``` js\n\nh('a', {href: '#', click: function () {\n alert('you are 1,000,000th visitor!'\n return false\n}\n\n```\n\nIf an attribute has a style property, then that will be handled specially.\n\n``` js\n\nh('h1.fun', {style: {font: 'comic sans MS'}}, 'happy birthday!')\n\n```\n\nYou may pass in attributes in multiple positions, it's no problem!\n\n### children - string\n\nIf an argument is a string, a TextNode is created in that position.\n\n### children - HTMLElement\n\nIf a argument is a HTMLELement, for example, the return value of a call to `h`\nthats cool too.\n\n### children - null.\n\nThis is just ignored.\n\n### children - Array\n\nEach item in the array is treated like a ordinary child. (string or HTMLElement)\nthis is uesful when you want to iterate over an object:\n\n```\n\nh('table',\n Object.keys(obj).map(function (k) {\n return h('tr'\n h('th', k),\n h('td', obj[k])\n )\n })\n\n```\n\n## License\n\nMIT\n",
"readmeFilename": "README.md",
"description": "generate HTML from javascript the easy way.",
"bugs": {
"url": "https://github.com/dominictarr/h/issues"
},
"_id": "h@0.1.0",
"dist": {
"shasum": "bebba37bf2bd27658f7d9487415c0908c16a15d2"
},
"_from": "h@~0.1.0",
"_resolved": "https://registry.npmjs.org/h/-/h-0.1.0.tgz"
}