update to state of the art

This commit is contained in:
s2
2020-10-10 15:18:01 +02:00
parent cf251a170f
commit 4cdcfd167c
1526 changed files with 48132 additions and 7268 deletions

14
node_modules/jsdom/Changelog.md generated vendored
View File

@@ -26,6 +26,20 @@ Other guidelines:
* Roughly order changes within those groupings by impact.
-->
## 16.4.0
* Added a not-implemented warning if you try to use the second pseudo-element argument to `getComputedStyle()`, unless you pass a `::part` or `::slotted` pseudo-element, in which case we throw an error per the spec. (ExE-Boss)
* Improved the performance of repeated access to `el.tagName`, which also indirectly improves performance of selector matching and style computation. (eps1lon)
* Fixed `form.elements` to respect the `form=""` attribute, so that it can contain non-descendant form controls. (ccwebdesign)
* Fixed `el.focus()` to do nothing on disconnected elements. (eps1lon)
* Fixed `el.focus()` to work on SVG elements. (zjffun)
* Fixed removing the currently-focused element to move focus to the `<body>` element. (eps1lon)
* Fixed `imgEl.complete` to return true for `<img>` elements with empty or unset `src=""` attributes. (strager)
* Fixed `imgEl.complete` to return true if an error occurs loading the `<img>`, when canvas is enabled. (strager)
* Fixed `imgEl.complete` to return false if the `<img>` element's `src=""` attribute is reset. (strager)
* Fixed the `valueMissing` validation check for `<input type="radio">`. (zjffun)
* Fixed `translate=""` and `draggable=""` attribute processing to use ASCII case-insensitivity, instead of Unicode case-insensitivity. (zjffun)
## 16.3.0
* Added firing of `focusin` and `focusout` when using `el.focus()` and `el.blur()`. (trueadm)

View File

