collapse-whitespace
Advanced tools
Comparing version
{ | ||
"name": "collapse-whitespace", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Remove unnecessary whitespace from an element.", | ||
"main": "./whitespace.js", | ||
"main": "lib/whitespace.js", | ||
"scripts": { | ||
@@ -12,5 +12,5 @@ "test": "make test" | ||
"collapse", | ||
"whitespace", | ||
"collapse-whitespace", | ||
"dom" | ||
"dom", | ||
"whitespace" | ||
], | ||
@@ -28,9 +28,11 @@ "repository": { | ||
"devDependencies": { | ||
"browserify": "~6.1.0", | ||
"jshint": "~2.6.3", | ||
"uglify-js": "~2.4.15" | ||
"babel": "^5.6.14", | ||
"browserify": "^10.2.6", | ||
"standard": "^4.5.3", | ||
"uglify-js": "^2.4.23" | ||
}, | ||
"dependencies": { | ||
"block-elements": "1.0.0" | ||
"block-elements": "^1.0.0", | ||
"void-elements": "^2.0.1" | ||
} | ||
} |
# collapse-whitespace | ||
`collapse-whitespace` is a module for removing unnecessary whitespace from a DOM tree. | ||
`collapse-whitespace` is a module for removing unnecessary whitespace from a DOM node. | ||
@@ -19,3 +19,3 @@ ## Installation | ||
Otherwise, just include the minified file, `whitespace.min.js`, somewhere on your page: | ||
Otherwise, just include the minified file, `whitespace.min.js`, somewhere on your page, and this module will make itself available as `collapse`: | ||
@@ -43,3 +43,3 @@ ```html | ||
`collapse-whitespace` exposes a single function; if you’re including this module as a global, it will be called `collapse`. | ||
`collapse-whitespace` exposes a single function (called `collapse` if you're including this module via a `script` tag). | ||
@@ -50,3 +50,3 @@ ### collapse(node [, isBlock]) | ||
Note that `collapse-whitespace` also does not take into account the parent(s) of the given node | ||
Note that `collapse-whitespace` also does not take into account the parent(s) of the given node: | ||
@@ -59,5 +59,7 @@ ```html | ||
</pre> | ||
<script> | ||
collapse(document.querySelector('.test')) | ||
</script> | ||
<!-- Results in: --> | ||
@@ -64,0 +66,0 @@ <pre> |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.collapse=e()}}(function(){var e,n,t;return function r(e,n,t){function i(f,u){if(!n[f]){if(!e[f]){var a=typeof require=="function"&&require;if(!u&&a)return a(f,!0);if(o)return o(f,!0);var l=new Error("Cannot find module '"+f+"'");throw l.code="MODULE_NOT_FOUND",l}var d=n[f]={exports:{}};e[f][0].call(d.exports,function(n){var t=e[f][1][n];return i(t?t:n)},d,d.exports,r,e,n,t)}return n[f].exports}var o=typeof require=="function"&&require;for(var f=0;f<t.length;f++)i(t[f]);return i}({1:[function(e,n,t){n.exports=["address","article","aside","audio","blockquote","canvas","dd","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","noscript","ol","output","p","pre","section","table","tfoot","ul","video"]},{}],2:[function(e,n,t){"use strict";var r=e("block-elements").map(function(e){return e.toUpperCase()});function i(e){return f(e)&&r.indexOf(e.nodeName)>=0}function o(e){return e&&e.nodeType===3}function f(e){return e&&e.nodeType===1}function u(e,n){var t=/^ /,r=/ $/,u,a,l,d,c;if(typeof n!=="function")n=i;function p(t){while(t&&t!==e){if(t.nextSibling)return t.nextSibling;t=t.parentNode;if(l&&n(t)){l.data=l.data.replace(/[ \r\n\t]$/,"");l=null}}return null}function s(e){return e.firstChild?e.firstChild:p(e)}function h(e){var n=p(e);e.parentNode.removeChild(e);return n}if(e.nodeName==="PRE")return;e.normalize();d=s(e);while(d){a=d.previousSibling;u=d.nextSibling;if(o(d)){c=d.data.replace(/[ \r\n\t]+/g," ");if(!l||a&&n(a))c=c.replace(t,"");if(u&&n(u))c=c.replace(r,"");if(l&&r.test(l.data)&&t.test(c))c=c.substr(1);if(c){d.data=c;l=d;d=p(d)}else{d=h(d)}}else if(f(d)){if(d.nodeName==="PRE"){d=p(d);continue}if(l&&n(d)){l.data=l.data.replace(r,"");l=null}d=s(d)}else{d=h(d)}}if(l)l.data=l.data.replace(r,"")}n.exports=u},{"block-elements":1}]},{},[2])(2)}); | ||
(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.collapse=e()}})(function(){var e,t,r;return function n(e,t,r){function o(u,a){if(!t[u]){if(!e[u]){var f=typeof require=="function"&&require;if(!a&&f)return f(u,!0);if(i)return i(u,!0);var l=new Error("Cannot find module '"+u+"'");throw l.code="MODULE_NOT_FOUND",l}var d=t[u]={exports:{}};e[u][0].call(d.exports,function(t){var r=e[u][1][t];return o(r?r:t)},d,d.exports,n,e,t,r)}return t[u].exports}var i=typeof require=="function"&&require;for(var u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,t,r){"use strict";var n=e("void-elements");Object.keys(n).forEach(function(e){n[e.toUpperCase()]=1});var o={};e("block-elements").forEach(function(e){o[e.toUpperCase()]=1});function i(e){return!!(e&&o[e.nodeName])}function u(e){return!!(e&&n[e.nodeName])}function a(e,t){if(!e.firstChild||e.nodeName==="PRE")return;if(typeof t!=="function"){t=i}var r=null;var n=false;var o=null;var a=l(o,e);while(a!==e){if(a.nodeType===3){var d=a.data.replace(/[ \r\n\t]+/g," ");if((!r||/ $/.test(r.data))&&!n&&d[0]===" "){d=d.substr(1)}if(!d){a=f(a);continue}a.data=d;r=a}else if(a.nodeType===1){if(t(a)||a.nodeName==="BR"){if(r){r.data=r.data.replace(/ $/,"")}r=null;n=false}else if(u(a)){r=null;n=true}}else{a=f(a);continue}var s=l(o,a);o=a;a=s}if(r){r.data=r.data.replace(/ $/,"");if(!r.data){f(r)}}}function f(e){var t=e.nextSibling||e.parentNode;e.parentNode.removeChild(e);return t}function l(e,t){if(e&&e.parentNode===t||t.nodeName==="PRE"){return t.nextSibling||t.parentNode}return t.firstChild||t.nextSibling||t.parentNode}t.exports=a},{"block-elements":2,"void-elements":3}],2:[function(e,t,r){t.exports=["address","article","aside","audio","blockquote","canvas","dd","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","noscript","ol","output","p","pre","section","table","tfoot","ul","video"]},{}],3:[function(e,t,r){t.exports={area:true,base:true,br:true,col:true,embed:true,hr:true,img:true,input:true,keygen:true,link:true,menuitem:true,meta:true,param:true,source:true,track:true,wbr:true}},{}]},{},[1])(1)}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
18173
34.03%239
151.58%73
2.82%2
100%4
33.33%9
-10%1
Infinity%+ Added
+ Added
+ Added
- Removed
Updated