securemark 0.225.0 → 0.225.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/securemark.js +17 -12
- package/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/parser/util.ts +13 -27
package/CHANGELOG.md
CHANGED
package/dist/securemark.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.225.
|
|
1
|
+
/*! securemark v0.225.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
|
|
2
2
|
require = function () {
|
|
3
3
|
function r(e, n, t) {
|
|
4
4
|
function o(i, f) {
|
|
@@ -9056,26 +9056,31 @@ require = function () {
|
|
|
9056
9056
|
}
|
|
9057
9057
|
exports.trimNode = trimNode;
|
|
9058
9058
|
function trimNodeStart(nodes) {
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9059
|
+
for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[0], 0);) {
|
|
9060
|
+
if (nodes.length === 1 && typeof node === 'object' && node.className === 'indexer')
|
|
9061
|
+
break;
|
|
9062
|
+
if (typeof node === 'object' && node.className === 'comment')
|
|
9063
|
+
break;
|
|
9064
|
+
if (typeof node === 'string') {
|
|
9065
|
+
const pos = node.length - node.trimStart().length;
|
|
9063
9066
|
if (pos > 0) {
|
|
9064
|
-
nodes[0] =
|
|
9067
|
+
nodes[0] = node.slice(pos);
|
|
9065
9068
|
break;
|
|
9066
9069
|
}
|
|
9067
9070
|
}
|
|
9068
|
-
nodes.
|
|
9071
|
+
nodes.shift();
|
|
9069
9072
|
}
|
|
9070
|
-
return
|
|
9073
|
+
return nodes;
|
|
9071
9074
|
}
|
|
9072
9075
|
function trimNodeEnd(nodes) {
|
|
9073
9076
|
const skip = nodes.length > 0 && typeof nodes[nodes.length - 1] === 'object' && nodes[nodes.length - 1]['className'] === 'indexer' ? [nodes.pop()] : [];
|
|
9074
|
-
for (let
|
|
9075
|
-
if (typeof
|
|
9076
|
-
|
|
9077
|
+
for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[nodes.length - 1], -1);) {
|
|
9078
|
+
if (typeof node === 'object' && node.className === 'comment')
|
|
9079
|
+
break;
|
|
9080
|
+
if (typeof node === 'string') {
|
|
9081
|
+
const pos = node.trimEnd().length;
|
|
9077
9082
|
if (pos > 0) {
|
|
9078
|
-
nodes[nodes.length - 1] =
|
|
9083
|
+
nodes[nodes.length - 1] = node.slice(0, pos);
|
|
9079
9084
|
break;
|
|
9080
9085
|
}
|
|
9081
9086
|
}
|
package/package-lock.json
CHANGED
package/package.json
CHANGED
package/src/parser/util.ts
CHANGED
|
@@ -172,28 +172,19 @@ export function trimNode(nodes: (HTMLElement | string)[]): (HTMLElement | string
|
|
|
172
172
|
return trimNodeStart(trimNodeEnd(nodes));
|
|
173
173
|
}
|
|
174
174
|
function trimNodeStart(nodes: (HTMLElement | string)[]): (HTMLElement | string)[] {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
for (
|
|
181
|
-
let first = nodes[0];
|
|
182
|
-
nodes.length > 0 &&
|
|
183
|
-
!isVisible(first, 0) &&
|
|
184
|
-
!(typeof first === 'object' && first.className === 'comment');
|
|
185
|
-
) {
|
|
186
|
-
assert(nodes.length > 0);
|
|
187
|
-
if (typeof first === 'string') {
|
|
188
|
-
const pos = first.length - first.trimStart().length;
|
|
175
|
+
for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[0], 0);) {
|
|
176
|
+
if (nodes.length === 1 && typeof node === 'object' && node.className === 'indexer') break;
|
|
177
|
+
if (typeof node === 'object' && node.className === 'comment') break;
|
|
178
|
+
if (typeof node === 'string') {
|
|
179
|
+
const pos = node.length - node.trimStart().length;
|
|
189
180
|
if (pos > 0) {
|
|
190
|
-
nodes[0] =
|
|
181
|
+
nodes[0] = node.slice(pos);
|
|
191
182
|
break;
|
|
192
183
|
}
|
|
193
184
|
}
|
|
194
|
-
nodes.
|
|
185
|
+
nodes.shift();
|
|
195
186
|
}
|
|
196
|
-
return
|
|
187
|
+
return nodes;
|
|
197
188
|
}
|
|
198
189
|
export function trimNodeEnd(nodes: (HTMLElement | string)[]): (HTMLElement | string)[] {
|
|
199
190
|
const skip = nodes.length > 0 &&
|
|
@@ -201,17 +192,12 @@ export function trimNodeEnd(nodes: (HTMLElement | string)[]): (HTMLElement | str
|
|
|
201
192
|
nodes[nodes.length - 1]['className'] === 'indexer'
|
|
202
193
|
? [nodes.pop()!]
|
|
203
194
|
: [];
|
|
204
|
-
for (
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
!(typeof last === 'object' && last.className === 'comment');
|
|
209
|
-
) {
|
|
210
|
-
assert(nodes.length > 0);
|
|
211
|
-
if (typeof last === 'string') {
|
|
212
|
-
const pos = last.trimEnd().length;
|
|
195
|
+
for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[nodes.length - 1], -1);) {
|
|
196
|
+
if (typeof node === 'object' && node.className === 'comment') break;
|
|
197
|
+
if (typeof node === 'string') {
|
|
198
|
+
const pos = node.trimEnd().length;
|
|
213
199
|
if (pos > 0) {
|
|
214
|
-
nodes[nodes.length - 1] =
|
|
200
|
+
nodes[nodes.length - 1] = node.slice(0, pos);
|
|
215
201
|
break;
|
|
216
202
|
}
|
|
217
203
|
}
|