@@ -26,8 +26,8 @@ const Selection = require("../living/generated/Selection");
const reportException = require("../living/helpers/runtime-script-errors");
const { fireAnEvent } = require("../living/helpers/events");
const SessionHistory = require("../living/window/SessionHistory");
const { forEachMatchingSheetRuleOfElement, getResolvedValue, propertiesWithResolvedValueImplemented } =
require("../living/helpers/style-rules");
const { forEachMatchingSheetRuleOfElement, getResolvedValue, propertiesWithResolvedValueImplemented,
SHADOW_DOM_PSEUDO_REGEXP } = require("../living/helpers/style-rules.js");
const CustomElementRegistry = require("../living/generated/CustomElementRegistry");
const jsGlobals = require("./js-globals.json");
@@ -642,6 +642,20 @@ function Window(options) {
this.getComputedStyle = function (elt) {
elt = Element.convert(elt);
let pseudoElt = arguments[1];
if (pseudoElt !== undefined && pseudoElt !== null) {
pseudoElt = webIDLConversions.DOMString(pseudoElt);
}
if (pseudoElt !== undefined && pseudoElt !== null && pseudoElt !== "") {
// TODO: Parse pseudoElt
if (SHADOW_DOM_PSEUDO_REGEXP.test(pseudoElt)) {
throw new TypeError("Tried to get the computed style of a Shadow DOM pseudo-element.");
}
notImplemented("window.computedStyle(elt, pseudoElt)", this);
}
const declaration = new CSSStyleDeclaration();
const { forEach } = Array.prototype;

View File

@@ -1,35 +1,35 @@
"use strict";
const nodeType = require("../node-type.js");
const FocusEvent = require("../generated/FocusEvent.js");
const idlUtils = require("../generated/utils.js");
const { isDisabled } = require("./form-controls.js");
const { firstChildWithLocalName } = require("./traversal");
const { createAnEvent } = require("./events");
const { HTML_NS } = require("./namespaces");
const { HTML_NS, SVG_NS } = require("./namespaces");
const { isRenderedElement } = require("./svg/render");
const focusableFormElements = new Set(["input", "select", "textarea", "button"]);
// https://html.spec.whatwg.org/multipage/interaction.html#focusable-area, but also some of
// https://html.spec.whatwg.org/multipage/interaction.html#focusing-steps: e.g., Documents are not actually focusable
// areas, but their viewports are, and the first step of the latter algorithm translates Documents to their viewports.
// https://html.spec.whatwg.org/multipage/interaction.html#focusing-steps and some of
// https://svgwg.org/svg2-draft/interact.html#TermFocusable
exports.isFocusableAreaElement = elImpl => {
if (!elImpl._ownerDocument._defaultView && !elImpl._defaultView) {
return false;
}
if (elImpl._nodeType === nodeType.DOCUMENT_NODE) {
return true;
}
if (!Number.isNaN(parseInt(elImpl.getAttributeNS(null, "tabindex")))) {
return true;
}
// We implemented most of the suggested focusable elements found here:
// https://html.spec.whatwg.org/multipage/interaction.html#tabindex-value
// However, some suggested elements are not focusable in web browsers, as detailed here:
// https://github.com/whatwg/html/issues/5490
if (elImpl._namespaceURI === HTML_NS) {
if (!elImpl._ownerDocument._defaultView) {
return false;
}
if (!elImpl.isConnected) {
return false;
}
if (!Number.isNaN(parseInt(elImpl.getAttributeNS(null, "tabindex")))) {
return true;
}
if (elImpl._localName === "iframe") {
return true;
}
@@ -55,11 +55,26 @@ exports.isFocusableAreaElement = elImpl => {
if (elImpl.hasAttributeNS(null, "contenteditable")) {
return true;
}
return false;
// This does not check for a designMode Document as specified in
// https://html.spec.whatwg.org/multipage/interaction.html#editing-host because the designMode
// attribute is not implemented.
}
if (elImpl._namespaceURI === SVG_NS) {
if (!Number.isNaN(parseInt(elImpl.getAttributeNS(null, "tabindex"))) && isRenderedElement(elImpl)) {
return true;
}
if (elImpl._localName === "a" && elImpl.hasAttributeNS(null, "href")) {
return true;
}
return false;
}
return false;
};

View File

@@ -106,3 +106,5 @@ exports.getResolvedValue = (element, property) => {
// So we skip to "any other property: The resolved value is the computed value."
return getComputedValue(element, property);
};
exports.SHADOW_DOM_PSEUDO_REGEXP = /^::(?:part|slotted)\(/i;

View File

@@ -0,0 +1,46 @@
"use strict";
const { SVG_NS } = require("../namespaces");
// https://svgwg.org/svg2-draft/render.html#TermNeverRenderedElement
const neverRenderedElements = new Set([
"clipPath",
"defs",
"desc",
"linearGradient",
"marker",
"mask",
"metadata",
"pattern",
"radialGradient",
"script",
"style",
"title",
"symbol"
]);
// https://svgwg.org/svg2-draft/render.html#Rendered-vs-NonRendered
exports.isRenderedElement = elImpl => {
if (neverRenderedElements.has(elImpl._localName)) {
return false;
}
// This does not check for elements excluded because of conditional processing attributes or switch structures,
// because conditional processing is not implemented.
// https://svgwg.org/svg2-draft/struct.html#ConditionalProcessing
// This does not check for computed style of display being none, since that is not yet implemented for HTML
// focusability either (and there are no tests yet).
if (!elImpl.isConnected) {
return false;
}
// The spec is unclear about how to deal with non-SVG parents, so we only perform this check for SVG-namespace
// parents.
if (elImpl.parentElement && elImpl.parentElement._namespaceURI === SVG_NS &&
!exports.isRenderedElement(elImpl.parentNode)) {
return false;
}
return true;
};

View File

@@ -614,6 +614,10 @@ class DocumentImpl extends NodeImpl {
}
_runPreRemovingSteps(oldNode) {
// https://html.spec.whatwg.org/#focus-fixup-rule
if (oldNode === this.activeElement) {
this._lastFocusedElement = this.body;
}
for (const activeNodeIterator of this._workingNodeIterators) {
activeNodeIterator._preRemovingSteps(oldNode);
}

View File

@@ -78,6 +78,8 @@ class ElementImpl extends NodeImpl {
this._attributes = NamedNodeMap.createImpl(this._globalObject, [], {
element: this
});
this._cachedTagName = null;
}
_attach() {
@@ -133,11 +135,17 @@ class ElementImpl extends NodeImpl {
return this._prefix !== null ? this._prefix + ":" + this._localName : this._localName;
}
get tagName() {
let qualifiedName = this._qualifiedName;
if (this.namespaceURI === HTML_NS && this._ownerDocument._parsingMode === "html") {
qualifiedName = asciiUppercase(qualifiedName);
// This getter can be a hotpath in getComputedStyle.
// All these are invariants during the instance lifetime so we can safely cache the computed tagName.
// We could create it during construction but since we already identified this as potentially slow we do it lazily.
if (this._cachedTagName === null) {
if (this.namespaceURI === HTML_NS && this._ownerDocument._parsingMode === "html") {
this._cachedTagName = asciiUppercase(this._qualifiedName);
} else {
this._cachedTagName = this._qualifiedName;
}
}
return qualifiedName;
return this._cachedTagName;
}
get attributes() {

View File

@@ -1,10 +1,10 @@
"use strict";
const HTMLElementImpl = require("./HTMLElement-impl").implementation;
const { isDisabled, formOwner } = require("../helpers/form-controls");
const DefaultConstraintValidationImpl =
require("../constraint-validation/DefaultConstraintValidation-impl").implementation;
const { mixin } = require("../../utils");
const { getLabelsForLabelable } = require("../helpers/form-controls");
const { isDisabled, formOwner, getLabelsForLabelable } = require("../helpers/form-controls");
const { asciiLowercase } = require("../helpers/strings");
class HTMLButtonElementImpl extends HTMLElementImpl {
constructor(globalObject, args, privateData) {
@@ -42,7 +42,7 @@ class HTMLButtonElementImpl extends HTMLElementImpl {
}
get type() {
const typeAttr = (this.getAttributeNS(null, "type") || "").toLowerCase();
const typeAttr = asciiLowercase(this.getAttributeNS(null, "type") || "");
switch (typeAttr) {
case "submit":
case "reset":
@@ -54,7 +54,7 @@ class HTMLButtonElementImpl extends HTMLElementImpl {
}
set type(v) {
v = String(v).toLowerCase();
v = asciiLowercase(String(v));
switch (v) {
case "submit":
case "reset":

View File

@@ -8,6 +8,7 @@ const HTMLOrSVGElementImpl = require("./HTMLOrSVGElement-impl").implementation;
const { firstChildWithLocalName } = require("../helpers/traversal");
const { isDisabled } = require("../helpers/form-controls");
const { fireAnEvent } = require("../helpers/events");
const { asciiLowercase } = require("../helpers/strings");
class HTMLElementImpl extends ElementImpl {
constructor(globalObject, args, privateData) {
@@ -37,10 +38,11 @@ class HTMLElementImpl extends ElementImpl {
// https://html.spec.whatwg.org/multipage/dom.html#the-translate-attribute
get translate() {
const translateAttr = this.getAttributeNS(null, "translate");
const translateAttrString = asciiLowercase(translateAttr || "");
if (translateAttr === "yes" || translateAttr === "") {
if (translateAttrString === "yes" || (translateAttr && translateAttrString === "")) {
return true;
} else if (translateAttr === "no") {
} else if (translateAttrString === "no") {
return false;
}
@@ -86,7 +88,7 @@ class HTMLElementImpl extends ElementImpl {
}
get draggable() {
const attributeValue = this.getAttributeNS(null, "draggable");
const attributeValue = asciiLowercase(this.getAttributeNS(null, "draggable") || "");
if (attributeValue === "true") {
return true;

View File

@@ -5,7 +5,7 @@ const { serializeURL } = require("whatwg-url");
const HTMLElementImpl = require("./HTMLElement-impl").implementation;
const { domSymbolTree } = require("../helpers/internal-constants");
const { fireAnEvent } = require("../helpers/events");
const { isListed, isSubmittable, isSubmitButton } = require("../helpers/form-controls");
const { formOwner, isListed, isSubmittable, isSubmitButton } = require("../helpers/form-controls");
const HTMLCollection = require("../generated/HTMLCollection");
const notImplemented = require("../../browser/not-implemented");
const { parseURLToResultingURLRecord } = require("../helpers/document-base-url");
@@ -47,14 +47,24 @@ class HTMLFormElementImpl extends HTMLElementImpl {
super._descendantRemoved.apply(this, arguments);
}
_getElementNodes() {
return domSymbolTree.treeToArray(this.getRootNode({}), {
filter: node => {
if (!isListed(node) || (node._localName === "input" && node.type === "image")) {
return false;
}
return formOwner(node) === this;
}
});
}
// https://html.spec.whatwg.org/multipage/forms.html#dom-form-elements
get elements() {
// TODO: Return a HTMLFormControlsCollection
return HTMLCollection.createImpl(this._globalObject, [], {
element: this,
query: () => domSymbolTree.treeToArray(this, {
filter: node => isListed(node) && (node._localName !== "input" || node.type !== "image")
})
element: this.getRootNode({}),
query: () => this._getElementNodes()
});
}

View File

@@ -6,6 +6,11 @@ const { Canvas } = require("../../utils");
const { parseURLToResultingURLRecord } = require("../helpers/document-base-url");
class HTMLImageElementImpl extends HTMLElementImpl {
constructor(...args) {
super(...args);
this._currentRequestState = "unavailable";
}
_attrModified(name, value, oldVal) {
// TODO: handle crossorigin
if (name === "src" || ((name === "srcset" || name === "width" || name === "sizes") && value !== oldVal)) {
@@ -50,7 +55,11 @@ class HTMLImageElementImpl extends HTMLElementImpl {
}
get complete() {
return Boolean(this._image && this._image.complete);
const srcAttributeValue = this.getAttributeNS(null, "src");
return srcAttributeValue === null ||
srcAttributeValue === "" ||
this._currentRequestState === "broken" ||
this._currentRequestState === "completely available";
}
get currentSrc() {
@@ -73,6 +82,7 @@ class HTMLImageElementImpl extends HTMLElementImpl {
this._image = new Canvas.Image();
}
this._currentSrc = null;
this._currentRequestState = "unavailable";
const srcAttributeValue = this.getAttributeNS(null, "src");
let urlString = null;
if (srcAttributeValue !== null && srcAttributeValue !== "") {
@@ -101,11 +111,15 @@ class HTMLImageElementImpl extends HTMLElementImpl {
throw new Error(error);
}
this._currentSrc = srcAttributeValue;
this._currentRequestState = "completely available";
};
request = resourceLoader.fetch(urlString, {
element: this,
onLoad: onLoadImage
onLoad: onLoadImage,
onError: () => {
this._currentRequestState = "broken";
}
});
} else {
this._image.src = "";

View File

@@ -332,11 +332,11 @@ class HTMLInputElementImpl extends HTMLElementImpl {
return null;
}
_isRadioGroupChecked() {
if (this.checked) {
_someInRadioGroup(name) {
if (this[name]) {
return true;
}
return this._otherRadioGroupElements.some(radioGroupElement => radioGroupElement.checked);
return this._otherRadioGroupElements.some(radioGroupElement => radioGroupElement[name]);
}
get _mutable() {
@@ -976,7 +976,7 @@ class HTMLInputElementImpl extends HTMLElementImpl {
// and all of the input elements in the radio button group have a checkedness
// that is false, then the element is suffering from being missing.
case "radio":
if (this._required && !this._isRadioGroupChecked()) {
if (this._someInRadioGroup("_required") && !this._someInRadioGroup("checked")) {
return true;
}
break;

View File

@@ -1,3 +1,11 @@
## 7.4.0 (2020-08-03)
### New features
Add support for logical assignment operators.
Add support for numeric separators.
## 7.3.1 (2020-06-11)
### Bug fixes

View File

@@ -1,3 +1,5 @@
MIT License
Copyright (C) 2012-2018 by various contributors (see AUTHORS)
Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@@ -266,5 +266,4 @@ Plugins for ECMAScript proposals:
- [`acorn-stage3`](https://github.com/acornjs/acorn-stage3): Parse most stage 3 proposals, bundling:
- [`acorn-class-fields`](https://github.com/acornjs/acorn-class-fields): Parse [class fields proposal](https://github.com/tc39/proposal-class-fields)
- [`acorn-import-meta`](https://github.com/acornjs/acorn-import-meta): Parse [import.meta proposal](https://github.com/tc39/proposal-import-meta)
- [`acorn-numeric-separator`](https://github.com/acornjs/acorn-numeric-separator): Parse [numeric separator proposal](https://github.com/tc39/proposal-numeric-separator)
- [`acorn-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods)n

View File

@@ -594,7 +594,7 @@
// ## Parser utilities
var literal = /^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)")/;
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
pp.strictDirective = function(start) {
for (;;) {
// Try to find string literal.
@@ -2385,7 +2385,7 @@
var node = this.startNode();
node.value = value;
node.raw = this.input.slice(this.start, this.end);
if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1); }
if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); }
this.next();
return this.finishNode(node, "Literal")
};
@@ -4551,7 +4551,13 @@
pp$9.readToken_pipe_amp = function(code) { // '|&'
var next = this.input.charCodeAt(this.pos + 1);
if (next === code) { return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2) }
if (next === code) {
if (this.options.ecmaVersion >= 12) {
var next2 = this.input.charCodeAt(this.pos + 2);
if (next2 === 61) { return this.finishOp(types.assign, 3) }
}
return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2)
}
if (next === 61) { return this.finishOp(types.assign, 2) }
return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
};
@@ -4608,13 +4614,20 @@
};
pp$9.readToken_question = function() { // '?'
if (this.options.ecmaVersion >= 11) {
var ecmaVersion = this.options.ecmaVersion;
if (ecmaVersion >= 11) {
var next = this.input.charCodeAt(this.pos + 1);
if (next === 46) {
var next2 = this.input.charCodeAt(this.pos + 2);
if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) }
}
if (next === 63) { return this.finishOp(types.coalesce, 2) }
if (next === 63) {
if (ecmaVersion >= 12) {
var next2$1 = this.input.charCodeAt(this.pos + 2);
if (next2$1 === 61) { return this.finishOp(types.assign, 3) }
}
return this.finishOp(types.coalesce, 2)
}
}
return this.finishOp(types.question, 1)
};
@@ -4743,30 +4756,67 @@
// were read, the integer value otherwise. When `len` is given, this
// will return `null` unless the integer has exactly `len` digits.
pp$9.readInt = function(radix, len) {
var start = this.pos, total = 0;
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {
pp$9.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
// `len` is used for character escape sequences. In that case, disallow separators.
var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
// `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b)
// and isn't fraction part nor exponent part. In that case, if the first digit
// is zero then disallow separators.
var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;
var start = this.pos, total = 0, lastCode = 0;
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {
var code = this.input.charCodeAt(this.pos), val = (void 0);
if (allowSeparators && code === 95) {
if (isLegacyOctalNumericLiteral) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals"); }
if (lastCode === 95) { this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore"); }
if (i === 0) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"); }
lastCode = code;
continue
}
if (code >= 97) { val = code - 97 + 10; } // a
else if (code >= 65) { val = code - 65 + 10; } // A
else if (code >= 48 && code <= 57) { val = code - 48; } // 0-9
else { val = Infinity; }
if (val >= radix) { break }
++this.pos;
lastCode = code;
total = total * radix + val;
}
if (allowSeparators && lastCode === 95) { this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"); }
if (this.pos === start || len != null && this.pos - start !== len) { return null }
return total
};
function stringToNumber(str, isLegacyOctalNumericLiteral) {
if (isLegacyOctalNumericLiteral) {
return parseInt(str, 8)
}
// `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value.
return parseFloat(str.replace(/_/g, ""))
}
function stringToBigInt(str) {
if (typeof BigInt !== "function") {
return null
}
// `BigInt(value)` throws syntax error if the string contains numeric separators.
return BigInt(str.replace(/_/g, ""))
}
pp$9.readRadixNumber = function(radix) {
var start = this.pos;
this.pos += 2; // 0x
var val = this.readInt(radix);
if (val == null) { this.raise(this.start + 2, "Expected number in radix " + radix); }
if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {
val = typeof BigInt !== "undefined" ? BigInt(this.input.slice(start, this.pos)) : null;
val = stringToBigInt(this.input.slice(start, this.pos));
++this.pos;
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
return this.finishToken(types.num, val)
@@ -4776,13 +4826,12 @@
pp$9.readNumber = function(startsWithDot) {
var start = this.pos;
if (!startsWithDot && this.readInt(10) === null) { this.raise(start, "Invalid number"); }
if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
if (octal && this.strict) { this.raise(start, "Invalid number"); }
var next = this.input.charCodeAt(this.pos);
if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {
var str$1 = this.input.slice(start, this.pos);
var val$1 = typeof BigInt !== "undefined" ? BigInt(str$1) : null;
var val$1 = stringToBigInt(this.input.slice(start, this.pos));
++this.pos;
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
return this.finishToken(types.num, val$1)
@@ -4800,8 +4849,7 @@
}
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
var str = this.input.slice(start, this.pos);
var val = octal ? parseInt(str, 8) : parseFloat(str);
var val = stringToNumber(this.input.slice(start, this.pos), octal);
return this.finishToken(types.num, val)
};
@@ -5060,7 +5108,7 @@
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
var version = "7.3.1";
var version = "7.4.1";
Parser.acorn = {
Parser: Parser,

File diff suppressed because one or more lines are too long

View File

@@ -588,7 +588,7 @@ var pp = Parser.prototype;
// ## Parser utilities
var literal = /^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)")/;
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
pp.strictDirective = function(start) {
for (;;) {
// Try to find string literal.
@@ -2379,7 +2379,7 @@ pp$3.parseLiteral = function(value) {
var node = this.startNode();
node.value = value;
node.raw = this.input.slice(this.start, this.end);
if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1); }
if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); }
this.next();
return this.finishNode(node, "Literal")
};
@@ -4545,7 +4545,13 @@ pp$9.readToken_mult_modulo_exp = function(code) { // '%*'
pp$9.readToken_pipe_amp = function(code) { // '|&'
var next = this.input.charCodeAt(this.pos + 1);
if (next === code) { return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2) }
if (next === code) {
if (this.options.ecmaVersion >= 12) {
var next2 = this.input.charCodeAt(this.pos + 2);
if (next2 === 61) { return this.finishOp(types.assign, 3) }
}
return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2)
}
if (next === 61) { return this.finishOp(types.assign, 2) }
return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
};
@@ -4602,13 +4608,20 @@ pp$9.readToken_eq_excl = function(code) { // '=!'
};
pp$9.readToken_question = function() { // '?'
if (this.options.ecmaVersion >= 11) {
var ecmaVersion = this.options.ecmaVersion;
if (ecmaVersion >= 11) {
var next = this.input.charCodeAt(this.pos + 1);
if (next === 46) {
var next2 = this.input.charCodeAt(this.pos + 2);
if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) }
}
if (next === 63) { return this.finishOp(types.coalesce, 2) }
if (next === 63) {
if (ecmaVersion >= 12) {
var next2$1 = this.input.charCodeAt(this.pos + 2);
if (next2$1 === 61) { return this.finishOp(types.assign, 3) }
}
return this.finishOp(types.coalesce, 2)
}
}
return this.finishOp(types.question, 1)
};
@@ -4737,30 +4750,67 @@ pp$9.readRegexp = function() {
// were read, the integer value otherwise. When `len` is given, this
// will return `null` unless the integer has exactly `len` digits.
pp$9.readInt = function(radix, len) {
var start = this.pos, total = 0;
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {
pp$9.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
// `len` is used for character escape sequences. In that case, disallow separators.
var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
// `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b)
// and isn't fraction part nor exponent part. In that case, if the first digit
// is zero then disallow separators.
var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;
var start = this.pos, total = 0, lastCode = 0;
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {
var code = this.input.charCodeAt(this.pos), val = (void 0);
if (allowSeparators && code === 95) {
if (isLegacyOctalNumericLiteral) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals"); }
if (lastCode === 95) { this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore"); }
if (i === 0) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"); }
lastCode = code;
continue
}
if (code >= 97) { val = code - 97 + 10; } // a
else if (code >= 65) { val = code - 65 + 10; } // A
else if (code >= 48 && code <= 57) { val = code - 48; } // 0-9
else { val = Infinity; }
if (val >= radix) { break }
++this.pos;
lastCode = code;
total = total * radix + val;
}
if (allowSeparators && lastCode === 95) { this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"); }
if (this.pos === start || len != null && this.pos - start !== len) { return null }
return total
};
function stringToNumber(str, isLegacyOctalNumericLiteral) {
if (isLegacyOctalNumericLiteral) {
return parseInt(str, 8)
}
// `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value.
return parseFloat(str.replace(/_/g, ""))
}
function stringToBigInt(str) {
if (typeof BigInt !== "function") {
return null
}
// `BigInt(value)` throws syntax error if the string contains numeric separators.
return BigInt(str.replace(/_/g, ""))
}
pp$9.readRadixNumber = function(radix) {
var start = this.pos;
this.pos += 2; // 0x
var val = this.readInt(radix);
if (val == null) { this.raise(this.start + 2, "Expected number in radix " + radix); }
if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {
val = typeof BigInt !== "undefined" ? BigInt(this.input.slice(start, this.pos)) : null;
val = stringToBigInt(this.input.slice(start, this.pos));
++this.pos;
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
return this.finishToken(types.num, val)
@@ -4770,13 +4820,12 @@ pp$9.readRadixNumber = function(radix) {
pp$9.readNumber = function(startsWithDot) {
var start = this.pos;
if (!startsWithDot && this.readInt(10) === null) { this.raise(start, "Invalid number"); }
if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
if (octal && this.strict) { this.raise(start, "Invalid number"); }
var next = this.input.charCodeAt(this.pos);
if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {
var str$1 = this.input.slice(start, this.pos);
var val$1 = typeof BigInt !== "undefined" ? BigInt(str$1) : null;
var val$1 = stringToBigInt(this.input.slice(start, this.pos));
++this.pos;
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
return this.finishToken(types.num, val$1)
@@ -4794,8 +4843,7 @@ pp$9.readNumber = function(startsWithDot) {
}
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
var str = this.input.slice(start, this.pos);
var val = octal ? parseInt(str, 8) : parseFloat(str);
var val = stringToNumber(this.input.slice(start, this.pos), octal);
return this.finishToken(types.num, val)
};
@@ -5054,7 +5102,7 @@ pp$9.readWord = function() {
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
var version = "7.3.1";
var version = "7.4.1";
Parser.acorn = {
Parser: Parser,

File diff suppressed because one or more lines are too long

View File

@@ -1,8 +1,8 @@
{
"_from": "acorn@^7.1.1",
"_id": "acorn@7.3.1",
"_id": "acorn@7.4.1",
"_inBundle": false,
"_integrity": "sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA==",
"_integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"_location": "/jsdom/acorn",
"_phantomChildren": {},
"_requested": {
@@ -18,8 +18,8 @@
"_requiredBy": [
"/jsdom"
],
"_resolved": "https://registry.npmjs.org/acorn/-/acorn-7.3.1.tgz",
"_shasum": "85010754db53c3fbaf3b9ea3e083aa5c5d147ffd",
"_resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
"_shasum": "feaed255973d2e77555b83dbc08851a6c63520fa",
"_spec": "acorn@^7.1.1",
"_where": "D:\\Projects\\vanillajs-seed\\node_modules\\jsdom",
"bin": {
@@ -63,5 +63,5 @@
"prepare": "cd ..; npm run build:main && npm run build:bin"
},
"types": "dist/acorn.d.ts",
"version": "7.3.1"
"version": "7.4.1"
}

10
node_modules/jsdom/package.json generated vendored
View File

@@ -3,9 +3,9 @@
"parse5": "Pinned to exact version number because we monkeypatch its internals (see htmltodom.js)"
},
"_from": "jsdom@^16.3.0",
"_id": "jsdom@16.3.0",
"_id": "jsdom@16.4.0",
"_inBundle": false,
"_integrity": "sha512-zggeX5UuEknpdZzv15+MS1dPYG0J/TftiiNunOeNxSl3qr8Z6cIlQpN0IdJa44z9aFxZRIVqRncvEhQ7X5DtZg==",
"_integrity": "sha512-lYMm3wYdgPhrl7pDcRmvzPhhrGVBeVhPIqeHjzeiHN3DFmD1RBpbExbi8vU7BJdH8VAZYovR8DMt0PNNDM7k8w==",
"_location": "/jsdom",
"_phantomChildren": {},
"_requested": {
@@ -21,8 +21,8 @@
"_requiredBy": [
"/minifyfromhtml"
],
"_resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.3.0.tgz",
"_shasum": "75690b7dac36c67be49c336dcd7219bbbed0810c",
"_resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.4.0.tgz",
"_shasum": "36005bde2d136f73eee1a830c6d45e55408edddb",
"_spec": "jsdom@^16.3.0",
"_where": "D:\\Projects\\vanillajs-seed\\node_modules\\minifyfromhtml",
"browser": {
@@ -172,5 +172,5 @@
"update-authors": "git log --format=\"%aN <%aE>\" | sort -f | uniq > AUTHORS.txt",
"update-wpt": "git submodule update --recursive --remote && cd test/web-platform-tests/tests && python wpt.py manifest --path ../wpt-manifest.json"
},
"version": "16.3.0"
"version": "16.4.0"
}