collapse-whitespace
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "collapse-whitespace", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Remove unnecessary whitespace from an element.", | ||
@@ -34,3 +34,6 @@ "main": "./whitespace.js", | ||
"uglify-js": "~2.4.15" | ||
}, | ||
"dependencies": { | ||
"block-elements": "1.0.0" | ||
} | ||
} |
'use strict'; | ||
// Things that are normally block elements. | ||
var blocks = { | ||
ADDRESS: 1, | ||
ARTICLE: 1, | ||
ASIDE: 1, | ||
BLOCKQUOTE: 1, | ||
DIV: 1, | ||
FIGCAPTION: 1, | ||
FIGURE: 1, | ||
FOOTER: 1, | ||
H1: 1, | ||
H2: 1, | ||
H3: 1, | ||
H4: 1, | ||
H5: 1, | ||
H6: 1, | ||
HEADER: 1, | ||
HR: 1, | ||
LI: 1, | ||
OL: 1, | ||
P: 1, | ||
PRE: 1, | ||
SECTION: 1, | ||
UL: 1 | ||
} | ||
var blocks = require('block-elements').map(function (block) { | ||
return block.toUpperCase() | ||
}) | ||
if (blocks.indexOf('LI') < 0) | ||
blocks.push('LI') | ||
function isBlock (node) { | ||
return !!(isElem(node) && blocks[node.nodeName]) | ||
return isElem(node) && blocks.indexOf(node.nodeName) >= 0 | ||
} | ||
@@ -32,0 +13,0 @@ |
@@ -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(){return function e(n,r,t){function o(f,u){if(!r[f]){if(!n[f]){var a="function"==typeof require&&require;if(!u&&a)return a(f,!0);if(i)return i(f,!0);var d=new Error("Cannot find module '"+f+"'");throw d.code="MODULE_NOT_FOUND",d}var l=r[f]={exports:{}};n[f][0].call(l.exports,function(e){var r=n[f][1][e];return o(r?r:e)},l,l.exports,e,n,r,t)}return r[f].exports}for(var i="function"==typeof require&&require,f=0;f<t.length;f++)o(t[f]);return o}({1:[function(e,n){"use strict";function r(e){return!(!o(e)||!f[e.nodeName])}function t(e){return e&&e.nodeType===Node.TEXT_NODE}function o(e){return e&&e.nodeType===Node.ELEMENT_NODE}function i(e){function n(n){for(;n&&n!==e;){if(n.nextSibling)return n.nextSibling;n=n.parentNode,d&&r(n)&&(d.data=d.data.replace(/[ \r\n\t]$/,""),d=null)}return null}function i(e){return e.firstChild?e.firstChild:n(e)}function f(e){var r=n(e);return e.parentNode.removeChild(e),r}var u,a,d,l,c,p=/^ /,s=/ $/;if("PRE"!==e.nodeName){for(e.normalize(),l=i(e);l;)if(a=l.previousSibling,u=l.nextSibling,t(l))c=l.data.replace(/[ \r\n\t]+/g," "),(!d||a&&r(a))&&(c=c.replace(p,"")),u&&r(u)&&(c=c.replace(s,"")),d&&s.test(d.data)&&p.test(c)&&(c=c.substr(1)),c?(l.data=c,d=l,l=n(l)):l=f(l);else if(o(l)){if("PRE"===l.nodeName){l=n(l);continue}d&&r(l)&&(d.data=d.data.replace(s,""),d=null),l=i(l)}else l=f(l);d&&(d.data=d.data.replace(s,""))}}var f={ADDRESS:1,ARTICLE:1,ASIDE:1,BLOCKQUOTE:1,DIV:1,FIGCAPTION:1,FIGURE:1,FOOTER:1,H1:1,H2:1,H3:1,H4:1,H5:1,H6:1,HEADER:1,HR:1,LI:1,OL:1,P:1,PRE:1,SECTION:1,UL:1};n.exports=i},{}]},{},[1])(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(){return function e(n,t,r){function o(f,u){if(!t[f]){if(!n[f]){var a="function"==typeof require&&require;if(!u&&a)return a(f,!0);if(i)return i(f,!0);var d=new Error("Cannot find module '"+f+"'");throw d.code="MODULE_NOT_FOUND",d}var l=t[f]={exports:{}};n[f][0].call(l.exports,function(e){var t=n[f][1][e];return o(t?t:e)},l,l.exports,e,n,t,r)}return t[f].exports}for(var i="function"==typeof require&&require,f=0;f<r.length;f++)o(r[f]);return o}({1:[function(e,n){"use strict";function t(e){return o(e)&&f.indexOf(e.nodeName)>=0}function r(e){return e&&e.nodeType===Node.TEXT_NODE}function o(e){return e&&e.nodeType===Node.ELEMENT_NODE}function i(e){function n(n){for(;n&&n!==e;){if(n.nextSibling)return n.nextSibling;n=n.parentNode,d&&t(n)&&(d.data=d.data.replace(/[ \r\n\t]$/,""),d=null)}return null}function i(e){return e.firstChild?e.firstChild:n(e)}function f(e){var t=n(e);return e.parentNode.removeChild(e),t}var u,a,d,l,c,p=/^ /,s=/ $/;if("PRE"!==e.nodeName){for(e.normalize(),l=i(e);l;)if(a=l.previousSibling,u=l.nextSibling,r(l))c=l.data.replace(/[ \r\n\t]+/g," "),(!d||a&&t(a))&&(c=c.replace(p,"")),u&&t(u)&&(c=c.replace(s,"")),d&&s.test(d.data)&&p.test(c)&&(c=c.substr(1)),c?(l.data=c,d=l,l=n(l)):l=f(l);else if(o(l)){if("PRE"===l.nodeName){l=n(l);continue}d&&t(l)&&(d.data=d.data.replace(s,""),d=null),l=i(l)}else l=f(l);d&&(d.data=d.data.replace(s,""))}}var f=e("block-elements").map(function(e){return e.toUpperCase()});f.indexOf("LI")<0&&f.push("LI"),n.exports=i},{"block-elements":2}],2:[function(e,n){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"]},{}]},{},[1])(1)}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14899
1
127
+ Addedblock-elements@1.0.0
+ Addedblock-elements@1.0.0(transitive)