Fix remaining linting errors, from enabling the prefer-const
ESLint rule globally
This covers cases that the `--fix` command couldn't deal with, and in a few cases (notably `src/core/jbig2.js`) the code was changed to use block-scoped variables instead.
This commit is contained in:
parent
9e262ae7fa
commit
83bdb525a4
@ -240,8 +240,8 @@ class CMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mapBfRangeToArray(low, high, array) {
|
mapBfRangeToArray(low, high, array) {
|
||||||
let i = 0,
|
const ii = array.length;
|
||||||
ii = array.length;
|
let i = 0;
|
||||||
while (low <= high && i < ii) {
|
while (low <= high && i < ii) {
|
||||||
this._map[low] = array[i++];
|
this._map[low] = array[i++];
|
||||||
++low;
|
++low;
|
||||||
|
@ -110,8 +110,8 @@ function toRomanNumerals(number, lowerCase = false) {
|
|||||||
Number.isInteger(number) && number > 0,
|
Number.isInteger(number) && number > 0,
|
||||||
"The number should be a positive integer."
|
"The number should be a positive integer."
|
||||||
);
|
);
|
||||||
let pos,
|
const romanBuf = [];
|
||||||
romanBuf = [];
|
let pos;
|
||||||
// Thousands
|
// Thousands
|
||||||
while (number >= 1000) {
|
while (number >= 1000) {
|
||||||
number -= 1000;
|
number -= 1000;
|
||||||
|
@ -996,8 +996,8 @@ class AESBaseCipher {
|
|||||||
const sourceLength = data.length;
|
const sourceLength = data.length;
|
||||||
let buffer = this.buffer,
|
let buffer = this.buffer,
|
||||||
bufferLength = this.bufferPosition;
|
bufferLength = this.bufferPosition;
|
||||||
let result = [],
|
const result = [];
|
||||||
iv = this.iv;
|
let iv = this.iv;
|
||||||
|
|
||||||
for (let i = 0; i < sourceLength; ++i) {
|
for (let i = 0; i < sourceLength; ++i) {
|
||||||
buffer[bufferLength] = data[i];
|
buffer[bufferLength] = data[i];
|
||||||
@ -1050,8 +1050,8 @@ class AESBaseCipher {
|
|||||||
|
|
||||||
decryptBlock(data, finalize, iv = null) {
|
decryptBlock(data, finalize, iv = null) {
|
||||||
const sourceLength = data.length;
|
const sourceLength = data.length;
|
||||||
let buffer = this.buffer,
|
const buffer = this.buffer;
|
||||||
bufferLength = this.bufferPosition;
|
let bufferLength = this.bufferPosition;
|
||||||
// If an IV is not supplied, wait for IV values. They are at the start
|
// If an IV is not supplied, wait for IV values. They are at the start
|
||||||
// of the stream.
|
// of the stream.
|
||||||
if (iv) {
|
if (iv) {
|
||||||
|
@ -2284,8 +2284,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
baseDict,
|
baseDict,
|
||||||
properties
|
properties
|
||||||
) {
|
) {
|
||||||
let xref = this.xref,
|
const xref = this.xref;
|
||||||
cidToGidBytes;
|
let cidToGidBytes;
|
||||||
// 9.10.2
|
// 9.10.2
|
||||||
var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
|
var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
|
||||||
var toUnicodePromise = toUnicode
|
var toUnicodePromise = toUnicode
|
||||||
@ -2413,15 +2413,13 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
_buildSimpleFontToUnicode(properties, forceGlyphs = false) {
|
_buildSimpleFontToUnicode(properties, forceGlyphs = false) {
|
||||||
assert(!properties.composite, "Must be a simple font.");
|
assert(!properties.composite, "Must be a simple font.");
|
||||||
|
|
||||||
let toUnicode = [],
|
const toUnicode = [];
|
||||||
charcode,
|
|
||||||
glyphName;
|
|
||||||
const encoding = properties.defaultEncoding.slice();
|
const encoding = properties.defaultEncoding.slice();
|
||||||
const baseEncodingName = properties.baseEncodingName;
|
const baseEncodingName = properties.baseEncodingName;
|
||||||
// Merge in the differences array.
|
// Merge in the differences array.
|
||||||
const differences = properties.differences;
|
const differences = properties.differences;
|
||||||
for (charcode in differences) {
|
for (const charcode in differences) {
|
||||||
glyphName = differences[charcode];
|
const glyphName = differences[charcode];
|
||||||
if (glyphName === ".notdef") {
|
if (glyphName === ".notdef") {
|
||||||
// Skip .notdef to prevent rendering errors, e.g. boxes appearing
|
// Skip .notdef to prevent rendering errors, e.g. boxes appearing
|
||||||
// where there should be spaces (fixes issue5256.pdf).
|
// where there should be spaces (fixes issue5256.pdf).
|
||||||
@ -2430,9 +2428,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
encoding[charcode] = glyphName;
|
encoding[charcode] = glyphName;
|
||||||
}
|
}
|
||||||
const glyphsUnicodeMap = getGlyphsUnicode();
|
const glyphsUnicodeMap = getGlyphsUnicode();
|
||||||
for (charcode in encoding) {
|
for (const charcode in encoding) {
|
||||||
// a) Map the character code to a character name.
|
// a) Map the character code to a character name.
|
||||||
glyphName = encoding[charcode];
|
let glyphName = encoding[charcode];
|
||||||
// b) Look up the character name in the Adobe Glyph List (see the
|
// b) Look up the character name in the Adobe Glyph List (see the
|
||||||
// Bibliography) to obtain the corresponding Unicode value.
|
// Bibliography) to obtain the corresponding Unicode value.
|
||||||
if (glyphName === "") {
|
if (glyphName === "") {
|
||||||
|
@ -427,8 +427,8 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
|||||||
if (font.isCFFCIDFont) {
|
if (font.isCFFCIDFont) {
|
||||||
const fdIndex = font.fdSelect.getFDIndex(glyphId);
|
const fdIndex = font.fdSelect.getFDIndex(glyphId);
|
||||||
if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
|
if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
|
||||||
let fontDict = font.fdArray[fdIndex],
|
const fontDict = font.fdArray[fdIndex];
|
||||||
subrs;
|
let subrs;
|
||||||
if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
|
if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
|
||||||
subrs = fontDict.privateDict.subrsIndex.objects;
|
subrs = fontDict.privateDict.subrsIndex.objects;
|
||||||
}
|
}
|
||||||
|
@ -987,21 +987,15 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
decodingContext
|
decodingContext
|
||||||
);
|
);
|
||||||
// Divide collective bitmap into patterns.
|
// Divide collective bitmap into patterns.
|
||||||
let patterns = [],
|
const patterns = [];
|
||||||
i = 0,
|
for (let i = 0; i <= maxPatternIndex; i++) {
|
||||||
patternBitmap,
|
const patternBitmap = [];
|
||||||
xMin,
|
const xMin = patternWidth * i;
|
||||||
xMax,
|
const xMax = xMin + patternWidth;
|
||||||
y;
|
for (let y = 0; y < patternHeight; y++) {
|
||||||
while (i <= maxPatternIndex) {
|
|
||||||
patternBitmap = [];
|
|
||||||
xMin = patternWidth * i;
|
|
||||||
xMax = xMin + patternWidth;
|
|
||||||
for (y = 0; y < patternHeight; y++) {
|
|
||||||
patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
|
patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
|
||||||
}
|
}
|
||||||
patterns.push(patternBitmap);
|
patterns.push(patternBitmap);
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
return patterns;
|
return patterns;
|
||||||
}
|
}
|
||||||
@ -1075,9 +1069,8 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Annex C. Gray-scale Image Decoding Procedure.
|
// Annex C. Gray-scale Image Decoding Procedure.
|
||||||
let grayScaleBitPlanes = [],
|
const grayScaleBitPlanes = [];
|
||||||
mmrInput,
|
let mmrInput, bitmap;
|
||||||
bitmap;
|
|
||||||
if (mmr) {
|
if (mmr) {
|
||||||
// MMR bit planes are in one continuous stream. Only EOFB codes indicate
|
// MMR bit planes are in one continuous stream. Only EOFB codes indicate
|
||||||
// the end of each bitmap, so EOFBs must be decoded.
|
// the end of each bitmap, so EOFBs must be decoded.
|
||||||
@ -1523,8 +1516,8 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function parseJbig2(data) {
|
function parseJbig2(data) {
|
||||||
let position = 0,
|
const end = data.length;
|
||||||
end = data.length;
|
let position = 0;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
data[position] !== 0x97 ||
|
data[position] !== 0x97 ||
|
||||||
@ -1899,11 +1892,8 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
}
|
}
|
||||||
// Create Huffman tree.
|
// Create Huffman tree.
|
||||||
this.rootNode = new HuffmanTreeNode(null);
|
this.rootNode = new HuffmanTreeNode(null);
|
||||||
let i,
|
for (let i = 0, ii = lines.length; i < ii; i++) {
|
||||||
ii = lines.length,
|
const line = lines[i];
|
||||||
line;
|
|
||||||
for (i = 0; i < ii; i++) {
|
|
||||||
line = lines[i];
|
|
||||||
if (line.prefixLength > 0) {
|
if (line.prefixLength > 0) {
|
||||||
this.rootNode.buildTree(line, line.prefixLength - 1);
|
this.rootNode.buildTree(line, line.prefixLength - 1);
|
||||||
}
|
}
|
||||||
@ -1916,15 +1906,14 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
},
|
},
|
||||||
assignPrefixCodes(lines) {
|
assignPrefixCodes(lines) {
|
||||||
// Annex B.3 Assigning the prefix codes.
|
// Annex B.3 Assigning the prefix codes.
|
||||||
let linesLength = lines.length,
|
const linesLength = lines.length;
|
||||||
prefixLengthMax = 0,
|
let prefixLengthMax = 0;
|
||||||
i;
|
for (let i = 0; i < linesLength; i++) {
|
||||||
for (i = 0; i < linesLength; i++) {
|
|
||||||
prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
|
prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
const histogram = new Uint32Array(prefixLengthMax + 1);
|
const histogram = new Uint32Array(prefixLengthMax + 1);
|
||||||
for (i = 0; i < linesLength; i++) {
|
for (let i = 0; i < linesLength; i++) {
|
||||||
histogram[lines[i].prefixLength]++;
|
histogram[lines[i].prefixLength]++;
|
||||||
}
|
}
|
||||||
let currentLength = 1,
|
let currentLength = 1,
|
||||||
@ -2253,9 +2242,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
throw new Jbig2Error(`standard table B.${number} does not exist`);
|
throw new Jbig2Error(`standard table B.${number} does not exist`);
|
||||||
}
|
}
|
||||||
|
|
||||||
let length = lines.length,
|
for (let i = 0, ii = lines.length; i < ii; i++) {
|
||||||
i;
|
|
||||||
for (i = 0; i < length; i++) {
|
|
||||||
lines[i] = new HuffmanLine(lines[i]);
|
lines[i] = new HuffmanLine(lines[i]);
|
||||||
}
|
}
|
||||||
table = new HuffmanTable(lines, true);
|
table = new HuffmanTable(lines, true);
|
||||||
@ -2310,12 +2297,9 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
function getCustomHuffmanTable(index, referredTo, customTables) {
|
function getCustomHuffmanTable(index, referredTo, customTables) {
|
||||||
// Returns a Tables segment that has been earlier decoded.
|
// Returns a Tables segment that has been earlier decoded.
|
||||||
// See 7.4.2.1.6 (symbol dictionary) or 7.4.3.1.6 (text region).
|
// See 7.4.2.1.6 (symbol dictionary) or 7.4.3.1.6 (text region).
|
||||||
let currentIndex = 0,
|
let currentIndex = 0;
|
||||||
i,
|
for (let i = 0, ii = referredTo.length; i < ii; i++) {
|
||||||
ii = referredTo.length,
|
const table = customTables[referredTo[i]];
|
||||||
table;
|
|
||||||
for (i = 0; i < ii; i++) {
|
|
||||||
table = customTables[referredTo[i]];
|
|
||||||
if (table) {
|
if (table) {
|
||||||
if (index === currentIndex) {
|
if (index === currentIndex) {
|
||||||
return table;
|
return table;
|
||||||
@ -2336,11 +2320,9 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
// 7.4.3.1.7 Symbol ID Huffman table decoding
|
// 7.4.3.1.7 Symbol ID Huffman table decoding
|
||||||
|
|
||||||
// Read code lengths for RUNCODEs 0...34.
|
// Read code lengths for RUNCODEs 0...34.
|
||||||
let codes = [],
|
const codes = [];
|
||||||
i,
|
for (let i = 0; i <= 34; i++) {
|
||||||
codeLength;
|
const codeLength = reader.readBits(4);
|
||||||
for (i = 0; i <= 34; i++) {
|
|
||||||
codeLength = reader.readBits(4);
|
|
||||||
codes.push(new HuffmanLine([i, codeLength, 0, 0]));
|
codes.push(new HuffmanLine([i, codeLength, 0, 0]));
|
||||||
}
|
}
|
||||||
// Assign Huffman codes for RUNCODEs.
|
// Assign Huffman codes for RUNCODEs.
|
||||||
@ -2349,8 +2331,8 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
// Read a Huffman code using the assignment above.
|
// Read a Huffman code using the assignment above.
|
||||||
// Interpret the RUNCODE codes and the additional bits (if any).
|
// Interpret the RUNCODE codes and the additional bits (if any).
|
||||||
codes.length = 0;
|
codes.length = 0;
|
||||||
for (i = 0; i < numberOfSymbols; ) {
|
for (let i = 0; i < numberOfSymbols; ) {
|
||||||
codeLength = runCodesTable.decode(reader);
|
const codeLength = runCodesTable.decode(reader);
|
||||||
if (codeLength >= 32) {
|
if (codeLength >= 32) {
|
||||||
let repeatedLength, numberOfRepeats, j;
|
let repeatedLength, numberOfRepeats, j;
|
||||||
switch (codeLength) {
|
switch (codeLength) {
|
||||||
@ -2532,14 +2514,11 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function readUncompressedBitmap(reader, width, height) {
|
function readUncompressedBitmap(reader, width, height) {
|
||||||
let bitmap = [],
|
const bitmap = [];
|
||||||
x,
|
for (let y = 0; y < height; y++) {
|
||||||
y,
|
const row = new Uint8Array(width);
|
||||||
row;
|
|
||||||
for (y = 0; y < height; y++) {
|
|
||||||
row = new Uint8Array(width);
|
|
||||||
bitmap.push(row);
|
bitmap.push(row);
|
||||||
for (x = 0; x < width; x++) {
|
for (let x = 0; x < width; x++) {
|
||||||
row[x] = reader.readBit();
|
row[x] = reader.readBit();
|
||||||
}
|
}
|
||||||
reader.byteAlign();
|
reader.byteAlign();
|
||||||
@ -2558,19 +2537,15 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
|||||||
EndOfBlock: endOfBlock,
|
EndOfBlock: endOfBlock,
|
||||||
};
|
};
|
||||||
const decoder = new CCITTFaxDecoder(input, params);
|
const decoder = new CCITTFaxDecoder(input, params);
|
||||||
let bitmap = [],
|
const bitmap = [];
|
||||||
x,
|
let currentByte,
|
||||||
y,
|
|
||||||
row,
|
|
||||||
currentByte,
|
|
||||||
shift,
|
|
||||||
eof = false;
|
eof = false;
|
||||||
|
|
||||||
for (y = 0; y < height; y++) {
|
for (let y = 0; y < height; y++) {
|
||||||
row = new Uint8Array(width);
|
const row = new Uint8Array(width);
|
||||||
bitmap.push(row);
|
bitmap.push(row);
|
||||||
shift = -1;
|
let shift = -1;
|
||||||
for (x = 0; x < width; x++) {
|
for (let x = 0; x < width; x++) {
|
||||||
if (shift < 0) {
|
if (shift < 0) {
|
||||||
currentByte = decoder.readNextChar();
|
currentByte = decoder.readNextChar();
|
||||||
if (currentByte === -1) {
|
if (currentByte === -1) {
|
||||||
|
@ -207,8 +207,8 @@ class Parser {
|
|||||||
CR = 0xd;
|
CR = 0xd;
|
||||||
const n = 10,
|
const n = 10,
|
||||||
NUL = 0x0;
|
NUL = 0x0;
|
||||||
let startPos = stream.pos,
|
const startPos = stream.pos;
|
||||||
state = 0,
|
let state = 0,
|
||||||
ch,
|
ch,
|
||||||
maybeEIPos;
|
maybeEIPos;
|
||||||
while ((ch = stream.getByte()) !== -1) {
|
while ((ch = stream.getByte()) !== -1) {
|
||||||
@ -282,11 +282,10 @@ class Parser {
|
|||||||
* @returns {number} The inline stream length.
|
* @returns {number} The inline stream length.
|
||||||
*/
|
*/
|
||||||
findDCTDecodeInlineStreamEnd(stream) {
|
findDCTDecodeInlineStreamEnd(stream) {
|
||||||
let startPos = stream.pos,
|
const startPos = stream.pos;
|
||||||
foundEOI = false,
|
let foundEOI = false,
|
||||||
b,
|
b,
|
||||||
markerLength,
|
markerLength;
|
||||||
length;
|
|
||||||
while ((b = stream.getByte()) !== -1) {
|
while ((b = stream.getByte()) !== -1) {
|
||||||
if (b !== 0xff) {
|
if (b !== 0xff) {
|
||||||
// Not a valid marker.
|
// Not a valid marker.
|
||||||
@ -367,7 +366,7 @@ class Parser {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
length = stream.pos - startPos;
|
const length = stream.pos - startPos;
|
||||||
if (b === -1) {
|
if (b === -1) {
|
||||||
warn(
|
warn(
|
||||||
"Inline DCTDecode image stream: " +
|
"Inline DCTDecode image stream: " +
|
||||||
@ -387,9 +386,8 @@ class Parser {
|
|||||||
findASCII85DecodeInlineStreamEnd(stream) {
|
findASCII85DecodeInlineStreamEnd(stream) {
|
||||||
const TILDE = 0x7e,
|
const TILDE = 0x7e,
|
||||||
GT = 0x3e;
|
GT = 0x3e;
|
||||||
let startPos = stream.pos,
|
const startPos = stream.pos;
|
||||||
ch,
|
let ch;
|
||||||
length;
|
|
||||||
while ((ch = stream.getByte()) !== -1) {
|
while ((ch = stream.getByte()) !== -1) {
|
||||||
if (ch === TILDE) {
|
if (ch === TILDE) {
|
||||||
const tildePos = stream.pos;
|
const tildePos = stream.pos;
|
||||||
@ -415,7 +413,7 @@ class Parser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
length = stream.pos - startPos;
|
const length = stream.pos - startPos;
|
||||||
if (ch === -1) {
|
if (ch === -1) {
|
||||||
warn(
|
warn(
|
||||||
"Inline ASCII85Decode image stream: " +
|
"Inline ASCII85Decode image stream: " +
|
||||||
@ -434,15 +432,14 @@ class Parser {
|
|||||||
*/
|
*/
|
||||||
findASCIIHexDecodeInlineStreamEnd(stream) {
|
findASCIIHexDecodeInlineStreamEnd(stream) {
|
||||||
const GT = 0x3e;
|
const GT = 0x3e;
|
||||||
let startPos = stream.pos,
|
const startPos = stream.pos;
|
||||||
ch,
|
let ch;
|
||||||
length;
|
|
||||||
while ((ch = stream.getByte()) !== -1) {
|
while ((ch = stream.getByte()) !== -1) {
|
||||||
if (ch === GT) {
|
if (ch === GT) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
length = stream.pos - startPos;
|
const length = stream.pos - startPos;
|
||||||
if (ch === -1) {
|
if (ch === -1) {
|
||||||
warn(
|
warn(
|
||||||
"Inline ASCIIHexDecode image stream: " +
|
"Inline ASCIIHexDecode image stream: " +
|
||||||
|
@ -116,13 +116,13 @@ function getFilenameFromContentDispositionHeader(contentDisposition) {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
function rfc2231getparam(contentDisposition) {
|
function rfc2231getparam(contentDisposition) {
|
||||||
let matches = [],
|
const matches = [];
|
||||||
match;
|
let match;
|
||||||
// Iterate over all filename*n= and filename*n*= with n being an integer
|
// Iterate over all filename*n= and filename*n*= with n being an integer
|
||||||
// of at least zero. Any non-zero number must not start with '0'.
|
// of at least zero. Any non-zero number must not start with '0'.
|
||||||
const iter = toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)", "ig");
|
const iter = toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)", "ig");
|
||||||
while ((match = iter.exec(contentDisposition)) !== null) {
|
while ((match = iter.exec(contentDisposition)) !== null) {
|
||||||
let [, n, quot, part] = match;
|
let [, n, quot, part] = match; // eslint-disable-line prefer-const
|
||||||
n = parseInt(n, 10);
|
n = parseInt(n, 10);
|
||||||
if (n in matches) {
|
if (n in matches) {
|
||||||
// Ignore anything after the invalid second filename*0.
|
// Ignore anything after the invalid second filename*0.
|
||||||
@ -139,7 +139,7 @@ function getFilenameFromContentDispositionHeader(contentDisposition) {
|
|||||||
// Numbers must be consecutive. Truncate when there is a hole.
|
// Numbers must be consecutive. Truncate when there is a hole.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let [quot, part] = matches[n];
|
let [quot, part] = matches[n]; // eslint-disable-line prefer-const
|
||||||
part = rfc2616unquote(part);
|
part = rfc2616unquote(part);
|
||||||
if (quot) {
|
if (quot) {
|
||||||
part = unescape(part);
|
part = unescape(part);
|
||||||
|
@ -461,8 +461,8 @@ class StatTimer {
|
|||||||
|
|
||||||
toString() {
|
toString() {
|
||||||
// Find the longest name for padding purposes.
|
// Find the longest name for padding purposes.
|
||||||
let outBuf = [],
|
const outBuf = [];
|
||||||
longest = 0;
|
let longest = 0;
|
||||||
for (const time of this.times) {
|
for (const time of this.times) {
|
||||||
const name = time.name;
|
const name = time.name;
|
||||||
if (name.length > longest) {
|
if (name.length > longest) {
|
||||||
|
@ -67,9 +67,8 @@ class XMLParserBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_parseContent(s, start) {
|
_parseContent(s, start) {
|
||||||
let pos = start,
|
const attributes = [];
|
||||||
name,
|
let pos = start;
|
||||||
attributes = [];
|
|
||||||
|
|
||||||
function skipWs() {
|
function skipWs() {
|
||||||
while (pos < s.length && isWhitespace(s, pos)) {
|
while (pos < s.length && isWhitespace(s, pos)) {
|
||||||
@ -85,7 +84,7 @@ class XMLParserBase {
|
|||||||
) {
|
) {
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
name = s.substring(start, pos);
|
const name = s.substring(start, pos);
|
||||||
skipWs();
|
skipWs();
|
||||||
while (
|
while (
|
||||||
pos < s.length &&
|
pos < s.length &&
|
||||||
@ -130,9 +129,7 @@ class XMLParserBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_parseProcessingInstruction(s, start) {
|
_parseProcessingInstruction(s, start) {
|
||||||
let pos = start,
|
let pos = start;
|
||||||
name,
|
|
||||||
value;
|
|
||||||
|
|
||||||
function skipWs() {
|
function skipWs() {
|
||||||
while (pos < s.length && isWhitespace(s, pos)) {
|
while (pos < s.length && isWhitespace(s, pos)) {
|
||||||
@ -148,13 +145,13 @@ class XMLParserBase {
|
|||||||
) {
|
) {
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
name = s.substring(start, pos);
|
const name = s.substring(start, pos);
|
||||||
skipWs();
|
skipWs();
|
||||||
const attrStart = pos;
|
const attrStart = pos;
|
||||||
while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
|
while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
value = s.substring(attrStart, pos);
|
const value = s.substring(attrStart, pos);
|
||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
value,
|
value,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user