securemark 0.261.1 → 0.261.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.261.1",
3
+ "version": "0.261.2",
4
4
  "description": "Secure markdown renderer working on browsers for user input data.",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/falsandtru/securemark",
@@ -28,17 +28,17 @@
28
28
  "LICENSE"
29
29
  ],
30
30
  "devDependencies": {
31
- "@types/dompurify": "2.3.3",
31
+ "@types/dompurify": "2.3.4",
32
32
  "@types/jquery": "3.5.14",
33
33
  "@types/mathjax": "0.0.37",
34
34
  "@types/mocha": "9.1.1",
35
35
  "@types/power-assert": "1.5.8",
36
36
  "@types/prismjs": "1.26.0",
37
- "@typescript-eslint/parser": "^5.33.1",
37
+ "@typescript-eslint/parser": "^5.36.2",
38
38
  "babel-loader": "^8.2.5",
39
39
  "babel-plugin-unassert": "^3.2.0",
40
- "concurrently": "^7.3.0",
41
- "eslint": "^8.22.0",
40
+ "concurrently": "^7.4.0",
41
+ "eslint": "^8.23.0",
42
42
  "eslint-plugin-redos": "^4.4.1",
43
43
  "eslint-webpack-plugin": "^3.2.0",
44
44
  "glob": "^8.0.3",
@@ -49,12 +49,12 @@
49
49
  "karma-mocha": "^2.0.1",
50
50
  "karma-power-assert": "^1.0.0",
51
51
  "mocha": "^10.0.0",
52
- "npm-check-updates": "^16.0.5",
52
+ "npm-check-updates": "^16.1.1",
53
53
  "semver": "^7.3.7",
54
- "spica": "0.0.591",
54
+ "spica": "0.0.622",
55
55
  "ts-loader": "^9.3.1",
56
- "typed-dom": "^0.0.301",
57
- "typescript": "4.7.4",
56
+ "typed-dom": "^0.0.305",
57
+ "typescript": "4.8.3",
58
58
  "webpack": "^5.74.0",
59
59
  "webpack-cli": "^4.10.0",
60
60
  "webpack-merge": "^5.8.0"
package/src/debug.test.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Result, eval, exec } from './combinator/data/parser';
2
2
  import { html, define } from 'typed-dom/dom';
3
- import { querySelector, querySelectorAll } from 'typed-dom/query';
3
+ import { querySelectorWith, querySelectorAllWith } from 'typed-dom/query';
4
4
 
5
5
  export function inspect(result: Result<HTMLElement | string>, until: number | string = Infinity): Result<string> {
6
6
  return result && [
@@ -8,8 +8,8 @@ export function inspect(result: Result<HTMLElement | string>, until: number | st
8
8
  assert(node || node === '' && '([{'.includes(nodes[i + 1][0]));
9
9
  if (typeof node === 'string') return node;
10
10
  node = node.cloneNode(true);
11
- assert(!querySelector(node, '.invalid[data-invalid-message$="."]'));
12
- querySelectorAll(node, '.invalid').forEach(el => {
11
+ assert(!querySelectorWith(node, '.invalid[data-invalid-message$="."]'));
12
+ querySelectorAllWith(node, '.invalid').forEach(el => {
13
13
  assert(el.matches('[data-invalid-syntax][data-invalid-type][data-invalid-message]'));
14
14
  define(el, {
15
15
  'data-invalid-syntax': null,
@@ -10,7 +10,6 @@ import { State } from '../context';
10
10
  import { trimBlank } from '../visibility';
11
11
  import { html, define, defrag } from 'typed-dom/dom';
12
12
  import { memoize } from 'spica/memoize';
13
- import { duffbk } from 'spica/duff';
14
13
  import { shift } from 'spica/array';
15
14
 
16
15
  const openers = {
@@ -124,16 +123,15 @@ function format(el: HTMLOListElement, type: string, form: string): HTMLOListElem
124
123
  'data-type': style(type) || undefined,
125
124
  });
126
125
  const marker = el.firstElementChild?.getAttribute('data-marker')!.match(initial(type))?.[0] ?? '';
127
- const es = el.children;
128
- duffbk(es.length, i => {
126
+ for (let es = el.children, len = es.length, i = 0; i < len; ++i) {
129
127
  const el = es[i];
130
128
  switch (el.getAttribute('data-marker')) {
131
129
  case '':
132
130
  case marker:
133
131
  el.removeAttribute('data-marker');
134
- return;
132
+ continue;
135
133
  }
136
- return false;
137
- });
134
+ break;
135
+ }
138
136
  return el;
139
137
  }
@@ -141,7 +141,8 @@ export function* figure(
141
141
  }
142
142
  labels.add(label);
143
143
  opts.id !== '' && def.setAttribute('id', `label:${opts.id ? `${opts.id}:` : ''}${label}`);
144
- for (const ref of refs.take(label, Infinity)) {
144
+ for (let rs = refs.take(label, Infinity), i = 0; i < rs.length; ++i) {
145
+ const ref = rs[i];
145
146
  if (ref.getAttribute('data-invalid-message') === messages.reference) {
146
147
  define(ref, {
147
148
  class: void ref.classList.remove('invalid'),
@@ -114,7 +114,8 @@ function build(
114
114
  if (title && !blank && def.childNodes.length === 1) {
115
115
  def.insertBefore(content.cloneNode(true), def.lastChild);
116
116
  assert(def.childNodes.length > 1);
117
- for (const ref of buffer.take(identifier, Infinity)) {
117
+ for (let refs = buffer.take(identifier, Infinity), i = 0; i < refs.length; ++i) {
118
+ const ref = refs[i];
118
119
  if (ref.getAttribute('data-invalid-type') !== 'content') continue;
119
120
  define(ref, {
120
121
  title,
@@ -3,7 +3,7 @@ import { RenderingOptions } from '../../';
3
3
  import { code } from './render/code';
4
4
  import { math } from './render/math';
5
5
  import { media } from './render/media';
6
- import { querySelectorAll } from 'typed-dom/query';
6
+ import { querySelectorAllWith } from 'typed-dom/query';
7
7
  import { reduce } from 'spica/memoize';
8
8
 
9
9
  const selector = 'img.media:not(.invalid):not([src])[data-src], a > :not(img).media:not(.invalid), pre.code:not(.invalid), .math:not(.invalid)';
@@ -14,8 +14,8 @@ const extend = reduce((opts: RenderingOptions): RenderingOptions =>
14
14
  export function render(source: HTMLElement, opts: RenderingOptions = {}): void {
15
15
  opts = extend(opts);
16
16
  const base = location.href;
17
- for (const el of querySelectorAll<HTMLElement>(source, selector)) {
18
- render_(base, el, opts);
17
+ for (let es = querySelectorAllWith<HTMLElement>(source, selector), i = 0; i < es.length; ++i) {
18
+ render_(base, es[i], opts);
19
19
  }
20
20
  }
21
21