{"name":"collapse-whitespace","version":"1.0.0","description":"Remove unnecessary whitespace from an element.","main":"./whitespace.js","scripts":{"test":"gulp test","js":"gulp","dev":"gulp watch"},"keywords":["browser","collapse","whitespace","collapse-whitespace","dom"],"repository":{"type":"git","url":"git://github.com/lucthev/collapse-whitespace"},"author":{"name":"Luc Thevenard","email":"lucthevenard@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/lucthev/serialize/issues"},"homepage":"https://github.com/lucthev/serialize","devDependencies":{"browserify":"~6.1.0","gulp":"~3.8.8","gulp-jshint":"~1.5.3","jshint-stylish":"~0.1.5","uglify-js":"~2.4.15"},"gitHead":"a5e804f9f6df9ed116c29f8a200775bb999d09c3","_id":"collapse-whitespace@1.0.0","_shasum":"479a2530319741a7d1fbbfdf140f920367a0b4d2","_from":".","_npmVersion":"2.1.1","_nodeVersion":"0.10.31","_npmUser":{"name":"lucthev","email":"lucthevenard@gmail.com"},"maintainers":[{"name":"lucthev","email":"lucthevenard@gmail.com"}],"dist":{"shasum":"479a2530319741a7d1fbbfdf140f920367a0b4d2","tarball":"http://registry-npm.ywwl.com/collapse-whitespace/download/collapse-whitespace-1.0.0.tgz","integrity":"sha512-6sam5ST/YeHoXX+wFxWVHUk5NDdQ5ywCuK3fdRUVbVLMTOxRL/DcyCP+uZiCJ2ocSIh+UNbU3K2zCb8Tg1jdzg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICUIUy5VSB3Bqg7Ba5Hu2HnH7zpX6CtC7Roa688oOY55AiAMbS8qnYTKl0T/4CM32QeuS6Elu0KuHxMRO67XhT8QJQ=="}],"size":5781,"noattachment":false,"key":"/collapse-whitespace/-/collapse-whitespace-1.0.0.tgz"},"directories":{},"readme":"# collapse-whitespace\n\n`collapse-whitespace` is a module for removing unnecessary whitespace from a DOM node.\n\n## Installation\n\nUse [`npm`](https://www.npmjs.org/):\n\n```\n$ npm install collapse-whitespace\n```\n\nThen, if you’re using [`browserify`](https://github.com/substack/node-browserify) or something similar:\n\n```js\nvar collapse = require('collapse-whitespace')\n```\n\nOtherwise, just include the minified file, `whitespace.min.js`, somewhere on your page, and this module will make itself available as `collapse`:\n\n```html\n<script src=\"./node_modules/collapse-whitespace/whitespace.min.js\"></script>\n```\n\n## Usage\n\n```js\nvar collapse = require('collapse-whitespace')\nvar div = document.createElement('div')\n\ndiv.innerHTML = '   <p>Foo   bar</p>  <p>Words</p> '\ncollapse(div)\n\nconsole.log(div.innerHTML)\n// '<p>Foo bar</p><p>Words</p>'\n```\n\nFor more examples of what `collapse-whitespace` does, check out the [test page](https://github.com/lucthev/collapse-whitespace/blob/master/test.html).\n\n## API\n\n`collapse-whitespace` exposes a single function (called `collapse` if you're including this module via a `script` tag).\n\n### collapse(node [, isBlock [, isPre]])\n\nRemoves all extraneous whitespace from the given node. By default, `collapse-whitespace` relies on a theoretical [list][blocks] of block elements to determine which elements are block and which ones are inline. This list may be unsuitable for your needs; the optional parameter `isBlock` can be used to tweak this behaviour. `isBlock` should be a function that accepts a DOM node and returns a Boolean.\n\nNote that `collapse-whitespace` also does not take into account the parent(s) of the given node:\n\n```html\n<pre>\n  <span class=\"test\">\n    Lots of whitespace around this text.\n  </span>\n</pre>\n\n<script>\n  collapse(document.querySelector('.test'))\n</script>\n\n<!-- Results in: -->\n<pre>\n  <span class=\"test\">Lots of whitespace around this text.</span>\n</pre>\n```\n\nBy default only `PRE` nodes have whitespace preserved, but this can be customized via the optional `isPre` parameter. `isPre` should be a function that accepts a DOM node and returns a Boolean.\n\n## License\n\nMIT\n\n[regexp]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/RegExp\n[blocks]: https://github.com/webmodules/block-elements\n","publish_time":1413871468859,"_cnpm_publish_time":1413871468859,"dist-tags":{"latest":"1.1.7"}}