katex 0.16.22 → 0.16.24

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/dist/katex.mjs CHANGED
@@ -168,18 +168,10 @@ ParseError.prototype.__proto__ = Error.prototype;
168
168
  * files.
169
169
  */
170
170
 
171
- /**
172
- * Return whether an element is contained in a list
173
- */
174
- var contains = function contains(list, elem) {
175
- return list.indexOf(elem) !== -1;
176
- };
177
171
  /**
178
172
  * Provide a default value if a setting is undefined
179
173
  * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022.
180
174
  */
181
-
182
-
183
175
  var deflt = function deflt(setting, defaultIfUndefined) {
184
176
  return setting === undefined ? defaultIfUndefined : setting;
185
177
  }; // hyphenate and escape adapted from Facebook's React under Apache 2 license
@@ -284,7 +276,6 @@ var protocolFromUrl = function protocolFromUrl(url) {
284
276
  return protocol[1].toLowerCase();
285
277
  };
286
278
  var utils = {
287
- contains,
288
279
  deflt,
289
280
  escape,
290
281
  hyphenate,
@@ -1019,13 +1010,14 @@ var tallDelim = function tallDelim(label, midHeight) {
1019
1010
  }
1020
1011
  };
1021
1012
 
1013
+ // To ensure that all nodes have compatible signatures for these methods.
1014
+
1022
1015
  /**
1023
1016
  * This node represents a document fragment, which contains elements, but when
1024
1017
  * placed into the DOM doesn't have any representation itself. It only contains
1025
1018
  * children and doesn't have any DOM node properties.
1026
1019
  */
