+5
-3
@@ -24,3 +24,5 @@ 'use strict'; | ||
| , structural = /pre|textarea|code/ | ||
| , interpunction = /[\.,!%;:\-\?]/; | ||
| , interpunction = /[\.,!%;:\-\?]/ | ||
| , start = new RegExp('^' + interpunction.source) | ||
| , end = new RegExp(interpunction.source + '$'); | ||
@@ -74,3 +76,3 @@ /** | ||
| return (this.isInline(element) && (flow.test(data) || interpunction.test(data)) | ||
| return (this.isInline(element) && (flow.test(data) || end.test(data)) | ||
| ? ' <' | ||
@@ -141,3 +143,3 @@ : '<') + element.data + '>'; | ||
| // Check if the text requires flowing based on last output and interpunction. | ||
| if (flow.test(data) && !(new RegExp('^' + interpunction.source)).test(element)) { | ||
| if (flow.test(data) && !start.test(element)) { | ||
| element = ' ' + element; | ||
@@ -144,0 +146,0 @@ } |
+1
-1
| { | ||
| "name": "minimize", | ||
| "version": "0.4.0", | ||
| "version": "0.4.1", | ||
| "description": "Minimize HTML", | ||
@@ -5,0 +5,0 @@ "main": "./lib/minimize", |
+10
-2
@@ -117,3 +117,3 @@ 'use strict'; | ||
| it('is inline and prepended by text', function () { | ||
| expect(helpers.tag(html.inline), html.element, 'text').to.be.equal( | ||
| expect(helpers.tag(html.inline, 'text')).to.be.equal( | ||
| ' <' + html.inline.data + '>' | ||
@@ -125,4 +125,12 @@ ); | ||
| it('is inline and prepended by interpunction', function () { | ||
| expect(helpers.tag(html.inline, 'text.')).to.be.equal( | ||
| ' <' + html.inline.data + '>' | ||
| ); | ||
| expect(structure).to.be.calledOnce; | ||
| }); | ||
| it('is inline and prepended by closing tag', function () { | ||
| expect(helpers.tag(html.inline), html.element, 'text</b>').to.be.equal( | ||
| expect(helpers.tag(html.inline, 'text</b>')).to.be.equal( | ||
| ' <' + html.inline.data + '>' | ||
@@ -129,0 +137,0 @@ ); |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
28691
0.93%736
1.1%