{"_id":"@arve.knudsen/hyperscript","_rev":"5-b95a7194c355c1fd137850867bfd6b61","name":"@arve.knudsen/hyperscript","description":"Create HyperText with JavaScript, on client or server.","dist-tags":{"latest":"2.2.1"},"versions":{"2.1.0":{"name":"@arve.knudsen/hyperscript","version":"2.1.0","homepage":"https://github.com/aknuds1/hyperscript","repository":{"type":"git","url":"git://github.com/aknuds1/hyperscript.git"},"author":{"name":"'Dominic Tarr'","email":"dominic.tarr@gmail.com","url":"http://dominictarr.com"},"license":"MIT","devDependencies":{"tape":"~2.13.3","observable":"~2.1.2","ispy":"~0.1.2","simulate":"0.0.5"},"dependencies":{"browser-split":"0.0.0","class-list":"~0.1.0","html-element":"^2.0.0"},"browser":{"html-element":false},"scripts":{"test":"set -e; for t in test/*.js; do node $t; done"},"testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"gitHead":"ccb2a7e98b8c8d78fb74018769b47088fd1953f9","description":"Create HyperText with JavaScript, on client or server.","bugs":{"url":"https://github.com/aknuds1/hyperscript/issues"},"_id":"@arve.knudsen/hyperscript@2.1.0","_shasum":"d2fe4ab8f053889d6b6563c96324db4e07c37e14","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.2.0","_npmUser":{"name":"arve.knudsen","email":"arve.knudsen@gmail.com"},"dist":{"shasum":"d2fe4ab8f053889d6b6563c96324db4e07c37e14","tarball":"https://registry.npmjs.org/@arve.knudsen/hyperscript/-/hyperscript-2.1.0.tgz","integrity":"sha512-8ZWIElj08wGLyrK030XSi1ekEXdUtXYuy95uO3OhuCUBDY4GDHmrtmuMg3t5zPkXQW7M2JD/z2kiLgY0pROCIw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC5aCwRxhFqIL6URm/DCRpATNl006+sV5YFQ6bD6nhnhAIgApgpO+pdYOr5TOm8/d8W5k3iMdKNnpVn5DaCtdydDJQ="}]},"maintainers":[{"name":"arve.knudsen","email":"arve.knudsen@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/hyperscript-2.1.0.tgz_1481489015267_0.23713982151821256"}},"2.2.0":{"name":"@arve.knudsen/hyperscript","version":"2.2.0","homepage":"https://github.com/aknuds1/hyperscript","repository":{"type":"git","url":"git://github.com/aknuds1/hyperscript.git"},"author":{"name":"'Dominic Tarr'","email":"dominic.tarr@gmail.com","url":"http://dominictarr.com"},"license":"MIT","devDependencies":{"tape":"~2.13.3","observable":"~2.1.2","ispy":"~0.1.2","simulate":"0.0.5"},"dependencies":{"browser-split":"0.0.0","class-list":"~0.1.0","html-element":"^2.0.0","on-load":"^3.2.0"},"browser":{"html-element":false},"scripts":{"test":"set -e; for t in test/*.js; do node $t; done"},"testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"gitHead":"5782268529387a9b2d33fac43a955bb5691ceb03","description":"Create HyperText with JavaScript, on client or server.","bugs":{"url":"https://github.com/aknuds1/hyperscript/issues"},"_id":"@arve.knudsen/hyperscript@2.2.0","_shasum":"8c73ef58036efa63916bd440e8822fdde39618b0","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"arve.knudsen","email":"arve.knudsen@gmail.com"},"dist":{"shasum":"8c73ef58036efa63916bd440e8822fdde39618b0","tarball":"https://registry.npmjs.org/@arve.knudsen/hyperscript/-/hyperscript-2.2.0.tgz","integrity":"sha512-li48f8IHxlguJUz6lVk8ar1Cj3UX59TbpCecQ+/CZGgz1b8MkMNWJ4KGLgZQaANhZJpcGPcIYeHyKUmZ4hQIUA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFopHifk7l6dcDPr6NO0HtjhOGXwVjx0Cl6n1b9fEmkrAiANMYliMDcLOmGdcJH4+prCpNhKQw0vW09WVJcmTBFOWg=="}]},"maintainers":[{"name":"arve.knudsen","email":"arve.knudsen@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/hyperscript-2.2.0.tgz_1486399572186_0.9224847715813667"}},"2.2.1":{"name":"@arve.knudsen/hyperscript","version":"2.2.1","homepage":"https://github.com/aknuds1/hyperscript","repository":{"type":"git","url":"git://github.com/aknuds1/hyperscript.git"},"author":{"name":"'Dominic Tarr'","email":"dominic.tarr@gmail.com","url":"http://dominictarr.com"},"license":"MIT","devDependencies":{"tape":"~2.13.3","observable":"~2.1.2","ispy":"~0.1.2","simulate":"0.0.5"},"dependencies":{"browser-split":"0.0.0","class-list":"~0.1.0","html-element":"^2.0.0","on-load":"^3.2.0"},"browser":{"html-element":false},"scripts":{"test":"set -e; for t in test/*.js; do node $t; done"},"testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"gitHead":"606504c540f9c4858b2aaabbcf43c781f77bd97d","description":"Create HyperText with JavaScript, on client or server.","bugs":{"url":"https://github.com/aknuds1/hyperscript/issues"},"_id":"@arve.knudsen/hyperscript@2.2.1","_shasum":"d0b01f38dfecd5f4c204759d3ebcbb4dd1617949","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"arve.knudsen","email":"arve.knudsen@gmail.com"},"dist":{"shasum":"d0b01f38dfecd5f4c204759d3ebcbb4dd1617949","tarball":"https://registry.npmjs.org/@arve.knudsen/hyperscript/-/hyperscript-2.2.1.tgz","integrity":"sha512-I8ykfUnmQtcGy2XNAudw6giD3OLUpGRc8R6YZLnhllwUb/X8M4UU/UArfmD4Zt3t4Iicwfji7WKhiFPR8Hci+Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCyM4mLtB0r9j6Hi3tvuXTclJTaqh4SGKTvyhMU9TVAeAIhALWC7vsnLoeqM/B+PBS/h0CRVqGyyHTlcC9efzoFmd0n"}]},"maintainers":[{"name":"arve.knudsen","email":"arve.knudsen@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/hyperscript-2.2.1.tgz_1486399808809_0.39839046308770776"}}},"readme":"# HyperScript\n\nCreate HyperText with JavaScript, on client or server.\n\n[![testling badge](https://ci.testling.com/dominictarr/hyperscript.png)]\n  (https://ci.testling.com/dominictarr/hyperscript)\n\n[Interactive Demo](http://dominictarr.github.com/hyperscript)\n\nSee also [mercury](https://github.com/Raynos/mercury), a modular ui\nframework influenced by hyperscript but much more heavily optimized.\n\n## Example\n\n``` js\nvar h = require('hyperscript')\nh('div#page',\n  h('div#header',\n    h('h1.classy', 'h', { style: {'background-color': '#22f'} })),\n  h('div#menu', { style: {'background-color': '#2f2'} },\n    h('ul',\n      h('li', 'one'),\n      h('li', 'two'),\n      h('li', 'three'))),\n    h('h2', 'content title',  { style: {'background-color': '#f22'} }),\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 intention is for this to be used to create\\n\",\n      \"reusable, interactive html widgets. \"))\n```\n\n## On the server\n\nYou can still use hyperscript on the server,\nthe limitation is that events don't make sense anymore,\nbut you can use it to generate html:\n\n``` js\nconsole.log(h('h1', 'hello!').outerHTML)\n=> '<h1>hello!</h1>'\n```\n\n## h (tag, attrs, [text?, Elements?,...])\n\nCreate an `HTMLElement`. The first argument must be the tag name, you may use a\nfully qualified tagname for building e.g. XML documents: `h('ns:tag').\n\n### classes & id\n\nIf the tag name is of form `name.class1.class2#id` that is a shortcut\nfor setting the class and id.\n\n### default tag name\n\nIf the tag name begins with a class or id, it defaults to a `<div>`.\n\n### Attributes\n\nIf an `{}` object is passed in it will be used to set attributes.\n\n``` js\nvar h = require('hyperscript')\nh('a', {href: 'https://npm.im/hyperscript'}, 'hyperscript')\n```\n\nNote that hyperscript sets properties on the DOM element object, not\nattributes on the HTML element. This makes for better consistency across\nbrowsers and a nicer API for booleans. There are some gotchas, however.\nAttributes such as `colspan` are camel cased to `colSpan`, and `for` on the\nlabel element is `htmlFor` to avoid collision with the language keyword. See the\n[DOM HTML specification](http://www.w3.org/TR/DOM-Level-2-HTML/html.html)\nfor details.\n\n### events\n\nIf an attribute is a function, then it will be registered as an event listener.\n\n``` js\nvar h = require('hyperscript')\nh('a', {href: '#',\n  onclick: function (e) {\n    alert('you are 1,000,000th visitor!')\n    e.preventDefault()\n  }\n}, 'click here to win a prize')\n```\n\n### styles\n\nIf an attribute has a style property, then that will be handled specially.\n\n``` js\nvar h = require('hyperscript')\nh('h1.fun', {style: {'font-family': 'Comic Sans MS'}}, 'Happy Birthday!')\n```\n\nor as a string\n\n``` js\nvar h = require('hyperscript')\nh('h1.fun', {style: 'font-family: Comic Sans MS'}, 'Happy Birthday!')\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 `Node` (or `HTMLElement`), for example, the return value of a call to `h`\nthat's 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 useful when you want to iterate over an object:\n\n``` js\nvar h = require('hyperscript')\nvar obj = {\n  a: 'Apple',\n  b: 'Banana',\n  c: 'Cherry',\n  d: 'Durian',\n  e: 'Elder Berry'\n}\nh('table',\n  h('tr', h('th', 'letter'), h('th', 'fruit')),\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### Cleaning Up\n\nIf you need to clean up a widget created using hyperscript - deregistering all its event handlers and observable listeners, you can use `context()`.\n\n``` js\nvar h = require('hyperscript').context()\nvar o = require('observable')\nvar text = o()\ntext('click here to win a prize')\nh('a', {href: '#',\n  onclick: function (e) {\n    text('you are 1,000,000th visitor!')\n    e.preventDefault()\n  }\n}, text)\n\n// then if you want to remove this widget from the page\n// to cleanup\nh.cleanup()\n\n```\n## Ecosystem\n\n* [html2hscript](https://github.com/twilson63/html2hscript) - Parse HTML into hyperscript\n* [dom2hscript](https://github.com/AkeemMcLennon/dom2hscript) - Frontend library for parsing HTML into hyperscript using the browser's built in parser.\n* [html2hscript.herokuapp.com](http://html2hscript.herokuapp.com/) - Online Tool that converts html snippets to hyperscript\n* [html2hyperscript](https://github.com/unframework/html2hyperscript) - Original commandline utility to convert legacy HTML markup into hyperscript\n* [hyperscript-helpers](https://github.com/ohanhi/hyperscript-helpers) - write `div(h1('hello')` instead of `h('div', h('h1', 'hello'))`\n* [react-hyperscript](https://github.com/mlmorg/react-hyperscript)  - use hyperscript with React.\n\n## License\n\nMIT\n\n\n\n","maintainers":[{"name":"arve.knudsen","email":"arve.knudsen@gmail.com"}],"time":{"modified":"2022-06-12T14:49:02.872Z","created":"2016-12-11T20:43:35.828Z","2.1.0":"2016-12-11T20:43:35.828Z","2.2.0":"2017-02-06T16:46:12.813Z","2.2.1":"2017-02-06T16:50:10.582Z"},"homepage":"https://github.com/aknuds1/hyperscript","repository":{"type":"git","url":"git://github.com/aknuds1/hyperscript.git"},"author":{"name":"'Dominic Tarr'","email":"dominic.tarr@gmail.com","url":"http://dominictarr.com"},"bugs":{"url":"https://github.com/aknuds1/hyperscript/issues"},"license":"MIT","readmeFilename":"README.md"}