1027
1020
  class DocumentFragment {
1028
- // HtmlDomNode
1029
1021
  // Never used; needed for satisfying interface.
1030
1022
  constructor(children) {
1031
1023
  this.children = void 0;
@@ -1043,7 +1035,7 @@ class DocumentFragment {
1043
1035
  }
1044
1036
 
1045
1037
  hasClass(className) {
1046
- return utils.contains(this.classes, className);
1038
+ return this.classes.includes(className);
1047
1039
  }
1048
1040
  /** Convert the fragment into a node. */
1049
1041
 
@@ -4037,7 +4029,7 @@ class Span {
4037
4029
  }
4038
4030
 
4039
4031
  hasClass(className) {
4040
- return utils.contains(this.classes, className);
4032
+ return this.classes.includes(className);
4041
4033
  }
4042
4034
 
4043
4035
  toNode() {
@@ -4073,7 +4065,7 @@ class Anchor {
4073
4065
  }
4074
4066
 
4075
4067
  hasClass(className) {
4076
- return utils.contains(this.classes, className);
4068
+ return this.classes.includes(className);
4077
4069
  }
4078
4070
 
4079
4071
  toNode() {
@@ -4105,7 +4097,7 @@ class Img {
4105
4097
  }
4106
4098
 
4107
4099
  hasClass(className) {
4108
- return utils.contains(this.classes, className);
4100
+ return this.classes.includes(className);
4109
4101
  }
4110
4102
 
4111
4103
  toNode() {
@@ -4197,7 +4189,7 @@ class SymbolNode {
4197
4189
  }
4198
4190
 
4199
4191
  hasClass(className) {
4200
- return utils.contains(this.classes, className);
4192
+ return this.classes.includes(className);
4201
4193
  }
4202
4194
  /**
4203
4195
  * Creates a text node or span from a symbol node. Note that a span is only
@@ -6345,9 +6337,9 @@ var buildExpression$1 = function buildExpression(expression, options, isRealGrou
6345
6337
  var prevType = prev.classes[0];
6346
6338
  var type = node.classes[0];
6347
6339
 
6348
- if (prevType === "mbin" && utils.contains(binRightCanceller, type)) {
6340
+ if (prevType === "mbin" && binRightCanceller.includes(type)) {
6349
6341
  prev.classes[0] = "mord";
6350
- } else if (type === "mbin" && utils.contains(binLeftCanceller, prevType)) {
6342
+ } else if (type === "mbin" && binLeftCanceller.includes(prevType)) {
6351
6343
  node.classes[0] = "mord";
6352
6344
  }
6353
6345
  }, {
@@ -6957,7 +6949,7 @@ var getVariant = function getVariant(group, options) {
6957
6949
 
6958
6950
  var text = group.text;
6959
6951
 
6960
- if (utils.contains(["\\imath", "\\jmath"], text)) {
6952
+ if (["\\imath", "\\jmath"].includes(text)) {
6961
6953
  return null;
6962
6954
  }
6963
6955
 
@@ -7112,7 +7104,7 @@ function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly)
7112
7104
 
7113
7105
  var wrapper;
7114
7106
 
7115
- if (expression.length === 1 && expression[0] instanceof MathNode && utils.contains(["mrow", "mtable"], expression[0].type)) {
7107
+ if (expression.length === 1 && expression[0] instanceof MathNode && ["mrow", "mtable"].includes(expression[0].type)) {
7116
7108
  wrapper = expression[0];
7117
7109
  } else {
7118
7110
  wrapper = new mathMLTree.MathNode("mrow", expression);
@@ -7348,7 +7340,7 @@ var svgSpan = function svgSpan(group, options) {
7348
7340
 
7349
7341
  var label = group.label.slice(1);
7350
7342
 
7351
- if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], label)) {
7343
+ if (["widehat", "widecheck", "widetilde", "utilde"].includes(label)) {
7352
7344
  // Each type in the `if` statement corresponds to one of the ParseNode
7353
7345
  // types below. This narrowing is required to access `grp.base`.
7354
7346
  // $FlowFixMe
@@ -9147,11 +9139,11 @@ var makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, opt
9147
9139
  top = "\\Uparrow";
9148
9140
  repeat = "\u2016";
9149
9141
  bottom = "\\Downarrow";
9150
- } else if (utils.contains(verts, delim)) {
9142
+ } else if (verts.includes(delim)) {
9151
9143
  repeat = "\u2223";
9152
9144
  svgLabel = "vert";
9153
9145
  viewBoxWidth = 333;
9154
- } else if (utils.contains(doubleVerts, delim)) {
9146
+ } else if (doubleVerts.includes(delim)) {
9155
9147
  repeat = "\u2225";
9156
9148
  svgLabel = "doublevert";
9157
9149
  viewBoxWidth = 556;
@@ -9458,9 +9450,9 @@ var makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes
9458
9450
  } // Sized delimiters are never centered.
9459
9451
 
9460
9452
 
9461
- if (utils.contains(stackLargeDelimiters, delim) || utils.contains(stackNeverDelimiters, delim)) {
9453
+ if (stackLargeDelimiters.includes(delim) || stackNeverDelimiters.includes(delim)) {
9462
9454
  return makeLargeDelim(delim, size, false, options, mode, classes);
9463
- } else if (utils.contains(stackAlwaysDelimiters, delim)) {
9455
+ } else if (stackAlwaysDelimiters.includes(delim)) {
9464
9456
  return makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes);
9465
9457
  } else {
9466
9458
  throw new ParseError("Illegal delimiter: '" + delim + "'");
@@ -9610,9 +9602,9 @@ var makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center,
9610
9602
 
9611
9603
  var sequence;
9612
9604
 
9613
- if (utils.contains(stackNeverDelimiters, delim)) {
9605
+ if (stackNeverDelimiters.includes(delim)) {
9614
9606
  sequence = stackNeverDelimiterSequence;
9615
- } else if (utils.contains(stackLargeDelimiters, delim)) {
9607
+ } else if (stackLargeDelimiters.includes(delim)) {
9616
9608
  sequence = stackLargeDelimiterSequence;
9617
9609
  } else {
9618
9610
  sequence = stackAlwaysDelimiterSequence;
@@ -9742,7 +9734,7 @@ var delimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbr
9742
9734
  function checkDelimiter(delim, context) {
9743
9735
  var symDelim = checkSymbolNodeType(delim);
9744
9736
 
9745
- if (symDelim && utils.contains(delimiters, symDelim.text)) {
9737
+ if (symDelim && delimiters.includes(symDelim.text)) {
9746
9738
  return symDelim;
9747
9739
  } else if (symDelim) {
9748
9740
  throw new ParseError("Invalid delimiter '" + symDelim.text + "' after '" + context.funcName + "'", delim);
@@ -11435,7 +11427,7 @@ defineEnvironment({
11435
11427
  },
11436
11428
 
11437
11429
  handler(context) {
11438
- if (utils.contains(["gather", "gather*"], context.envName)) {
11430
+ if (["gather", "gather*"].includes(context.envName)) {
11439
11431
  validateAmsEnvironmentContext(context);
11440
11432
  }
11441
11433
 
@@ -13177,7 +13169,7 @@ var htmlBuilder$2 = (grp, options) => {
13177
13169
  var style = options.style;
13178
13170
  var large = false;
13179
13171
 
13180
- if (style.size === Style$1.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) {
13172
+ if (style.size === Style$1.DISPLAY.size && group.symbol && !noSuccessor.includes(group.name)) {
13181
13173
  // Most symbol operators get larger in displaystyle (rule 13)
13182
13174
  large = true;
13183
13175
  }
@@ -13278,7 +13270,7 @@ var mathmlBuilder$1 = (group, options) => {
13278
13270
  // This is a symbol. Just add the symbol.
13279
13271
  node = new MathNode("mo", [makeText(group.name, group.mode)]);
13280
13272
 
13281
- if (utils.contains(noSuccessor, group.name)) {
13273
+ if (noSuccessor.includes(group.name)) {
13282
13274
  node.setAttribute("largeop", "false");
13283
13275
  }
13284
13276
  } else if (group.body) {
@@ -15669,7 +15661,7 @@ defineMacro("\\dots", function (context) {
15669
15661
  } else if (next.slice(0, 4) === '\\not') {
15670
15662
  thedots = '\\dotsb';
15671
15663
  } else if (next in symbols.math) {
15672
- if (utils.contains(['bin', 'rel'], symbols.math[next].group)) {
15664
+ if (['bin', 'rel'].includes(symbols.math[next].group)) {
15673
15665
  thedots = '\\dotsb';
15674
15666
  }
15675
15667
  }
@@ -16314,7 +16306,7 @@ class MacroExpander {
16314
16306
 
16315
16307
  this.pushToken(new Token("EOF", end.loc));
16316
16308
  this.pushTokens(tokens);
16317
- return start.range(end, "");
16309
+ return new Token("", SourceLocation.range(start, end));
16318
16310
  }
16319
16311
  /**
16320
16312
  * Consume all following space tokens, without expansion.
@@ -17915,7 +17907,7 @@ class Parser {
17915
17907
  return null;
17916
17908
  }
17917
17909
 
17918
- var match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text);
17910
+ var match = /^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(res.text);
17919
17911
 
17920
17912
  if (!match) {
17921
17913
  throw new ParseError("Invalid color: '" + res.text + "'", res);
@@ -18445,7 +18437,7 @@ var renderToHTMLTree = function renderToHTMLTree(expression, options) {
18445
18437
  }
18446
18438
  };
18447
18439
 
18448
- var version = "0.16.22";
18440
+ var version = "0.16.24";
18449
18441
  var __domTree = {
18450
18442
  Span,
18451
18443
  Anchor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "katex",
3
- "version": "0.16.22",
3
+ "version": "0.16.24",
4
4
  "description": "Fast math typesetting for the web.",
5
5
  "main": "dist/katex.js",
6
6
  "exports": {
@@ -10,6 +10,7 @@ import Lexer from "./Lexer";
10
10
  import {Token} from "./Token";
11
11
  import type {Mode} from "./types";
12
12
  import ParseError from "./ParseError";
13
+ import SourceLocation from "./SourceLocation";
13
14
  import Namespace from "./Namespace";
14
15
  import macros from "./macros";
15
16
 
@@ -138,7 +139,7 @@ export default class MacroExpander implements MacroContextInterface {
138
139
  this.pushToken(new Token("EOF", end.loc));
139
140
 
140
141
  this.pushTokens(tokens);
141
- return start.range(end, "");
142
+ return new Token("", SourceLocation.range(start, end));
142
143
  }
143
144
 
144
145
  /**
package/src/Parser.js CHANGED
@@ -680,7 +680,9 @@ export default class Parser {
680
680
  if (res == null) {
681
681
  return null;
682
682
  }
683
- const match = (/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i).exec(res.text);
683
+ const match = (
684
+ /^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i
685
+ ).exec(res.text);
684
686
  if (!match) {
685
687
  throw new ParseError("Invalid color: '" + res.text + "'", res);
686
688
  }
package/src/buildHTML.js CHANGED
@@ -10,7 +10,6 @@ import ParseError from "./ParseError";
10
10
  import Style from "./Style";
11
11
  import buildCommon from "./buildCommon";
12
12
  import {Span, Anchor} from "./domTree";
13
- import utils from "./utils";
14
13
  import {makeEm} from "./units";
15
14
  import {spacings, tightSpacings} from "./spacingData";
16
15
  import {_htmlGroupBuilders as groupBuilders} from "./defineFunction";
@@ -110,9 +109,9 @@ export const buildExpression = function(
110
109
  traverseNonSpaceNodes(groups, (node, prev) => {
111
110
  const prevType = prev.classes[0];
112
111
  const type = node.classes[0];
113
- if (prevType === "mbin" && utils.contains(binRightCanceller, type)) {
112
+ if (prevType === "mbin" && binRightCanceller.includes(type)) {
114
113
  prev.classes[0] = "mord";
115
- } else if (type === "mbin" && utils.contains(binLeftCanceller, prevType)) {
114
+ } else if (type === "mbin" && binLeftCanceller.includes(prevType)) {
116
115
  node.classes[0] = "mord";
117
116
  }
118
117
  }, {node: dummyPrev}, dummyNext, isRoot);
@@ -10,7 +10,6 @@ import {getCharacterMetrics} from "./fontMetrics";
10
10
  import mathMLTree from "./mathMLTree";
11
11
  import ParseError from "./ParseError";
12
12
  import symbols, {ligatures} from "./symbols";
13
- import utils from "./utils";
14
13
  import {_mathmlGroupBuilders as groupBuilders} from "./defineFunction";
15
14
  import {MathNode, TextNode} from "./mathMLTree";
16
15
 
@@ -112,7 +111,7 @@ export const getVariant = function(
112
111
  }
113
112
 
114
113
  let text = group.text;
115
- if (utils.contains(["\\imath", "\\jmath"], text)) {
114
+ if (["\\imath", "\\jmath"].includes(text)) {
116
115
  return null;
117
116
  }
118
117
 
@@ -291,7 +290,7 @@ export default function buildMathML(
291
290
  // tag correctly, unless it's a single <mrow> or <mtable>.
292
291
  let wrapper;
293
292
  if (expression.length === 1 && expression[0] instanceof MathNode &&
294
- utils.contains(["mrow", "mtable"], expression[0].type)) {
293
+ ["mrow", "mtable"].includes(expression[0].type)) {
295
294
  wrapper = expression[0];
296
295
  } else {
297
296
  wrapper = new mathMLTree.MathNode("mrow", expression);
package/src/delimiter.js CHANGED
@@ -29,7 +29,6 @@ import {sqrtPath, innerPath, tallDelim} from "./svgGeometry";
29
29
  import buildCommon from "./buildCommon";
30
30
  import {getCharacterMetrics} from "./fontMetrics";
31
31
  import symbols from "./symbols";
32
- import utils from "./utils";
33
32
  import {makeEm} from "./units";
34
33
  import fontMetricsData from "./fontMetricsData";
35
34
 
@@ -255,11 +254,11 @@ const makeStackedDelim = function(
255
254
  top = "\\Uparrow";
256
255
  repeat = "\u2016";
257
256
  bottom = "\\Downarrow";
258
- } else if (utils.contains(verts, delim)) {
257
+ } else if (verts.includes(delim)) {
259
258
  repeat = "\u2223";
260
259
  svgLabel = "vert";
261
260
  viewBoxWidth = 333;
262
- } else if (utils.contains(doubleVerts, delim)) {
261
+ } else if (doubleVerts.includes(delim)) {
263
262
  repeat = "\u2225";
264
263
  svgLabel = "doublevert";
265
264
  viewBoxWidth = 556;
@@ -621,10 +620,10 @@ const makeSizedDelim = function(
621
620
  }
622
621
 
623
622
  // Sized delimiters are never centered.
624
- if (utils.contains(stackLargeDelimiters, delim) ||
625
- utils.contains(stackNeverDelimiters, delim)) {
623
+ if (stackLargeDelimiters.includes(delim) ||
624
+ stackNeverDelimiters.includes(delim)) {
626
625
  return makeLargeDelim(delim, size, false, options, mode, classes);
627
- } else if (utils.contains(stackAlwaysDelimiters, delim)) {
626
+ } else if (stackAlwaysDelimiters.includes(delim)) {
628
627
  return makeStackedDelim(
629
628
  delim, sizeToMaxHeight[size], false, options, mode, classes);
630
629
  } else {
@@ -759,9 +758,9 @@ const makeCustomSizedDelim = function(
759
758
 
760
759
  // Decide what sequence to use
761
760
  let sequence;
762
- if (utils.contains(stackNeverDelimiters, delim)) {
761
+ if (stackNeverDelimiters.includes(delim)) {
763
762
  sequence = stackNeverDelimiterSequence;
764
- } else if (utils.contains(stackLargeDelimiters, delim)) {
763
+ } else if (stackLargeDelimiters.includes(delim)) {
765
764
  sequence = stackLargeDelimiterSequence;
766
765
  } else {
767
766
  sequence = stackAlwaysDelimiterSequence;
package/src/domTree.js CHANGED
@@ -231,7 +231,7 @@ export class Span<ChildType: VirtualNode> implements HtmlDomNode {
231
231
  }
232
232
 
233
233
  hasClass(className: string): boolean {
234
- return utils.contains(this.classes, className);
234
+ return this.classes.includes(className);
235
235
  }
236
236
 
237
237
  toNode(): HTMLElement {
@@ -272,7 +272,7 @@ export class Anchor implements HtmlDomNode {
272
272
  }
273
273
 
274
274
  hasClass(className: string): boolean {
275
- return utils.contains(this.classes, className);
275
+ return this.classes.includes(className);
276
276
  }
277
277
 
278
278
  toNode(): HTMLElement {
@@ -308,7 +308,7 @@ export class Img implements VirtualNode {
308
308
  }
309
309
 
310
310
  hasClass(className: string): boolean {
311
- return utils.contains(this.classes, className);
311
+ return this.classes.includes(className);
312
312
  }
313
313
 
314
314
  toNode(): Node {
@@ -410,7 +410,7 @@ export class SymbolNode implements HtmlDomNode {
410
410
  }
411
411
 
412
412
  hasClass(className: string): boolean {
413
- return utils.contains(this.classes, className);
413
+ return this.classes.includes(className);
414
414
  }
415
415
 
416
416
  /**
@@ -1030,7 +1030,7 @@ defineEnvironment({
1030
1030
  numArgs: 0,
1031
1031
  },
1032
1032
  handler(context) {
1033
- if (utils.contains(["gather", "gather*"], context.envName)) {
1033
+ if (["gather", "gather*"].includes(context.envName)) {
1034
1034
  validateAmsEnvironmentContext(context);
1035
1035
  }
1036
1036
  const res = {
@@ -4,7 +4,6 @@ import defineFunction from "../defineFunction";
4
4
  import delimiter from "../delimiter";
5
5
  import mathMLTree from "../mathMLTree";
6
6
  import ParseError from "../ParseError";
7
- import utils from "../utils";
8
7
  import {assertNodeType, checkSymbolNodeType} from "../parseNode";
9
8
  import {makeEm} from "../units";
10
9
 
@@ -61,7 +60,7 @@ function checkDelimiter(
61
60
  context: FunctionContext,
62
61
  ): SymbolParseNode {
63
62
  const symDelim = checkSymbolNodeType(delim);
64
- if (symDelim && utils.contains(delimiters, symDelim.text)) {
63
+ if (symDelim && delimiters.includes(symDelim.text)) {
65
64
  return symDelim;
66
65
  } else if (symDelim) {
67
66
  throw new ParseError(
@@ -4,7 +4,6 @@ import defineFunction, {ordargument} from "../defineFunction";
4
4
  import buildCommon from "../buildCommon";
5
5
  import {SymbolNode} from "../domTree";
6
6
  import * as mathMLTree from "../mathMLTree";
7
- import utils from "../utils";
8
7
  import Style from "../Style";
9
8
  import {assembleSupSub} from "./utils/assembleSupSub";
10
9
  import {assertNodeType} from "../parseNode";
@@ -46,7 +45,7 @@ export const htmlBuilder: HtmlBuilderSupSub<"op"> = (grp, options) => {
46
45
  let large = false;
47
46
  if (style.size === Style.DISPLAY.size &&
48
47
  group.symbol &&
49
- !utils.contains(noSuccessor, group.name)) {
48
+ !noSuccessor.includes(group.name)) {
50
49
 
51
50
  // Most symbol operators get larger in displaystyle (rule 13)
52
51
  large = true;
@@ -147,7 +146,7 @@ const mathmlBuilder: MathMLBuilder<"op"> = (group, options) => {
147
146
  // This is a symbol. Just add the symbol.
148
147
  node = new mathMLTree.MathNode(
149
148
  "mo", [mml.makeText(group.name, group.mode)]);
150
- if (utils.contains(noSuccessor, group.name)) {
149
+ if (noSuccessor.includes(group.name)) {
151
150
  node.setAttribute("largeop", "false");
152
151
  }
153
152
  } else if (group.body) {
package/src/macros.js CHANGED
@@ -12,7 +12,6 @@ export default macros;
12
12
  import fontMetricsData from "./fontMetricsData";
13
13
  import functions from "./functions";
14
14
  import symbols from "./symbols";
15
- import utils from "./utils";
16
15
  import {makeEm} from "./units";
17
16
  import ParseError from "./ParseError";
18
17
 
@@ -463,7 +462,7 @@ defineMacro("\\dots", function(context) {
463
462
  } else if (next.slice(0, 4) === '\\not') {
464
463
  thedots = '\\dotsb';
465
464
  } else if (next in symbols.math) {
466
- if (utils.contains(['bin', 'rel'], symbols.math[next].group)) {
465
+ if (['bin', 'rel'].includes(symbols.math[next].group)) {
467
466
  thedots = '\\dotsb';
468
467
  }
469
468
  }
package/src/stretchy.js CHANGED
@@ -8,7 +8,6 @@
8
8
  import {LineNode, PathNode, SvgNode} from "./domTree";
9
9
  import buildCommon from "./buildCommon";
10
10
  import mathMLTree from "./mathMLTree";
11
- import utils from "./utils";
12
11
  import {makeEm} from "./units";
13
12
 
14
13
  import type Options from "./Options";
@@ -192,8 +191,7 @@ const svgSpan = function(
192
191
  } {
193
192
  let viewBoxWidth = 400000; // default
194
193
  const label = group.label.slice(1);
195
- if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"],
196
- label)) {
194
+ if (["widehat", "widecheck", "widetilde", "utilde"].includes(label)) {
197
195
  // Each type in the `if` statement corresponds to one of the ParseNode
198
196
  // types below. This narrowing is required to access `grp.base`.
199
197
  // $FlowFixMe
package/src/tree.js CHANGED
@@ -1,7 +1,5 @@
1
1
  // @flow
2
2
 
3
- import utils from "./utils";
4
-
5
3
  import type {CssStyle, HtmlDomNode} from "./domTree";
6
4
  import type {MathDomNode} from "./mathMLTree";
7
5
 
@@ -21,7 +19,6 @@ export interface VirtualNode {
21
19
  export class DocumentFragment<ChildType: VirtualNode>
22
20
  implements HtmlDomNode, MathDomNode {
23
21
  children: $ReadOnlyArray<ChildType>;
24
- // HtmlDomNode
25
22
  classes: string[];
26
23
  height: number;
27
24
  depth: number;
@@ -38,7 +35,7 @@ export class DocumentFragment<ChildType: VirtualNode>
38
35
  }
39
36
 
40
37
  hasClass(className: string): boolean {
41
- return utils.contains(this.classes, className);
38
+ return this.classes.includes(className);
42
39
  }
43
40
 
44
41
  /** Convert the fragment into a node. */
package/src/utils.js CHANGED
@@ -6,13 +6,6 @@
6
6
 
7
7
  import type {AnyParseNode} from "./parseNode";
8
8
 
9
- /**
10
- * Return whether an element is contained in a list
11
- */
12
- const contains = function<T>(list: Array<T>, elem: T): boolean {
13
- return list.indexOf(elem) !== -1;
14
- };
15
-
16
9
  /**
17
10
  * Provide a default value if a setting is undefined
18
11
  * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022.
@@ -120,7 +113,6 @@ export const protocolFromUrl = function(url: string): string | null {
120
113
  };
121
114
 
122
115
  export default {
123
- contains,
124
116
  deflt,
125
117
  escape,
126
118
  hyphenate,