first commit
This commit is contained in:
15
node_modules/jsdom/node_modules/.bin/acorn
generated
vendored
Normal file
15
node_modules/jsdom/node_modules/.bin/acorn
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../acorn/bin/acorn" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../acorn/bin/acorn" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
17
node_modules/jsdom/node_modules/.bin/acorn.cmd
generated
vendored
Normal file
17
node_modules/jsdom/node_modules/.bin/acorn.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\acorn\bin\acorn" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
18
node_modules/jsdom/node_modules/.bin/acorn.ps1
generated
vendored
Normal file
18
node_modules/jsdom/node_modules/.bin/acorn.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../acorn/bin/acorn" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
620
node_modules/jsdom/node_modules/acorn/CHANGELOG.md
generated
vendored
Normal file
620
node_modules/jsdom/node_modules/acorn/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,620 @@
|
||||
## 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
|
||||
|
||||
Make the string in the `version` export match the actual library version.
|
||||
|
||||
## 7.3.0 (2020-06-11)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a bug that caused parsing of object patterns with a property named `set` that had a default value to fail.
|
||||
|
||||
### New features
|
||||
|
||||
Add support for optional chaining (`?.`).
|
||||
|
||||
## 7.2.0 (2020-05-09)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix precedence issue in parsing of async arrow functions.
|
||||
|
||||
### New features
|
||||
|
||||
Add support for nullish coalescing.
|
||||
|
||||
Add support for `import.meta`.
|
||||
|
||||
Support `export * as ...` syntax.
|
||||
|
||||
Upgrade to Unicode 13.
|
||||
|
||||
## 6.4.1 (2020-03-09)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
More carefully check for valid UTF16 surrogate pairs in regexp validator.
|
||||
|
||||
## 7.1.1 (2020-03-01)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Treat `\8` and `\9` as invalid escapes in template strings.
|
||||
|
||||
Allow unicode escapes in property names that are keywords.
|
||||
|
||||
Don't error on an exponential operator expression as argument to `await`.
|
||||
|
||||
More carefully check for valid UTF16 surrogate pairs in regexp validator.
|
||||
|
||||
## 7.1.0 (2019-09-24)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disallow trailing object literal commas when ecmaVersion is less than 5.
|
||||
|
||||
### New features
|
||||
|
||||
Add a static `acorn` property to the `Parser` class that contains the entire module interface, to allow plugins to access the instance of the library that they are acting on.
|
||||
|
||||
## 7.0.0 (2019-08-13)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
Changes the node format for dynamic imports to use the `ImportExpression` node type, as defined in [ESTree](https://github.com/estree/estree/blob/master/es2020.md#importexpression).
|
||||
|
||||
Makes 10 (ES2019) the default value for the `ecmaVersion` option.
|
||||
|
||||
## 6.3.0 (2019-08-12)
|
||||
|
||||
### New features
|
||||
|
||||
`sourceType: "module"` can now be used even when `ecmaVersion` is less than 6, to parse module-style code that otherwise conforms to an older standard.
|
||||
|
||||
## 6.2.1 (2019-07-21)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug causing Acorn to treat some characters as identifier characters that shouldn't be treated as such.
|
||||
|
||||
Fix issue where setting the `allowReserved` option to `"never"` allowed reserved words in some circumstances.
|
||||
|
||||
## 6.2.0 (2019-07-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Improve valid assignment checking in `for`/`in` and `for`/`of` loops.
|
||||
|
||||
Disallow binding `let` in patterns.
|
||||
|
||||
### New features
|
||||
|
||||
Support bigint syntax with `ecmaVersion` >= 11.
|
||||
|
||||
Support dynamic `import` syntax with `ecmaVersion` >= 11.
|
||||
|
||||
Upgrade to Unicode version 12.
|
||||
|
||||
## 6.1.1 (2019-02-27)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug that caused parsing default exports of with names to fail.
|
||||
|
||||
## 6.1.0 (2019-02-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix scope checking when redefining a `var` as a lexical binding.
|
||||
|
||||
### New features
|
||||
|
||||
Split up `parseSubscripts` to use an internal `parseSubscript` method to make it easier to extend with plugins.
|
||||
|
||||
## 6.0.7 (2019-02-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Check that exported bindings are defined.
|
||||
|
||||
Don't treat `\u180e` as a whitespace character.
|
||||
|
||||
Check for duplicate parameter names in methods.
|
||||
|
||||
Don't allow shorthand properties when they are generators or async methods.
|
||||
|
||||
Forbid binding `await` in async arrow function's parameter list.
|
||||
|
||||
## 6.0.6 (2019-01-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
The content of class declarations and expressions is now always parsed in strict mode.
|
||||
|
||||
Don't allow `let` or `const` to bind the variable name `let`.
|
||||
|
||||
Treat class declarations as lexical.
|
||||
|
||||
Don't allow a generator function declaration as the sole body of an `if` or `else`.
|
||||
|
||||
Ignore `"use strict"` when after an empty statement.
|
||||
|
||||
Allow string line continuations with special line terminator characters.
|
||||
|
||||
Treat `for` bodies as part of the `for` scope when checking for conflicting bindings.
|
||||
|
||||
Fix bug with parsing `yield` in a `for` loop initializer.
|
||||
|
||||
Implement special cases around scope checking for functions.
|
||||
|
||||
## 6.0.5 (2019-01-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix TypeScript type for `Parser.extend` and add `allowAwaitOutsideFunction` to options type.
|
||||
|
||||
Don't treat `let` as a keyword when the next token is `{` on the next line.
|
||||
|
||||
Fix bug that broke checking for parentheses around an object pattern in a destructuring assignment when `preserveParens` was on.
|
||||
|
||||
## 6.0.4 (2018-11-05)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Further improvements to tokenizing regular expressions in corner cases.
|
||||
|
||||
## 6.0.3 (2018-11-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug in tokenizing an expression-less return followed by a function followed by a regular expression.
|
||||
|
||||
Remove stray symlink in the package tarball.
|
||||
|
||||
## 6.0.2 (2018-09-26)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug where default expressions could fail to parse inside an object destructuring assignment expression.
|
||||
|
||||
## 6.0.1 (2018-09-14)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix wrong value in `version` export.
|
||||
|
||||
## 6.0.0 (2018-09-14)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Better handle variable-redefinition checks for catch bindings and functions directly under if statements.
|
||||
|
||||
Forbid `new.target` in top-level arrow functions.
|
||||
|
||||
Fix issue with parsing a regexp after `yield` in some contexts.
|
||||
|
||||
### New features
|
||||
|
||||
The package now comes with TypeScript definitions.
|
||||
|
||||
### Breaking changes
|
||||
|
||||
The default value of the `ecmaVersion` option is now 9 (2018).
|
||||
|
||||
Plugins work differently, and will have to be rewritten to work with this version.
|
||||
|
||||
The loose parser and walker have been moved into separate packages (`acorn-loose` and `acorn-walk`).
|
||||
|
||||
## 5.7.3 (2018-09-10)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix failure to tokenize regexps after expressions like `x.of`.
|
||||
|
||||
Better error message for unterminated template literals.
|
||||
|
||||
## 5.7.2 (2018-08-24)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Properly handle `allowAwaitOutsideFunction` in for statements.
|
||||
|
||||
Treat function declarations at the top level of modules like let bindings.
|
||||
|
||||
Don't allow async function declarations as the only statement under a label.
|
||||
|
||||
## 5.7.0 (2018-06-15)
|
||||
|
||||
### New features
|
||||
|
||||
Upgraded to Unicode 11.
|
||||
|
||||
## 5.6.0 (2018-05-31)
|
||||
|
||||
### New features
|
||||
|
||||
Allow U+2028 and U+2029 in string when ECMAVersion >= 10.
|
||||
|
||||
Allow binding-less catch statements when ECMAVersion >= 10.
|
||||
|
||||
Add `allowAwaitOutsideFunction` option for parsing top-level `await`.
|
||||
|
||||
## 5.5.3 (2018-03-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
A _second_ republish of the code in 5.5.1, this time with yarn, to hopefully get valid timestamps.
|
||||
|
||||
## 5.5.2 (2018-03-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
A republish of the code in 5.5.1 in an attempt to solve an issue with the file timestamps in the npm package being 0.
|
||||
|
||||
## 5.5.1 (2018-03-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix misleading error message for octal escapes in template strings.
|
||||
|
||||
## 5.5.0 (2018-02-27)
|
||||
|
||||
### New features
|
||||
|
||||
The identifier character categorization is now based on Unicode version 10.
|
||||
|
||||
Acorn will now validate the content of regular expressions, including new ES9 features.
|
||||
|
||||
## 5.4.0 (2018-02-01)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disallow duplicate or escaped flags on regular expressions.
|
||||
|
||||
Disallow octal escapes in strings in strict mode.
|
||||
|
||||
### New features
|
||||
|
||||
Add support for async iteration.
|
||||
|
||||
Add support for object spread and rest.
|
||||
|
||||
## 5.3.0 (2017-12-28)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix parsing of floating point literals with leading zeroes in loose mode.
|
||||
|
||||
Allow duplicate property names in object patterns.
|
||||
|
||||
Don't allow static class methods named `prototype`.
|
||||
|
||||
Disallow async functions directly under `if` or `else`.
|
||||
|
||||
Parse right-hand-side of `for`/`of` as an assignment expression.
|
||||
|
||||
Stricter parsing of `for`/`in`.
|
||||
|
||||
Don't allow unicode escapes in contextual keywords.
|
||||
|
||||
### New features
|
||||
|
||||
Parsing class members was factored into smaller methods to allow plugins to hook into it.
|
||||
|
||||
## 5.2.1 (2017-10-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a token context corruption bug.
|
||||
|
||||
## 5.2.0 (2017-10-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix token context tracking for `class` and `function` in property-name position.
|
||||
|
||||
Make sure `%*` isn't parsed as a valid operator.
|
||||
|
||||
Allow shorthand properties `get` and `set` to be followed by default values.
|
||||
|
||||
Disallow `super` when not in callee or object position.
|
||||
|
||||
### New features
|
||||
|
||||
Support [`directive` property](https://github.com/estree/estree/compare/b3de58c9997504d6fba04b72f76e6dd1619ee4eb...1da8e603237144f44710360f8feb7a9977e905e0) on directive expression statements.
|
||||
|
||||
## 5.1.2 (2017-09-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disable parsing of legacy HTML-style comments in modules.
|
||||
|
||||
Fix parsing of async methods whose names are keywords.
|
||||
|
||||
## 5.1.1 (2017-07-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix problem with disambiguating regexp and division after a class.
|
||||
|
||||
## 5.1.0 (2017-07-05)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix tokenizing of regexps in an object-desctructuring `for`/`of` loop and after `yield`.
|
||||
|
||||
Parse zero-prefixed numbers with non-octal digits as decimal.
|
||||
|
||||
Allow object/array patterns in rest parameters.
|
||||
|
||||
Don't error when `yield` is used as a property name.
|
||||
|
||||
Allow `async` as a shorthand object property.
|
||||
|
||||
### New features
|
||||
|
||||
Implement the [template literal revision proposal](https://github.com/tc39/proposal-template-literal-revision) for ES9.
|
||||
|
||||
## 5.0.3 (2017-04-01)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix spurious duplicate variable definition errors for named functions.
|
||||
|
||||
## 5.0.2 (2017-03-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
A binary operator after a parenthesized arrow expression is no longer incorrectly treated as an error.
|
||||
|
||||
## 5.0.0 (2017-03-28)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Raise an error for duplicated lexical bindings.
|
||||
|
||||
Fix spurious error when an assignement expression occurred after a spread expression.
|
||||
|
||||
Accept regular expressions after `of` (in `for`/`of`), `yield` (in a generator), and braced arrow functions.
|
||||
|
||||
Allow labels in front or `var` declarations, even in strict mode.
|
||||
|
||||
### Breaking changes
|
||||
|
||||
Parse declarations following `export default` as declaration nodes, not expressions. This means that class and function declarations nodes can now have `null` as their `id`.
|
||||
|
||||
## 4.0.11 (2017-02-07)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Allow all forms of member expressions to be parenthesized as lvalue.
|
||||
|
||||
## 4.0.10 (2017-02-07)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Don't expect semicolons after default-exported functions or classes, even when they are expressions.
|
||||
|
||||
Check for use of `'use strict'` directives in non-simple parameter functions, even when already in strict mode.
|
||||
|
||||
## 4.0.9 (2017-02-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix incorrect error raised for parenthesized simple assignment targets, so that `(x) = 1` parses again.
|
||||
|
||||
## 4.0.8 (2017-02-03)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Solve spurious parenthesized pattern errors by temporarily erring on the side of accepting programs that our delayed errors don't handle correctly yet.
|
||||
|
||||
## 4.0.7 (2017-02-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Accept invalidly rejected code like `(x).y = 2` again.
|
||||
|
||||
Don't raise an error when a function _inside_ strict code has a non-simple parameter list.
|
||||
|
||||
## 4.0.6 (2017-02-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix exponential behavior (manifesting itself as a complete hang for even relatively small source files) introduced by the new 'use strict' check.
|
||||
|
||||
## 4.0.5 (2017-02-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disallow parenthesized pattern expressions.
|
||||
|
||||
Allow keywords as export names.
|
||||
|
||||
Don't allow the `async` keyword to be parenthesized.
|
||||
|
||||
Properly raise an error when a keyword contains a character escape.
|
||||
|
||||
Allow `"use strict"` to appear after other string literal expressions.
|
||||
|
||||
Disallow labeled declarations.
|
||||
|
||||
## 4.0.4 (2016-12-19)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix crash when `export` was followed by a keyword that can't be
|
||||
exported.
|
||||
|
||||
## 4.0.3 (2016-08-16)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Allow regular function declarations inside single-statement `if` branches in loose mode. Forbid them entirely in strict mode.
|
||||
|
||||
Properly parse properties named `async` in ES2017 mode.
|
||||
|
||||
Fix bug where reserved words were broken in ES2017 mode.
|
||||
|
||||
## 4.0.2 (2016-08-11)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Don't ignore period or 'e' characters after octal numbers.
|
||||
|
||||
Fix broken parsing for call expressions in default parameter values of arrow functions.
|
||||
|
||||
## 4.0.1 (2016-08-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix false positives in duplicated export name errors.
|
||||
|
||||
## 4.0.0 (2016-08-07)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
The default `ecmaVersion` option value is now 7.
|
||||
|
||||
A number of internal method signatures changed, so plugins might need to be updated.
|
||||
|
||||
### Bug fixes
|
||||
|
||||
The parser now raises errors on duplicated export names.
|
||||
|
||||
`arguments` and `eval` can now be used in shorthand properties.
|
||||
|
||||
Duplicate parameter names in non-simple argument lists now always produce an error.
|
||||
|
||||
### New features
|
||||
|
||||
The `ecmaVersion` option now also accepts year-style version numbers
|
||||
(2015, etc).
|
||||
|
||||
Support for `async`/`await` syntax when `ecmaVersion` is >= 8.
|
||||
|
||||
Support for trailing commas in call expressions when `ecmaVersion` is >= 8.
|
||||
|
||||
## 3.3.0 (2016-07-25)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug in tokenizing of regexp operator after a function declaration.
|
||||
|
||||
Fix parser crash when parsing an array pattern with a hole.
|
||||
|
||||
### New features
|
||||
|
||||
Implement check against complex argument lists in functions that enable strict mode in ES7.
|
||||
|
||||
## 3.2.0 (2016-06-07)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Improve handling of lack of unicode regexp support in host
|
||||
environment.
|
||||
|
||||
Properly reject shorthand properties whose name is a keyword.
|
||||
|
||||
### New features
|
||||
|
||||
Visitors created with `visit.make` now have their base as _prototype_, rather than copying properties into a fresh object.
|
||||
|
||||
## 3.1.0 (2016-04-18)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Properly tokenize the division operator directly after a function expression.
|
||||
|
||||
Allow trailing comma in destructuring arrays.
|
||||
|
||||
## 3.0.4 (2016-02-25)
|
||||
|
||||
### Fixes
|
||||
|
||||
Allow update expressions as left-hand-side of the ES7 exponential operator.
|
||||
|
||||
## 3.0.2 (2016-02-10)
|
||||
|
||||
### Fixes
|
||||
|
||||
Fix bug that accidentally made `undefined` a reserved word when parsing ES7.
|
||||
|
||||
## 3.0.0 (2016-02-10)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
The default value of the `ecmaVersion` option is now 6 (used to be 5).
|
||||
|
||||
Support for comprehension syntax (which was dropped from the draft spec) has been removed.
|
||||
|
||||
### Fixes
|
||||
|
||||
`let` and `yield` are now “contextual keywords”, meaning you can mostly use them as identifiers in ES5 non-strict code.
|
||||
|
||||
A parenthesized class or function expression after `export default` is now parsed correctly.
|
||||
|
||||
### New features
|
||||
|
||||
When `ecmaVersion` is set to 7, Acorn will parse the exponentiation operator (`**`).
|
||||
|
||||
The identifier character ranges are now based on Unicode 8.0.0.
|
||||
|
||||
Plugins can now override the `raiseRecoverable` method to override the way non-critical errors are handled.
|
||||
|
||||
## 2.7.0 (2016-01-04)
|
||||
|
||||
### Fixes
|
||||
|
||||
Stop allowing rest parameters in setters.
|
||||
|
||||
Disallow `y` rexexp flag in ES5.
|
||||
|
||||
Disallow `\00` and `\000` escapes in strict mode.
|
||||
|
||||
Raise an error when an import name is a reserved word.
|
||||
|
||||
## 2.6.2 (2015-11-10)
|
||||
|
||||
### Fixes
|
||||
|
||||
Don't crash when no options object is passed.
|
||||
|
||||
## 2.6.0 (2015-11-09)
|
||||
|
||||
### Fixes
|
||||
|
||||
Add `await` as a reserved word in module sources.
|
||||
|
||||
Disallow `yield` in a parameter default value for a generator.
|
||||
|
||||
Forbid using a comma after a rest pattern in an array destructuring.
|
||||
|
||||
### New features
|
||||
|
||||
Support parsing stdin in command-line tool.
|
||||
|
||||
## 2.5.0 (2015-10-27)
|
||||
|
||||
### Fixes
|
||||
|
||||
Fix tokenizer support in the command-line tool.
|
||||
|
||||
Stop allowing `new.target` outside of functions.
|
||||
|
||||
Remove legacy `guard` and `guardedHandler` properties from try nodes.
|
||||
|
||||
Stop allowing multiple `__proto__` properties on an object literal in strict mode.
|
||||
|
||||
Don't allow rest parameters to be non-identifier patterns.
|
||||
|
||||
Check for duplicate paramter names in arrow functions.
|
21
node_modules/jsdom/node_modules/acorn/LICENSE
generated
vendored
Normal file
21
node_modules/jsdom/node_modules/acorn/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2012-2018 by various contributors (see AUTHORS)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
269
node_modules/jsdom/node_modules/acorn/README.md
generated
vendored
Normal file
269
node_modules/jsdom/node_modules/acorn/README.md
generated
vendored
Normal file
@@ -0,0 +1,269 @@
|
||||
# Acorn
|
||||
|
||||
A tiny, fast JavaScript parser written in JavaScript.
|
||||
|
||||
## Community
|
||||
|
||||
Acorn is open source software released under an
|
||||
[MIT license](https://github.com/acornjs/acorn/blob/master/acorn/LICENSE).
|
||||
|
||||
You are welcome to
|
||||
[report bugs](https://github.com/acornjs/acorn/issues) or create pull
|
||||
requests on [github](https://github.com/acornjs/acorn). For questions
|
||||
and discussion, please use the
|
||||
[Tern discussion forum](https://discuss.ternjs.net).
|
||||
|
||||
## Installation
|
||||
|
||||
The easiest way to install acorn is from [`npm`](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
npm install acorn
|
||||
```
|
||||
|
||||
Alternately, you can download the source and build acorn yourself:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/acornjs/acorn.git
|
||||
cd acorn
|
||||
npm install
|
||||
```
|
||||
|
||||
## Interface
|
||||
|
||||
**parse**`(input, options)` is the main interface to the library. The
|
||||
`input` parameter is a string, `options` can be undefined or an object
|
||||
setting some of the options listed below. The return value will be an
|
||||
abstract syntax tree object as specified by the [ESTree
|
||||
spec](https://github.com/estree/estree).
|
||||
|
||||
```javascript
|
||||
let acorn = require("acorn");
|
||||
console.log(acorn.parse("1 + 1"));
|
||||
```
|
||||
|
||||
When encountering a syntax error, the parser will raise a
|
||||
`SyntaxError` object with a meaningful message. The error object will
|
||||
have a `pos` property that indicates the string offset at which the
|
||||
error occurred, and a `loc` object that contains a `{line, column}`
|
||||
object referring to that same position.
|
||||
|
||||
Options can be provided by passing a second argument, which should be
|
||||
an object containing any of these fields:
|
||||
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
||||
either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019) or 11
|
||||
(2020, partial support). This influences support for strict mode,
|
||||
the set of reserved words, and support for new syntax features.
|
||||
Default is 10.
|
||||
|
||||
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||
implemented by Acorn. Other proposed new features can be implemented
|
||||
through plugins.
|
||||
|
||||
- **sourceType**: Indicate the mode the code should be parsed in. Can be
|
||||
either `"script"` or `"module"`. This influences global strict mode
|
||||
and parsing of `import` and `export` declarations.
|
||||
|
||||
**NOTE**: If set to `"module"`, then static `import` / `export` syntax
|
||||
will be valid, even if `ecmaVersion` is less than 6.
|
||||
|
||||
- **onInsertedSemicolon**: If given a callback, that callback will be
|
||||
called whenever a missing semicolon is inserted by the parser. The
|
||||
callback will be given the character offset of the point where the
|
||||
semicolon is inserted as argument, and if `locations` is on, also a
|
||||
`{line, column}` object representing this position.
|
||||
|
||||
- **onTrailingComma**: Like `onInsertedSemicolon`, but for trailing
|
||||
commas.
|
||||
|
||||
- **allowReserved**: If `false`, using a reserved word will generate
|
||||
an error. Defaults to `true` for `ecmaVersion` 3, `false` for higher
|
||||
versions. When given the value `"never"`, reserved words and
|
||||
keywords can also not be used as property names (as in Internet
|
||||
Explorer's old parser).
|
||||
|
||||
- **allowReturnOutsideFunction**: By default, a return statement at
|
||||
the top level raises an error. Set this to `true` to accept such
|
||||
code.
|
||||
|
||||
- **allowImportExportEverywhere**: By default, `import` and `export`
|
||||
declarations can only appear at a program's top level. Setting this
|
||||
option to `true` allows them anywhere where a statement is allowed.
|
||||
|
||||
- **allowAwaitOutsideFunction**: By default, `await` expressions can
|
||||
only appear inside `async` functions. Setting this option to
|
||||
`true` allows to have top-level `await` expressions. They are
|
||||
still not allowed in non-`async` functions, though.
|
||||
|
||||
- **allowHashBang**: When this is enabled (off by default), if the
|
||||
code starts with the characters `#!` (as in a shellscript), the
|
||||
first line will be treated as a comment.
|
||||
|
||||
- **locations**: When `true`, each node has a `loc` object attached
|
||||
with `start` and `end` subobjects, each of which contains the
|
||||
one-based line and zero-based column numbers in `{line, column}`
|
||||
form. Default is `false`.
|
||||
|
||||
- **onToken**: If a function is passed for this option, each found
|
||||
token will be passed in same format as tokens returned from
|
||||
`tokenizer().getToken()`.
|
||||
|
||||
If array is passed, each found token is pushed to it.
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **onComment**: If a function is passed for this option, whenever a
|
||||
comment is encountered the function will be called with the
|
||||
following parameters:
|
||||
|
||||
- `block`: `true` if the comment is a block comment, false if it
|
||||
is a line comment.
|
||||
- `text`: The content of the comment.
|
||||
- `start`: Character offset of the start of the comment.
|
||||
- `end`: Character offset of the end of the comment.
|
||||
|
||||
When the `locations` options is on, the `{line, column}` locations
|
||||
of the comment’s start and end are passed as two additional
|
||||
parameters.
|
||||
|
||||
If array is passed for this option, each found comment is pushed
|
||||
to it as object in Esprima format:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"type": "Line" | "Block",
|
||||
"value": "comment text",
|
||||
"start": Number,
|
||||
"end": Number,
|
||||
// If `locations` option is on:
|
||||
"loc": {
|
||||
"start": {line: Number, column: Number}
|
||||
"end": {line: Number, column: Number}
|
||||
},
|
||||
// If `ranges` option is on:
|
||||
"range": [Number, Number]
|
||||
}
|
||||
```
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **ranges**: Nodes have their start and end characters offsets
|
||||
recorded in `start` and `end` properties (directly on the node,
|
||||
rather than the `loc` object, which holds line/column data. To also
|
||||
add a
|
||||
[semi-standardized](https://bugzilla.mozilla.org/show_bug.cgi?id=745678)
|
||||
`range` property holding a `[start, end]` array with the same
|
||||
numbers, set the `ranges` option to `true`.
|
||||
|
||||
- **program**: It is possible to parse multiple files into a single
|
||||
AST by passing the tree produced by parsing the first file as the
|
||||
`program` option in subsequent parses. This will add the toplevel
|
||||
forms of the parsed file to the "Program" (top) node of an existing
|
||||
parse tree.
|
||||
|
||||
- **sourceFile**: When the `locations` option is `true`, you can pass
|
||||
this option to add a `source` attribute in every node’s `loc`
|
||||
object. Note that the contents of this option are not examined or
|
||||
processed in any way; you are free to use whatever format you
|
||||
choose.
|
||||
|
||||
- **directSourceFile**: Like `sourceFile`, but a `sourceFile` property
|
||||
will be added (regardless of the `location` option) directly to the
|
||||
nodes, rather than the `loc` object.
|
||||
|
||||
- **preserveParens**: If this option is `true`, parenthesized expressions
|
||||
are represented by (non-standard) `ParenthesizedExpression` nodes
|
||||
that have a single `expression` property containing the expression
|
||||
inside parentheses.
|
||||
|
||||
**parseExpressionAt**`(input, offset, options)` will parse a single
|
||||
expression in a string, and return its AST. It will not complain if
|
||||
there is more of the string left after the expression.
|
||||
|
||||
**tokenizer**`(input, options)` returns an object with a `getToken`
|
||||
method that can be called repeatedly to get the next token, a `{start,
|
||||
end, type, value}` object (with added `loc` property when the
|
||||
`locations` option is enabled and `range` property when the `ranges`
|
||||
option is enabled). When the token's type is `tokTypes.eof`, you
|
||||
should stop calling the method, since it will keep returning that same
|
||||
token forever.
|
||||
|
||||
In ES6 environment, returned result can be used as any other
|
||||
protocol-compliant iterable:
|
||||
|
||||
```javascript
|
||||
for (let token of acorn.tokenizer(str)) {
|
||||
// iterate over the tokens
|
||||
}
|
||||
|
||||
// transform code to array of tokens:
|
||||
var tokens = [...acorn.tokenizer(str)];
|
||||
```
|
||||
|
||||
**tokTypes** holds an object mapping names to the token type objects
|
||||
that end up in the `type` properties of tokens.
|
||||
|
||||
**getLineInfo**`(input, offset)` can be used to get a `{line,
|
||||
column}` object for a given program string and offset.
|
||||
|
||||
### The `Parser` class
|
||||
|
||||
Instances of the **`Parser`** class contain all the state and logic
|
||||
that drives a parse. It has static methods `parse`,
|
||||
`parseExpressionAt`, and `tokenizer` that match the top-level
|
||||
functions by the same name.
|
||||
|
||||
When extending the parser with plugins, you need to call these methods
|
||||
on the extended version of the class. To extend a parser with plugins,
|
||||
you can use its static `extend` method.
|
||||
|
||||
```javascript
|
||||
var acorn = require("acorn");
|
||||
var jsx = require("acorn-jsx");
|
||||
var JSXParser = acorn.Parser.extend(jsx());
|
||||
JSXParser.parse("foo(<bar/>)");
|
||||
```
|
||||
|
||||
The `extend` method takes any number of plugin values, and returns a
|
||||
new `Parser` class that includes the extra parser logic provided by
|
||||
the plugins.
|
||||
|
||||
## Command line interface
|
||||
|
||||
The `bin/acorn` utility can be used to parse a file from the command
|
||||
line. It accepts as arguments its input file and the following
|
||||
options:
|
||||
|
||||
- `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10`: Sets the ECMAScript version
|
||||
to parse. Default is version 9.
|
||||
|
||||
- `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise.
|
||||
|
||||
- `--locations`: Attaches a "loc" object to each node with "start" and
|
||||
"end" subobjects, each of which contains the one-based line and
|
||||
zero-based column numbers in `{line, column}` form.
|
||||
|
||||
- `--allow-hash-bang`: If the code starts with the characters #! (as
|
||||
in a shellscript), the first line will be treated as a comment.
|
||||
|
||||
- `--compact`: No whitespace is used in the AST output.
|
||||
|
||||
- `--silent`: Do not output the AST, just return the exit status.
|
||||
|
||||
- `--help`: Print the usage information and quit.
|
||||
|
||||
The utility spits out the syntax tree as JSON data.
|
||||
|
||||
## Existing plugins
|
||||
|
||||
- [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx)
|
||||
|
||||
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-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods)n
|
4
node_modules/jsdom/node_modules/acorn/bin/acorn
generated
vendored
Normal file
4
node_modules/jsdom/node_modules/acorn/bin/acorn
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
require('../dist/bin.js');
|
209
node_modules/jsdom/node_modules/acorn/dist/acorn.d.ts
generated
vendored
Normal file
209
node_modules/jsdom/node_modules/acorn/dist/acorn.d.ts
generated
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
export as namespace acorn
|
||||
export = acorn
|
||||
|
||||
declare namespace acorn {
|
||||
function parse(input: string, options?: Options): Node
|
||||
|
||||
function parseExpressionAt(input: string, pos?: number, options?: Options): Node
|
||||
|
||||
function tokenizer(input: string, options?: Options): {
|
||||
getToken(): Token
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
|
||||
interface Options {
|
||||
ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020
|
||||
sourceType?: 'script' | 'module'
|
||||
onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||
onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||
allowReserved?: boolean | 'never'
|
||||
allowReturnOutsideFunction?: boolean
|
||||
allowImportExportEverywhere?: boolean
|
||||
allowAwaitOutsideFunction?: boolean
|
||||
allowHashBang?: boolean
|
||||
locations?: boolean
|
||||
onToken?: ((token: Token) => any) | Token[]
|
||||
onComment?: ((
|
||||
isBlock: boolean, text: string, start: number, end: number, startLoc?: Position,
|
||||
endLoc?: Position
|
||||
) => void) | Comment[]
|
||||
ranges?: boolean
|
||||
program?: Node
|
||||
sourceFile?: string
|
||||
directSourceFile?: string
|
||||
preserveParens?: boolean
|
||||
}
|
||||
|
||||
class Parser {
|
||||
constructor(options: Options, input: string, startPos?: number)
|
||||
parse(this: Parser): Node
|
||||
static parse(this: typeof Parser, input: string, options?: Options): Node
|
||||
static parseExpressionAt(this: typeof Parser, input: string, pos: number, options?: Options): Node
|
||||
static tokenizer(this: typeof Parser, input: string, options?: Options): {
|
||||
getToken(): Token
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
static extend(this: typeof Parser, ...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser
|
||||
}
|
||||
|
||||
interface Position { line: number; column: number; offset: number }
|
||||
|
||||
const defaultOptions: Options
|
||||
|
||||
function getLineInfo(input: string, offset: number): Position
|
||||
|
||||
class SourceLocation {
|
||||
start: Position
|
||||
end: Position
|
||||
source?: string | null
|
||||
constructor(p: Parser, start: Position, end: Position)
|
||||
}
|
||||
|
||||
class Node {
|
||||
type: string
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
sourceFile?: string
|
||||
range?: [number, number]
|
||||
constructor(parser: Parser, pos: number, loc?: SourceLocation)
|
||||
}
|
||||
|
||||
class TokenType {
|
||||
label: string
|
||||
keyword: string
|
||||
beforeExpr: boolean
|
||||
startsExpr: boolean
|
||||
isLoop: boolean
|
||||
isAssign: boolean
|
||||
prefix: boolean
|
||||
postfix: boolean
|
||||
binop: number
|
||||
updateContext?: (prevType: TokenType) => void
|
||||
constructor(label: string, conf?: any)
|
||||
}
|
||||
|
||||
const tokTypes: {
|
||||
num: TokenType
|
||||
regexp: TokenType
|
||||
string: TokenType
|
||||
name: TokenType
|
||||
eof: TokenType
|
||||
bracketL: TokenType
|
||||
bracketR: TokenType
|
||||
braceL: TokenType
|
||||
braceR: TokenType
|
||||
parenL: TokenType
|
||||
parenR: TokenType
|
||||
comma: TokenType
|
||||
semi: TokenType
|
||||
colon: TokenType
|
||||
dot: TokenType
|
||||
question: TokenType
|
||||
arrow: TokenType
|
||||
template: TokenType
|
||||
ellipsis: TokenType
|
||||
backQuote: TokenType
|
||||
dollarBraceL: TokenType
|
||||
eq: TokenType
|
||||
assign: TokenType
|
||||
incDec: TokenType
|
||||
prefix: TokenType
|
||||
logicalOR: TokenType
|
||||
logicalAND: TokenType
|
||||
bitwiseOR: TokenType
|
||||
bitwiseXOR: TokenType
|
||||
bitwiseAND: TokenType
|
||||
equality: TokenType
|
||||
relational: TokenType
|
||||
bitShift: TokenType
|
||||
plusMin: TokenType
|
||||
modulo: TokenType
|
||||
star: TokenType
|
||||
slash: TokenType
|
||||
starstar: TokenType
|
||||
_break: TokenType
|
||||
_case: TokenType
|
||||
_catch: TokenType
|
||||
_continue: TokenType
|
||||
_debugger: TokenType
|
||||
_default: TokenType
|
||||
_do: TokenType
|
||||
_else: TokenType
|
||||
_finally: TokenType
|
||||
_for: TokenType
|
||||
_function: TokenType
|
||||
_if: TokenType
|
||||
_return: TokenType
|
||||
_switch: TokenType
|
||||
_throw: TokenType
|
||||
_try: TokenType
|
||||
_var: TokenType
|
||||
_const: TokenType
|
||||
_while: TokenType
|
||||
_with: TokenType
|
||||
_new: TokenType
|
||||
_this: TokenType
|
||||
_super: TokenType
|
||||
_class: TokenType
|
||||
_extends: TokenType
|
||||
_export: TokenType
|
||||
_import: TokenType
|
||||
_null: TokenType
|
||||
_true: TokenType
|
||||
_false: TokenType
|
||||
_in: TokenType
|
||||
_instanceof: TokenType
|
||||
_typeof: TokenType
|
||||
_void: TokenType
|
||||
_delete: TokenType
|
||||
}
|
||||
|
||||
class TokContext {
|
||||
constructor(token: string, isExpr: boolean, preserveSpace: boolean, override?: (p: Parser) => void)
|
||||
}
|
||||
|
||||
const tokContexts: {
|
||||
b_stat: TokContext
|
||||
b_expr: TokContext
|
||||
b_tmpl: TokContext
|
||||
p_stat: TokContext
|
||||
p_expr: TokContext
|
||||
q_tmpl: TokContext
|
||||
f_expr: TokContext
|
||||
}
|
||||
|
||||
function isIdentifierStart(code: number, astral?: boolean): boolean
|
||||
|
||||
function isIdentifierChar(code: number, astral?: boolean): boolean
|
||||
|
||||
interface AbstractToken {
|
||||
}
|
||||
|
||||
interface Comment extends AbstractToken {
|
||||
type: string
|
||||
value: string
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
range?: [number, number]
|
||||
}
|
||||
|
||||
class Token {
|
||||
type: TokenType
|
||||
value: any
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
range?: [number, number]
|
||||
constructor(p: Parser)
|
||||
}
|
||||
|
||||
function isNewLine(code: number): boolean
|
||||
|
||||
const lineBreak: RegExp
|
||||
|
||||
const lineBreakG: RegExp
|
||||
|
||||
const version: string
|
||||
}
|
5186
node_modules/jsdom/node_modules/acorn/dist/acorn.js
generated
vendored
Normal file
5186
node_modules/jsdom/node_modules/acorn/dist/acorn.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/jsdom/node_modules/acorn/dist/acorn.js.map
generated
vendored
Normal file
1
node_modules/jsdom/node_modules/acorn/dist/acorn.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5155
node_modules/jsdom/node_modules/acorn/dist/acorn.mjs
generated
vendored
Normal file
5155
node_modules/jsdom/node_modules/acorn/dist/acorn.mjs
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
node_modules/jsdom/node_modules/acorn/dist/acorn.mjs.d.ts
generated
vendored
Normal file
2
node_modules/jsdom/node_modules/acorn/dist/acorn.mjs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import * as acorn from "./acorn";
|
||||
export = acorn;
|
1
node_modules/jsdom/node_modules/acorn/dist/acorn.mjs.map
generated
vendored
Normal file
1
node_modules/jsdom/node_modules/acorn/dist/acorn.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
64
node_modules/jsdom/node_modules/acorn/dist/bin.js
generated
vendored
Normal file
64
node_modules/jsdom/node_modules/acorn/dist/bin.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var acorn = require('./acorn.js');
|
||||
|
||||
var infile, forceFile, silent = false, compact = false, tokenize = false;
|
||||
var options = {};
|
||||
|
||||
function help(status) {
|
||||
var print = (status === 0) ? console.log : console.error;
|
||||
print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
|
||||
print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]");
|
||||
process.exit(status);
|
||||
}
|
||||
|
||||
for (var i = 2; i < process.argv.length; ++i) {
|
||||
var arg = process.argv[i];
|
||||
if ((arg === "-" || arg[0] !== "-") && !infile) { infile = arg; }
|
||||
else if (arg === "--" && !infile && i + 2 === process.argv.length) { forceFile = infile = process.argv[++i]; }
|
||||
else if (arg === "--locations") { options.locations = true; }
|
||||
else if (arg === "--allow-hash-bang") { options.allowHashBang = true; }
|
||||
else if (arg === "--silent") { silent = true; }
|
||||
else if (arg === "--compact") { compact = true; }
|
||||
else if (arg === "--help") { help(0); }
|
||||
else if (arg === "--tokenize") { tokenize = true; }
|
||||
else if (arg === "--module") { options.sourceType = "module"; }
|
||||
else {
|
||||
var match = arg.match(/^--ecma(\d+)$/);
|
||||
if (match)
|
||||
{ options.ecmaVersion = +match[1]; }
|
||||
else
|
||||
{ help(1); }
|
||||
}
|
||||
}
|
||||
|
||||
function run(code) {
|
||||
var result;
|
||||
try {
|
||||
if (!tokenize) {
|
||||
result = acorn.parse(code, options);
|
||||
} else {
|
||||
result = [];
|
||||
var tokenizer = acorn.tokenizer(code, options), token;
|
||||
do {
|
||||
token = tokenizer.getToken();
|
||||
result.push(token);
|
||||
} while (token.type !== acorn.tokTypes.eof)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(infile && infile !== "-" ? e.message.replace(/\(\d+:\d+\)$/, function (m) { return m.slice(0, 1) + infile + " " + m.slice(1); }) : e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); }
|
||||
}
|
||||
|
||||
if (forceFile || infile && infile !== "-") {
|
||||
run(fs.readFileSync(infile, "utf8"));
|
||||
} else {
|
||||
var code = "";
|
||||
process.stdin.resume();
|
||||
process.stdin.on("data", function (chunk) { return code += chunk; });
|
||||
process.stdin.on("end", function () { return run(code); });
|
||||
}
|
67
node_modules/jsdom/node_modules/acorn/package.json
generated
vendored
Normal file
67
node_modules/jsdom/node_modules/acorn/package.json
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"_from": "acorn@^7.1.1",
|
||||
"_id": "acorn@7.4.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
|
||||
"_location": "/jsdom/acorn",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "acorn@^7.1.1",
|
||||
"name": "acorn",
|
||||
"escapedName": "acorn",
|
||||
"rawSpec": "^7.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jsdom"
|
||||
],
|
||||
"_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": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/acornjs/acorn/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "ECMAScript parser",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
},
|
||||
"homepage": "https://github.com/acornjs/acorn",
|
||||
"license": "MIT",
|
||||
"main": "dist/acorn.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Marijn Haverbeke",
|
||||
"email": "marijnh@gmail.com",
|
||||
"url": "https://marijnhaverbeke.nl"
|
||||
},
|
||||
{
|
||||
"name": "Ingvar Stepanyan",
|
||||
"email": "me@rreverser.com",
|
||||
"url": "https://rreverser.com/"
|
||||
},
|
||||
{
|
||||
"name": "Adrian Heine",
|
||||
"url": "http://adrianheine.de"
|
||||
}
|
||||
],
|
||||
"module": "dist/acorn.mjs",
|
||||
"name": "acorn",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/acornjs/acorn.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "cd ..; npm run build:main && npm run build:bin"
|
||||
},
|
||||
"types": "dist/acorn.d.ts",
|
||||
"version": "7.4.1"
|
||||
}
|
19
node_modules/jsdom/node_modules/parse5/LICENSE
generated
vendored
Normal file
19
node_modules/jsdom/node_modules/parse5/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2013-2019 Ivan Nikulin (ifaaan@gmail.com, https://github.com/inikulin)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
38
node_modules/jsdom/node_modules/parse5/README.md
generated
vendored
Normal file
38
node_modules/jsdom/node_modules/parse5/README.md
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<p align="center">
|
||||
<a href="https://github.com/inikulin/parse5">
|
||||
<img src="https://raw.github.com/inikulin/parse5/master/media/logo.png" alt="parse5" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
<h1>parse5</h1>
|
||||
<i><b>HTML parser and serializer.</b></i>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<div align="center">
|
||||
<code>npm install --save parse5</code>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<p align="center">
|
||||
📖 <a href="https://github.com/inikulin/parse5/tree/master/packages/parse5/docs/index.md"><b>Documentation</b></a> 📖
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/inikulin/parse5/tree/master/docs/list-of-packages.md">List of parse5 toolset packages</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/inikulin/parse5">GitHub</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="http://astexplorer.net/#/1CHlCXc4n4">Online playground</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/inikulin/parse5/tree/master/docs/version-history.md">Version history</a>
|
||||
</p>
|
162
node_modules/jsdom/node_modules/parse5/lib/common/doctype.js
generated
vendored
Normal file
162
node_modules/jsdom/node_modules/parse5/lib/common/doctype.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
'use strict';
|
||||
|
||||
const { DOCUMENT_MODE } = require('./html');
|
||||
|
||||
//Const
|
||||
const VALID_DOCTYPE_NAME = 'html';
|
||||
const VALID_SYSTEM_ID = 'about:legacy-compat';
|
||||
const QUIRKS_MODE_SYSTEM_ID = 'http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd';
|
||||
|
||||
const QUIRKS_MODE_PUBLIC_ID_PREFIXES = [
|
||||
'+//silmaril//dtd html pro v0r11 19970101//',
|
||||
'-//as//dtd html 3.0 aswedit + extensions//',
|
||||
'-//advasoft ltd//dtd html 3.0 aswedit + extensions//',
|
||||
'-//ietf//dtd html 2.0 level 1//',
|
||||
'-//ietf//dtd html 2.0 level 2//',
|
||||
'-//ietf//dtd html 2.0 strict level 1//',
|
||||
'-//ietf//dtd html 2.0 strict level 2//',
|
||||
'-//ietf//dtd html 2.0 strict//',
|
||||
'-//ietf//dtd html 2.0//',
|
||||
'-//ietf//dtd html 2.1e//',
|
||||
'-//ietf//dtd html 3.0//',
|
||||
'-//ietf//dtd html 3.2 final//',
|
||||
'-//ietf//dtd html 3.2//',
|
||||
'-//ietf//dtd html 3//',
|
||||
'-//ietf//dtd html level 0//',
|
||||
'-//ietf//dtd html level 1//',
|
||||
'-//ietf//dtd html level 2//',
|
||||
'-//ietf//dtd html level 3//',
|
||||
'-//ietf//dtd html strict level 0//',
|
||||
'-//ietf//dtd html strict level 1//',
|
||||
'-//ietf//dtd html strict level 2//',
|
||||
'-//ietf//dtd html strict level 3//',
|
||||
'-//ietf//dtd html strict//',
|
||||
'-//ietf//dtd html//',
|
||||
'-//metrius//dtd metrius presentational//',
|
||||
'-//microsoft//dtd internet explorer 2.0 html strict//',
|
||||
'-//microsoft//dtd internet explorer 2.0 html//',
|
||||
'-//microsoft//dtd internet explorer 2.0 tables//',
|
||||
'-//microsoft//dtd internet explorer 3.0 html strict//',
|
||||
'-//microsoft//dtd internet explorer 3.0 html//',
|
||||
'-//microsoft//dtd internet explorer 3.0 tables//',
|
||||
'-//netscape comm. corp.//dtd html//',
|
||||
'-//netscape comm. corp.//dtd strict html//',
|
||||
"-//o'reilly and associates//dtd html 2.0//",
|
||||
"-//o'reilly and associates//dtd html extended 1.0//",
|
||||
"-//o'reilly and associates//dtd html extended relaxed 1.0//",
|
||||
'-//sq//dtd html 2.0 hotmetal + extensions//',
|
||||
'-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//',
|
||||
'-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//',
|
||||
'-//spyglass//dtd html 2.0 extended//',
|
||||
'-//sun microsystems corp.//dtd hotjava html//',
|
||||
'-//sun microsystems corp.//dtd hotjava strict html//',
|
||||
'-//w3c//dtd html 3 1995-03-24//',
|
||||
'-//w3c//dtd html 3.2 draft//',
|
||||
'-//w3c//dtd html 3.2 final//',
|
||||
'-//w3c//dtd html 3.2//',
|
||||
'-//w3c//dtd html 3.2s draft//',
|
||||
'-//w3c//dtd html 4.0 frameset//',
|
||||
'-//w3c//dtd html 4.0 transitional//',
|
||||
'-//w3c//dtd html experimental 19960712//',
|
||||
'-//w3c//dtd html experimental 970421//',
|
||||
'-//w3c//dtd w3 html//',
|
||||
'-//w3o//dtd w3 html 3.0//',
|
||||
'-//webtechs//dtd mozilla html 2.0//',
|
||||
'-//webtechs//dtd mozilla html//'
|
||||
];
|
||||
|
||||
const QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = QUIRKS_MODE_PUBLIC_ID_PREFIXES.concat([
|
||||
'-//w3c//dtd html 4.01 frameset//',
|
||||
'-//w3c//dtd html 4.01 transitional//'
|
||||
]);
|
||||
|
||||
const QUIRKS_MODE_PUBLIC_IDS = ['-//w3o//dtd w3 html strict 3.0//en//', '-/w3c/dtd html 4.0 transitional/en', 'html'];
|
||||
const LIMITED_QUIRKS_PUBLIC_ID_PREFIXES = ['-//w3c//dtd xhtml 1.0 frameset//', '-//w3c//dtd xhtml 1.0 transitional//'];
|
||||
|
||||
const LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES = LIMITED_QUIRKS_PUBLIC_ID_PREFIXES.concat([
|
||||
'-//w3c//dtd html 4.01 frameset//',
|
||||
'-//w3c//dtd html 4.01 transitional//'
|
||||
]);
|
||||
|
||||
//Utils
|
||||
function enquoteDoctypeId(id) {
|
||||
const quote = id.indexOf('"') !== -1 ? "'" : '"';
|
||||
|
||||
return quote + id + quote;
|
||||
}
|
||||
|
||||
function hasPrefix(publicId, prefixes) {
|
||||
for (let i = 0; i < prefixes.length; i++) {
|
||||
if (publicId.indexOf(prefixes[i]) === 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//API
|
||||
exports.isConforming = function(token) {
|
||||
return (
|
||||
token.name === VALID_DOCTYPE_NAME &&
|
||||
token.publicId === null &&
|
||||
(token.systemId === null || token.systemId === VALID_SYSTEM_ID)
|
||||
);
|
||||
};
|
||||
|
||||
exports.getDocumentMode = function(token) {
|
||||
if (token.name !== VALID_DOCTYPE_NAME) {
|
||||
return DOCUMENT_MODE.QUIRKS;
|
||||
}
|
||||
|
||||
const systemId = token.systemId;
|
||||
|
||||
if (systemId && systemId.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) {
|
||||
return DOCUMENT_MODE.QUIRKS;
|
||||
}
|
||||
|
||||
let publicId = token.publicId;
|
||||
|
||||
if (publicId !== null) {
|
||||
publicId = publicId.toLowerCase();
|
||||
|
||||
if (QUIRKS_MODE_PUBLIC_IDS.indexOf(publicId) > -1) {
|
||||
return DOCUMENT_MODE.QUIRKS;
|
||||
}
|
||||
|
||||
let prefixes = systemId === null ? QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES : QUIRKS_MODE_PUBLIC_ID_PREFIXES;
|
||||
|
||||
if (hasPrefix(publicId, prefixes)) {
|
||||
return DOCUMENT_MODE.QUIRKS;
|
||||
}
|
||||
|
||||
prefixes =
|
||||
systemId === null ? LIMITED_QUIRKS_PUBLIC_ID_PREFIXES : LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES;
|
||||
|
||||
if (hasPrefix(publicId, prefixes)) {
|
||||
return DOCUMENT_MODE.LIMITED_QUIRKS;
|
||||
}
|
||||
}
|
||||
|
||||
return DOCUMENT_MODE.NO_QUIRKS;
|
||||
};
|
||||
|
||||
exports.serializeContent = function(name, publicId, systemId) {
|
||||
let str = '!DOCTYPE ';
|
||||
|
||||
if (name) {
|
||||
str += name;
|
||||
}
|
||||
|
||||
if (publicId) {
|
||||
str += ' PUBLIC ' + enquoteDoctypeId(publicId);
|
||||
} else if (systemId) {
|
||||
str += ' SYSTEM';
|
||||
}
|
||||
|
||||
if (systemId !== null) {
|
||||
str += ' ' + enquoteDoctypeId(systemId);
|
||||
}
|
||||
|
||||
return str;
|
||||
};
|
65
node_modules/jsdom/node_modules/parse5/lib/common/error-codes.js
generated
vendored
Normal file
65
node_modules/jsdom/node_modules/parse5/lib/common/error-codes.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
controlCharacterInInputStream: 'control-character-in-input-stream',
|
||||
noncharacterInInputStream: 'noncharacter-in-input-stream',
|
||||
surrogateInInputStream: 'surrogate-in-input-stream',
|
||||
nonVoidHtmlElementStartTagWithTrailingSolidus: 'non-void-html-element-start-tag-with-trailing-solidus',
|
||||
endTagWithAttributes: 'end-tag-with-attributes',
|
||||
endTagWithTrailingSolidus: 'end-tag-with-trailing-solidus',
|
||||
unexpectedSolidusInTag: 'unexpected-solidus-in-tag',
|
||||
unexpectedNullCharacter: 'unexpected-null-character',
|
||||
unexpectedQuestionMarkInsteadOfTagName: 'unexpected-question-mark-instead-of-tag-name',
|
||||
invalidFirstCharacterOfTagName: 'invalid-first-character-of-tag-name',
|
||||
unexpectedEqualsSignBeforeAttributeName: 'unexpected-equals-sign-before-attribute-name',
|
||||
missingEndTagName: 'missing-end-tag-name',
|
||||
unexpectedCharacterInAttributeName: 'unexpected-character-in-attribute-name',
|
||||
unknownNamedCharacterReference: 'unknown-named-character-reference',
|
||||
missingSemicolonAfterCharacterReference: 'missing-semicolon-after-character-reference',
|
||||
unexpectedCharacterAfterDoctypeSystemIdentifier: 'unexpected-character-after-doctype-system-identifier',
|
||||
unexpectedCharacterInUnquotedAttributeValue: 'unexpected-character-in-unquoted-attribute-value',
|
||||
eofBeforeTagName: 'eof-before-tag-name',
|
||||
eofInTag: 'eof-in-tag',
|
||||
missingAttributeValue: 'missing-attribute-value',
|
||||
missingWhitespaceBetweenAttributes: 'missing-whitespace-between-attributes',
|
||||
missingWhitespaceAfterDoctypePublicKeyword: 'missing-whitespace-after-doctype-public-keyword',
|
||||
missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:
|
||||
'missing-whitespace-between-doctype-public-and-system-identifiers',
|
||||
missingWhitespaceAfterDoctypeSystemKeyword: 'missing-whitespace-after-doctype-system-keyword',
|
||||
missingQuoteBeforeDoctypePublicIdentifier: 'missing-quote-before-doctype-public-identifier',
|
||||
missingQuoteBeforeDoctypeSystemIdentifier: 'missing-quote-before-doctype-system-identifier',
|
||||
missingDoctypePublicIdentifier: 'missing-doctype-public-identifier',
|
||||
missingDoctypeSystemIdentifier: 'missing-doctype-system-identifier',
|
||||
abruptDoctypePublicIdentifier: 'abrupt-doctype-public-identifier',
|
||||
abruptDoctypeSystemIdentifier: 'abrupt-doctype-system-identifier',
|
||||
cdataInHtmlContent: 'cdata-in-html-content',
|
||||
incorrectlyOpenedComment: 'incorrectly-opened-comment',
|
||||
eofInScriptHtmlCommentLikeText: 'eof-in-script-html-comment-like-text',
|
||||
eofInDoctype: 'eof-in-doctype',
|
||||
nestedComment: 'nested-comment',
|
||||
abruptClosingOfEmptyComment: 'abrupt-closing-of-empty-comment',
|
||||
eofInComment: 'eof-in-comment',
|
||||
incorrectlyClosedComment: 'incorrectly-closed-comment',
|
||||
eofInCdata: 'eof-in-cdata',
|
||||
absenceOfDigitsInNumericCharacterReference: 'absence-of-digits-in-numeric-character-reference',
|
||||
nullCharacterReference: 'null-character-reference',
|
||||
surrogateCharacterReference: 'surrogate-character-reference',
|
||||
characterReferenceOutsideUnicodeRange: 'character-reference-outside-unicode-range',
|
||||
controlCharacterReference: 'control-character-reference',
|
||||
noncharacterCharacterReference: 'noncharacter-character-reference',
|
||||
missingWhitespaceBeforeDoctypeName: 'missing-whitespace-before-doctype-name',
|
||||
missingDoctypeName: 'missing-doctype-name',
|
||||
invalidCharacterSequenceAfterDoctypeName: 'invalid-character-sequence-after-doctype-name',
|
||||
duplicateAttribute: 'duplicate-attribute',
|
||||
nonConformingDoctype: 'non-conforming-doctype',
|
||||
missingDoctype: 'missing-doctype',
|
||||
misplacedDoctype: 'misplaced-doctype',
|
||||
endTagWithoutMatchingOpenElement: 'end-tag-without-matching-open-element',
|
||||
closingOfElementWithOpenChildElements: 'closing-of-element-with-open-child-elements',
|
||||
disallowedContentInNoscriptInHead: 'disallowed-content-in-noscript-in-head',
|
||||
openElementsLeftAfterEof: 'open-elements-left-after-eof',
|
||||
abandonedHeadElementChild: 'abandoned-head-element-child',
|
||||
misplacedStartTagForHeadElement: 'misplaced-start-tag-for-head-element',
|
||||
nestedNoscriptInHead: 'nested-noscript-in-head',
|
||||
eofInElementThatCanContainOnlyText: 'eof-in-element-that-can-contain-only-text'
|
||||
};
|
265
node_modules/jsdom/node_modules/parse5/lib/common/foreign-content.js
generated
vendored
Normal file
265
node_modules/jsdom/node_modules/parse5/lib/common/foreign-content.js
generated
vendored
Normal file
@@ -0,0 +1,265 @@
|
||||
'use strict';
|
||||
|
||||
const Tokenizer = require('../tokenizer');
|
||||
const HTML = require('./html');
|
||||
|
||||
//Aliases
|
||||
const $ = HTML.TAG_NAMES;
|
||||
const NS = HTML.NAMESPACES;
|
||||
const ATTRS = HTML.ATTRS;
|
||||
|
||||
//MIME types
|
||||
const MIME_TYPES = {
|
||||
TEXT_HTML: 'text/html',
|
||||
APPLICATION_XML: 'application/xhtml+xml'
|
||||
};
|
||||
|
||||
//Attributes
|
||||
const DEFINITION_URL_ATTR = 'definitionurl';
|
||||
const ADJUSTED_DEFINITION_URL_ATTR = 'definitionURL';
|
||||
const SVG_ATTRS_ADJUSTMENT_MAP = {
|
||||
attributename: 'attributeName',
|
||||
attributetype: 'attributeType',
|
||||
basefrequency: 'baseFrequency',
|
||||
baseprofile: 'baseProfile',
|
||||
calcmode: 'calcMode',
|
||||
clippathunits: 'clipPathUnits',
|
||||
diffuseconstant: 'diffuseConstant',
|
||||
edgemode: 'edgeMode',
|
||||
filterunits: 'filterUnits',
|
||||
glyphref: 'glyphRef',
|
||||
gradienttransform: 'gradientTransform',
|
||||
gradientunits: 'gradientUnits',
|
||||
kernelmatrix: 'kernelMatrix',
|
||||
kernelunitlength: 'kernelUnitLength',
|
||||
keypoints: 'keyPoints',
|
||||
keysplines: 'keySplines',
|
||||
keytimes: 'keyTimes',
|
||||
lengthadjust: 'lengthAdjust',
|
||||
limitingconeangle: 'limitingConeAngle',
|
||||
markerheight: 'markerHeight',
|
||||
markerunits: 'markerUnits',
|
||||
markerwidth: 'markerWidth',
|
||||
maskcontentunits: 'maskContentUnits',
|
||||
maskunits: 'maskUnits',
|
||||
numoctaves: 'numOctaves',
|
||||
pathlength: 'pathLength',
|
||||
patterncontentunits: 'patternContentUnits',
|
||||
patterntransform: 'patternTransform',
|
||||
patternunits: 'patternUnits',
|
||||
pointsatx: 'pointsAtX',
|
||||
pointsaty: 'pointsAtY',
|
||||
pointsatz: 'pointsAtZ',
|
||||
preservealpha: 'preserveAlpha',
|
||||
preserveaspectratio: 'preserveAspectRatio',
|
||||
primitiveunits: 'primitiveUnits',
|
||||
refx: 'refX',
|
||||
refy: 'refY',
|
||||
repeatcount: 'repeatCount',
|
||||
repeatdur: 'repeatDur',
|
||||
requiredextensions: 'requiredExtensions',
|
||||
requiredfeatures: 'requiredFeatures',
|
||||
specularconstant: 'specularConstant',
|
||||
specularexponent: 'specularExponent',
|
||||
spreadmethod: 'spreadMethod',
|
||||
startoffset: 'startOffset',
|
||||
stddeviation: 'stdDeviation',
|
||||
stitchtiles: 'stitchTiles',
|
||||
surfacescale: 'surfaceScale',
|
||||
systemlanguage: 'systemLanguage',
|
||||
tablevalues: 'tableValues',
|
||||
targetx: 'targetX',
|
||||
targety: 'targetY',
|
||||
textlength: 'textLength',
|
||||
viewbox: 'viewBox',
|
||||
viewtarget: 'viewTarget',
|
||||
xchannelselector: 'xChannelSelector',
|
||||
ychannelselector: 'yChannelSelector',
|
||||
zoomandpan: 'zoomAndPan'
|
||||
};
|
||||
|
||||
const XML_ATTRS_ADJUSTMENT_MAP = {
|
||||
'xlink:actuate': { prefix: 'xlink', name: 'actuate', namespace: NS.XLINK },
|
||||
'xlink:arcrole': { prefix: 'xlink', name: 'arcrole', namespace: NS.XLINK },
|
||||
'xlink:href': { prefix: 'xlink', name: 'href', namespace: NS.XLINK },
|
||||
'xlink:role': { prefix: 'xlink', name: 'role', namespace: NS.XLINK },
|
||||
'xlink:show': { prefix: 'xlink', name: 'show', namespace: NS.XLINK },
|
||||
'xlink:title': { prefix: 'xlink', name: 'title', namespace: NS.XLINK },
|
||||
'xlink:type': { prefix: 'xlink', name: 'type', namespace: NS.XLINK },
|
||||
'xml:base': { prefix: 'xml', name: 'base', namespace: NS.XML },
|
||||
'xml:lang': { prefix: 'xml', name: 'lang', namespace: NS.XML },
|
||||
'xml:space': { prefix: 'xml', name: 'space', namespace: NS.XML },
|
||||
xmlns: { prefix: '', name: 'xmlns', namespace: NS.XMLNS },
|
||||
'xmlns:xlink': { prefix: 'xmlns', name: 'xlink', namespace: NS.XMLNS }
|
||||
};
|
||||
|
||||
//SVG tag names adjustment map
|
||||
const SVG_TAG_NAMES_ADJUSTMENT_MAP = (exports.SVG_TAG_NAMES_ADJUSTMENT_MAP = {
|
||||
altglyph: 'altGlyph',
|
||||
altglyphdef: 'altGlyphDef',
|
||||
altglyphitem: 'altGlyphItem',
|
||||
animatecolor: 'animateColor',
|
||||
animatemotion: 'animateMotion',
|
||||
animatetransform: 'animateTransform',
|
||||
clippath: 'clipPath',
|
||||
feblend: 'feBlend',
|
||||
fecolormatrix: 'feColorMatrix',
|
||||
fecomponenttransfer: 'feComponentTransfer',
|
||||
fecomposite: 'feComposite',
|
||||
feconvolvematrix: 'feConvolveMatrix',
|
||||
fediffuselighting: 'feDiffuseLighting',
|
||||
fedisplacementmap: 'feDisplacementMap',
|
||||
fedistantlight: 'feDistantLight',
|
||||
feflood: 'feFlood',
|
||||
fefunca: 'feFuncA',
|
||||
fefuncb: 'feFuncB',
|
||||
fefuncg: 'feFuncG',
|
||||
fefuncr: 'feFuncR',
|
||||
fegaussianblur: 'feGaussianBlur',
|
||||
feimage: 'feImage',
|
||||
femerge: 'feMerge',
|
||||
femergenode: 'feMergeNode',
|
||||
femorphology: 'feMorphology',
|
||||
feoffset: 'feOffset',
|
||||
fepointlight: 'fePointLight',
|
||||
fespecularlighting: 'feSpecularLighting',
|
||||
fespotlight: 'feSpotLight',
|
||||
fetile: 'feTile',
|
||||
feturbulence: 'feTurbulence',
|
||||
foreignobject: 'foreignObject',
|
||||
glyphref: 'glyphRef',
|
||||
lineargradient: 'linearGradient',
|
||||
radialgradient: 'radialGradient',
|
||||
textpath: 'textPath'
|
||||
});
|
||||
|
||||
//Tags that causes exit from foreign content
|
||||
const EXITS_FOREIGN_CONTENT = {
|
||||
[$.B]: true,
|
||||
[$.BIG]: true,
|
||||
[$.BLOCKQUOTE]: true,
|
||||
[$.BODY]: true,
|
||||
[$.BR]: true,
|
||||
[$.CENTER]: true,
|
||||
[$.CODE]: true,
|
||||
[$.DD]: true,
|
||||
[$.DIV]: true,
|
||||
[$.DL]: true,
|
||||
[$.DT]: true,
|
||||
[$.EM]: true,
|
||||
[$.EMBED]: true,
|
||||
[$.H1]: true,
|
||||
[$.H2]: true,
|
||||
[$.H3]: true,
|
||||
[$.H4]: true,
|
||||
[$.H5]: true,
|
||||
[$.H6]: true,
|
||||
[$.HEAD]: true,
|
||||
[$.HR]: true,
|
||||
[$.I]: true,
|
||||
[$.IMG]: true,
|
||||
[$.LI]: true,
|
||||
[$.LISTING]: true,
|
||||
[$.MENU]: true,
|
||||
[$.META]: true,
|
||||
[$.NOBR]: true,
|
||||
[$.OL]: true,
|
||||
[$.P]: true,
|
||||
[$.PRE]: true,
|
||||
[$.RUBY]: true,
|
||||
[$.S]: true,
|
||||
[$.SMALL]: true,
|
||||
[$.SPAN]: true,
|
||||
[$.STRONG]: true,
|
||||
[$.STRIKE]: true,
|
||||
[$.SUB]: true,
|
||||
[$.SUP]: true,
|
||||
[$.TABLE]: true,
|
||||
[$.TT]: true,
|
||||
[$.U]: true,
|
||||
[$.UL]: true,
|
||||
[$.VAR]: true
|
||||
};
|
||||
|
||||
//Check exit from foreign content
|
||||
exports.causesExit = function(startTagToken) {
|
||||
const tn = startTagToken.tagName;
|
||||
const isFontWithAttrs =
|
||||
tn === $.FONT &&
|
||||
(Tokenizer.getTokenAttr(startTagToken, ATTRS.COLOR) !== null ||
|
||||
Tokenizer.getTokenAttr(startTagToken, ATTRS.SIZE) !== null ||
|
||||
Tokenizer.getTokenAttr(startTagToken, ATTRS.FACE) !== null);
|
||||
|
||||
return isFontWithAttrs ? true : EXITS_FOREIGN_CONTENT[tn];
|
||||
};
|
||||
|
||||
//Token adjustments
|
||||
exports.adjustTokenMathMLAttrs = function(token) {
|
||||
for (let i = 0; i < token.attrs.length; i++) {
|
||||
if (token.attrs[i].name === DEFINITION_URL_ATTR) {
|
||||
token.attrs[i].name = ADJUSTED_DEFINITION_URL_ATTR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.adjustTokenSVGAttrs = function(token) {
|
||||
for (let i = 0; i < token.attrs.length; i++) {
|
||||
const adjustedAttrName = SVG_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name];
|
||||
|
||||
if (adjustedAttrName) {
|
||||
token.attrs[i].name = adjustedAttrName;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.adjustTokenXMLAttrs = function(token) {
|
||||
for (let i = 0; i < token.attrs.length; i++) {
|
||||
const adjustedAttrEntry = XML_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name];
|
||||
|
||||
if (adjustedAttrEntry) {
|
||||
token.attrs[i].prefix = adjustedAttrEntry.prefix;
|
||||
token.attrs[i].name = adjustedAttrEntry.name;
|
||||
token.attrs[i].namespace = adjustedAttrEntry.namespace;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.adjustTokenSVGTagName = function(token) {
|
||||
const adjustedTagName = SVG_TAG_NAMES_ADJUSTMENT_MAP[token.tagName];
|
||||
|
||||
if (adjustedTagName) {
|
||||
token.tagName = adjustedTagName;
|
||||
}
|
||||
};
|
||||
|
||||
//Integration points
|
||||
function isMathMLTextIntegrationPoint(tn, ns) {
|
||||
return ns === NS.MATHML && (tn === $.MI || tn === $.MO || tn === $.MN || tn === $.MS || tn === $.MTEXT);
|
||||
}
|
||||
|
||||
function isHtmlIntegrationPoint(tn, ns, attrs) {
|
||||
if (ns === NS.MATHML && tn === $.ANNOTATION_XML) {
|
||||
for (let i = 0; i < attrs.length; i++) {
|
||||
if (attrs[i].name === ATTRS.ENCODING) {
|
||||
const value = attrs[i].value.toLowerCase();
|
||||
|
||||
return value === MIME_TYPES.TEXT_HTML || value === MIME_TYPES.APPLICATION_XML;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ns === NS.SVG && (tn === $.FOREIGN_OBJECT || tn === $.DESC || tn === $.TITLE);
|
||||
}
|
||||
|
||||
exports.isIntegrationPoint = function(tn, ns, attrs, foreignNS) {
|
||||
if ((!foreignNS || foreignNS === NS.HTML) && isHtmlIntegrationPoint(tn, ns, attrs)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((!foreignNS || foreignNS === NS.MATHML) && isMathMLTextIntegrationPoint(tn, ns)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
272
node_modules/jsdom/node_modules/parse5/lib/common/html.js
generated
vendored
Normal file
272
node_modules/jsdom/node_modules/parse5/lib/common/html.js
generated
vendored
Normal file
@@ -0,0 +1,272 @@
|
||||
'use strict';
|
||||
|
||||
const NS = (exports.NAMESPACES = {
|
||||
HTML: 'http://www.w3.org/1999/xhtml',
|
||||
MATHML: 'http://www.w3.org/1998/Math/MathML',
|
||||
SVG: 'http://www.w3.org/2000/svg',
|
||||
XLINK: 'http://www.w3.org/1999/xlink',
|
||||
XML: 'http://www.w3.org/XML/1998/namespace',
|
||||
XMLNS: 'http://www.w3.org/2000/xmlns/'
|
||||
});
|
||||
|
||||
exports.ATTRS = {
|
||||
TYPE: 'type',
|
||||
ACTION: 'action',
|
||||
ENCODING: 'encoding',
|
||||
PROMPT: 'prompt',
|
||||
NAME: 'name',
|
||||
COLOR: 'color',
|
||||
FACE: 'face',
|
||||
SIZE: 'size'
|
||||
};
|
||||
|
||||
exports.DOCUMENT_MODE = {
|
||||
NO_QUIRKS: 'no-quirks',
|
||||
QUIRKS: 'quirks',
|
||||
LIMITED_QUIRKS: 'limited-quirks'
|
||||
};
|
||||
|
||||
const $ = (exports.TAG_NAMES = {
|
||||
A: 'a',
|
||||
ADDRESS: 'address',
|
||||
ANNOTATION_XML: 'annotation-xml',
|
||||
APPLET: 'applet',
|
||||
AREA: 'area',
|
||||
ARTICLE: 'article',
|
||||
ASIDE: 'aside',
|
||||
|
||||
B: 'b',
|
||||
BASE: 'base',
|
||||
BASEFONT: 'basefont',
|
||||
BGSOUND: 'bgsound',
|
||||
BIG: 'big',
|
||||
BLOCKQUOTE: 'blockquote',
|
||||
BODY: 'body',
|
||||
BR: 'br',
|
||||
BUTTON: 'button',
|
||||
|
||||
CAPTION: 'caption',
|
||||
CENTER: 'center',
|
||||
CODE: 'code',
|
||||
COL: 'col',
|
||||
COLGROUP: 'colgroup',
|
||||
|
||||
DD: 'dd',
|
||||
DESC: 'desc',
|
||||
DETAILS: 'details',
|
||||
DIALOG: 'dialog',
|
||||
DIR: 'dir',
|
||||
DIV: 'div',
|
||||
DL: 'dl',
|
||||
DT: 'dt',
|
||||
|
||||
EM: 'em',
|
||||
EMBED: 'embed',
|
||||
|
||||
FIELDSET: 'fieldset',
|
||||
FIGCAPTION: 'figcaption',
|
||||
FIGURE: 'figure',
|
||||
FONT: 'font',
|
||||
FOOTER: 'footer',
|
||||
FOREIGN_OBJECT: 'foreignObject',
|
||||
FORM: 'form',
|
||||
FRAME: 'frame',
|
||||
FRAMESET: 'frameset',
|
||||
|
||||
H1: 'h1',
|
||||
H2: 'h2',
|
||||
H3: 'h3',
|
||||
H4: 'h4',
|
||||
H5: 'h5',
|
||||
H6: 'h6',
|
||||
HEAD: 'head',
|
||||
HEADER: 'header',
|
||||
HGROUP: 'hgroup',
|
||||
HR: 'hr',
|
||||
HTML: 'html',
|
||||
|
||||
I: 'i',
|
||||
IMG: 'img',
|
||||
IMAGE: 'image',
|
||||
INPUT: 'input',
|
||||
IFRAME: 'iframe',
|
||||
|
||||
KEYGEN: 'keygen',
|
||||
|
||||
LABEL: 'label',
|
||||
LI: 'li',
|
||||
LINK: 'link',
|
||||
LISTING: 'listing',
|
||||
|
||||
MAIN: 'main',
|
||||
MALIGNMARK: 'malignmark',
|
||||
MARQUEE: 'marquee',
|
||||
MATH: 'math',
|
||||
MENU: 'menu',
|
||||
META: 'meta',
|
||||
MGLYPH: 'mglyph',
|
||||
MI: 'mi',
|
||||
MO: 'mo',
|
||||
MN: 'mn',
|
||||
MS: 'ms',
|
||||
MTEXT: 'mtext',
|
||||
|
||||
NAV: 'nav',
|
||||
NOBR: 'nobr',
|
||||
NOFRAMES: 'noframes',
|
||||
NOEMBED: 'noembed',
|
||||
NOSCRIPT: 'noscript',
|
||||
|
||||
OBJECT: 'object',
|
||||
OL: 'ol',
|
||||
OPTGROUP: 'optgroup',
|
||||
OPTION: 'option',
|
||||
|
||||
P: 'p',
|
||||
PARAM: 'param',
|
||||
PLAINTEXT: 'plaintext',
|
||||
PRE: 'pre',
|
||||
|
||||
RB: 'rb',
|
||||
RP: 'rp',
|
||||
RT: 'rt',
|
||||
RTC: 'rtc',
|
||||
RUBY: 'ruby',
|
||||
|
||||
S: 's',
|
||||
SCRIPT: 'script',
|
||||
SECTION: 'section',
|
||||
SELECT: 'select',
|
||||
SOURCE: 'source',
|
||||
SMALL: 'small',
|
||||
SPAN: 'span',
|
||||
STRIKE: 'strike',
|
||||
STRONG: 'strong',
|
||||
STYLE: 'style',
|
||||
SUB: 'sub',
|
||||
SUMMARY: 'summary',
|
||||
SUP: 'sup',
|
||||
|
||||
TABLE: 'table',
|
||||
TBODY: 'tbody',
|
||||
TEMPLATE: 'template',
|
||||
TEXTAREA: 'textarea',
|
||||
TFOOT: 'tfoot',
|
||||
TD: 'td',
|
||||
TH: 'th',
|
||||
THEAD: 'thead',
|
||||
TITLE: 'title',
|
||||
TR: 'tr',
|
||||
TRACK: 'track',
|
||||
TT: 'tt',
|
||||
|
||||
U: 'u',
|
||||
UL: 'ul',
|
||||
|
||||
SVG: 'svg',
|
||||
|
||||
VAR: 'var',
|
||||
|
||||
WBR: 'wbr',
|
||||
|
||||
XMP: 'xmp'
|
||||
});
|
||||
|
||||
exports.SPECIAL_ELEMENTS = {
|
||||
[NS.HTML]: {
|
||||
[$.ADDRESS]: true,
|
||||
[$.APPLET]: true,
|
||||
[$.AREA]: true,
|
||||
[$.ARTICLE]: true,
|
||||
[$.ASIDE]: true,
|
||||
[$.BASE]: true,
|
||||
[$.BASEFONT]: true,
|
||||
[$.BGSOUND]: true,
|
||||
[$.BLOCKQUOTE]: true,
|
||||
[$.BODY]: true,
|
||||
[$.BR]: true,
|
||||
[$.BUTTON]: true,
|
||||
[$.CAPTION]: true,
|
||||
[$.CENTER]: true,
|
||||
[$.COL]: true,
|
||||
[$.COLGROUP]: true,
|
||||
[$.DD]: true,
|
||||
[$.DETAILS]: true,
|
||||
[$.DIR]: true,
|
||||
[$.DIV]: true,
|
||||
[$.DL]: true,
|
||||
[$.DT]: true,
|
||||
[$.EMBED]: true,
|
||||
[$.FIELDSET]: true,
|
||||
[$.FIGCAPTION]: true,
|
||||
[$.FIGURE]: true,
|
||||
[$.FOOTER]: true,
|
||||
[$.FORM]: true,
|
||||
[$.FRAME]: true,
|
||||
[$.FRAMESET]: true,
|
||||
[$.H1]: true,
|
||||
[$.H2]: true,
|
||||
[$.H3]: true,
|
||||
[$.H4]: true,
|
||||
[$.H5]: true,
|
||||
[$.H6]: true,
|
||||
[$.HEAD]: true,
|
||||
[$.HEADER]: true,
|
||||
[$.HGROUP]: true,
|
||||
[$.HR]: true,
|
||||
[$.HTML]: true,
|
||||
[$.IFRAME]: true,
|
||||
[$.IMG]: true,
|
||||
[$.INPUT]: true,
|
||||
[$.LI]: true,
|
||||
[$.LINK]: true,
|
||||
[$.LISTING]: true,
|
||||
[$.MAIN]: true,
|
||||
[$.MARQUEE]: true,
|
||||
[$.MENU]: true,
|
||||
[$.META]: true,
|
||||
[$.NAV]: true,
|
||||
[$.NOEMBED]: true,
|
||||
[$.NOFRAMES]: true,
|
||||
[$.NOSCRIPT]: true,
|
||||
[$.OBJECT]: true,
|
||||
[$.OL]: true,
|
||||
[$.P]: true,
|
||||
[$.PARAM]: true,
|
||||
[$.PLAINTEXT]: true,
|
||||
[$.PRE]: true,
|
||||
[$.SCRIPT]: true,
|
||||
[$.SECTION]: true,
|
||||
[$.SELECT]: true,
|
||||
[$.SOURCE]: true,
|
||||
[$.STYLE]: true,
|
||||
[$.SUMMARY]: true,
|
||||
[$.TABLE]: true,
|
||||
[$.TBODY]: true,
|
||||
[$.TD]: true,
|
||||
[$.TEMPLATE]: true,
|
||||
[$.TEXTAREA]: true,
|
||||
[$.TFOOT]: true,
|
||||
[$.TH]: true,
|
||||
[$.THEAD]: true,
|
||||
[$.TITLE]: true,
|
||||
[$.TR]: true,
|
||||
[$.TRACK]: true,
|
||||
[$.UL]: true,
|
||||
[$.WBR]: true,
|
||||
[$.XMP]: true
|
||||
},
|
||||
[NS.MATHML]: {
|
||||
[$.MI]: true,
|
||||
[$.MO]: true,
|
||||
[$.MN]: true,
|
||||
[$.MS]: true,
|
||||
[$.MTEXT]: true,
|
||||
[$.ANNOTATION_XML]: true
|
||||
},
|
||||
[NS.SVG]: {
|
||||
[$.TITLE]: true,
|
||||
[$.FOREIGN_OBJECT]: true,
|
||||
[$.DESC]: true
|
||||
}
|
||||
};
|
109
node_modules/jsdom/node_modules/parse5/lib/common/unicode.js
generated
vendored
Normal file
109
node_modules/jsdom/node_modules/parse5/lib/common/unicode.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
'use strict';
|
||||
|
||||
const UNDEFINED_CODE_POINTS = [
|
||||
0xfffe,
|
||||
0xffff,
|
||||
0x1fffe,
|
||||
0x1ffff,
|
||||
0x2fffe,
|
||||
0x2ffff,
|
||||
0x3fffe,
|
||||
0x3ffff,
|
||||
0x4fffe,
|
||||
0x4ffff,
|
||||
0x5fffe,
|
||||
0x5ffff,
|
||||
0x6fffe,
|
||||
0x6ffff,
|
||||
0x7fffe,
|
||||
0x7ffff,
|
||||
0x8fffe,
|
||||
0x8ffff,
|
||||
0x9fffe,
|
||||
0x9ffff,
|
||||
0xafffe,
|
||||
0xaffff,
|
||||
0xbfffe,
|
||||
0xbffff,
|
||||
0xcfffe,
|
||||
0xcffff,
|
||||
0xdfffe,
|
||||
0xdffff,
|
||||
0xefffe,
|
||||
0xeffff,
|
||||
0xffffe,
|
||||
0xfffff,
|
||||
0x10fffe,
|
||||
0x10ffff
|
||||
];
|
||||
|
||||
exports.REPLACEMENT_CHARACTER = '\uFFFD';
|
||||
|
||||
exports.CODE_POINTS = {
|
||||
EOF: -1,
|
||||
NULL: 0x00,
|
||||
TABULATION: 0x09,
|
||||
CARRIAGE_RETURN: 0x0d,
|
||||
LINE_FEED: 0x0a,
|
||||
FORM_FEED: 0x0c,
|
||||
SPACE: 0x20,
|
||||
EXCLAMATION_MARK: 0x21,
|
||||
QUOTATION_MARK: 0x22,
|
||||
NUMBER_SIGN: 0x23,
|
||||
AMPERSAND: 0x26,
|
||||
APOSTROPHE: 0x27,
|
||||
HYPHEN_MINUS: 0x2d,
|
||||
SOLIDUS: 0x2f,
|
||||
DIGIT_0: 0x30,
|
||||
DIGIT_9: 0x39,
|
||||
SEMICOLON: 0x3b,
|
||||
LESS_THAN_SIGN: 0x3c,
|
||||
EQUALS_SIGN: 0x3d,
|
||||
GREATER_THAN_SIGN: 0x3e,
|
||||
QUESTION_MARK: 0x3f,
|
||||
LATIN_CAPITAL_A: 0x41,
|
||||
LATIN_CAPITAL_F: 0x46,
|
||||
LATIN_CAPITAL_X: 0x58,
|
||||
LATIN_CAPITAL_Z: 0x5a,
|
||||
RIGHT_SQUARE_BRACKET: 0x5d,
|
||||
GRAVE_ACCENT: 0x60,
|
||||
LATIN_SMALL_A: 0x61,
|
||||
LATIN_SMALL_F: 0x66,
|
||||
LATIN_SMALL_X: 0x78,
|
||||
LATIN_SMALL_Z: 0x7a,
|
||||
REPLACEMENT_CHARACTER: 0xfffd
|
||||
};
|
||||
|
||||
exports.CODE_POINT_SEQUENCES = {
|
||||
DASH_DASH_STRING: [0x2d, 0x2d], //--
|
||||
DOCTYPE_STRING: [0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45], //DOCTYPE
|
||||
CDATA_START_STRING: [0x5b, 0x43, 0x44, 0x41, 0x54, 0x41, 0x5b], //[CDATA[
|
||||
SCRIPT_STRING: [0x73, 0x63, 0x72, 0x69, 0x70, 0x74], //script
|
||||
PUBLIC_STRING: [0x50, 0x55, 0x42, 0x4c, 0x49, 0x43], //PUBLIC
|
||||
SYSTEM_STRING: [0x53, 0x59, 0x53, 0x54, 0x45, 0x4d] //SYSTEM
|
||||
};
|
||||
|
||||
//Surrogates
|
||||
exports.isSurrogate = function(cp) {
|
||||
return cp >= 0xd800 && cp <= 0xdfff;
|
||||
};
|
||||
|
||||
exports.isSurrogatePair = function(cp) {
|
||||
return cp >= 0xdc00 && cp <= 0xdfff;
|
||||
};
|
||||
|
||||
exports.getSurrogatePairCodePoint = function(cp1, cp2) {
|
||||
return (cp1 - 0xd800) * 0x400 + 0x2400 + cp2;
|
||||
};
|
||||
|
||||
//NOTE: excluding NULL and ASCII whitespace
|
||||
exports.isControlCodePoint = function(cp) {
|
||||
return (
|
||||
(cp !== 0x20 && cp !== 0x0a && cp !== 0x0d && cp !== 0x09 && cp !== 0x0c && cp >= 0x01 && cp <= 0x1f) ||
|
||||
(cp >= 0x7f && cp <= 0x9f)
|
||||
);
|
||||
};
|
||||
|
||||
exports.isUndefinedCodePoint = function(cp) {
|
||||
return (cp >= 0xfdd0 && cp <= 0xfdef) || UNDEFINED_CODE_POINTS.indexOf(cp) > -1;
|
||||
};
|
43
node_modules/jsdom/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js
generated
vendored
Normal file
43
node_modules/jsdom/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
const Mixin = require('../../utils/mixin');
|
||||
|
||||
class ErrorReportingMixinBase extends Mixin {
|
||||
constructor(host, opts) {
|
||||
super(host);
|
||||
|
||||
this.posTracker = null;
|
||||
this.onParseError = opts.onParseError;
|
||||
}
|
||||
|
||||
_setErrorLocation(err) {
|
||||
err.startLine = err.endLine = this.posTracker.line;
|
||||
err.startCol = err.endCol = this.posTracker.col;
|
||||
err.startOffset = err.endOffset = this.posTracker.offset;
|
||||
}
|
||||
|
||||
_reportError(code) {
|
||||
const err = {
|
||||
code: code,
|
||||
startLine: -1,
|
||||
startCol: -1,
|
||||
startOffset: -1,
|
||||
endLine: -1,
|
||||
endCol: -1,
|
||||
endOffset: -1
|
||||
};
|
||||
|
||||
this._setErrorLocation(err);
|
||||
this.onParseError(err);
|
||||
}
|
||||
|
||||
_getOverriddenMethods(mxn) {
|
||||
return {
|
||||
_err(code) {
|
||||
mxn._reportError(code);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ErrorReportingMixinBase;
|
52
node_modules/jsdom/node_modules/parse5/lib/extensions/error-reporting/parser-mixin.js
generated
vendored
Normal file
52
node_modules/jsdom/node_modules/parse5/lib/extensions/error-reporting/parser-mixin.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
|
||||
const ErrorReportingMixinBase = require('./mixin-base');
|
||||
const ErrorReportingTokenizerMixin = require('./tokenizer-mixin');
|
||||
const LocationInfoTokenizerMixin = require('../location-info/tokenizer-mixin');
|
||||
const Mixin = require('../../utils/mixin');
|
||||
|
||||
class ErrorReportingParserMixin extends ErrorReportingMixinBase {
|
||||
constructor(parser, opts) {
|
||||
super(parser, opts);
|
||||
|
||||
this.opts = opts;
|
||||
this.ctLoc = null;
|
||||
this.locBeforeToken = false;
|
||||
}
|
||||
|
||||
_setErrorLocation(err) {
|
||||
if (this.ctLoc) {
|
||||
err.startLine = this.ctLoc.startLine;
|
||||
err.startCol = this.ctLoc.startCol;
|
||||
err.startOffset = this.ctLoc.startOffset;
|
||||
|
||||
err.endLine = this.locBeforeToken ? this.ctLoc.startLine : this.ctLoc.endLine;
|
||||
err.endCol = this.locBeforeToken ? this.ctLoc.startCol : this.ctLoc.endCol;
|
||||
err.endOffset = this.locBeforeToken ? this.ctLoc.startOffset : this.ctLoc.endOffset;
|
||||
}
|
||||
}
|
||||
|
||||
_getOverriddenMethods(mxn, orig) {
|
||||
return {
|
||||
_bootstrap(document, fragmentContext) {
|
||||
orig._bootstrap.call(this, document, fragmentContext);
|
||||
|
||||
Mixin.install(this.tokenizer, ErrorReportingTokenizerMixin, mxn.opts);
|
||||
Mixin.install(this.tokenizer, LocationInfoTokenizerMixin);
|
||||
},
|
||||
|
||||
_processInputToken(token) {
|
||||
mxn.ctLoc = token.location;
|
||||
|
||||
orig._processInputToken.call(this, token);
|
||||
},
|
||||
|
||||
_err(code, options) {
|
||||
mxn.locBeforeToken = options && options.beforeToken;
|
||||
mxn._reportError(code);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ErrorReportingParserMixin;
|
24
node_modules/jsdom/node_modules/parse5/lib/extensions/error-reporting/preprocessor-mixin.js
generated
vendored
Normal file
24
node_modules/jsdom/node_modules/parse5/lib/extensions/error-reporting/preprocessor-mixin.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
const ErrorReportingMixinBase = require('./mixin-base');
|
||||
const PositionTrackingPreprocessorMixin = require('../position-tracking/preprocessor-mixin');
|
||||
const Mixin = require('../../utils/mixin');
|
||||
|
||||
class ErrorReportingPreprocessorMixin extends ErrorReportingMixinBase {
|
||||
constructor(preprocessor, opts) {
|
||||
super(preprocessor, opts);
|
||||
|
||||
this.posTracker = Mixin.install(preprocessor, PositionTrackingPreprocessorMixin);
|
||||
this.lastErrOffset = -1;
|
||||
}
|
||||
|
||||
_reportError(code) {
|
||||
//NOTE: avoid reporting error twice on advance/retreat
|
||||
if (this.lastErrOffset !== this.posTracker.offset) {
|
||||
this.lastErrOffset = this.posTracker.offset;
|
||||
super._reportError(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ErrorReportingPreprocessorMixin;
|
17
node_modules/jsdom/node_modules/parse5/lib/extensions/error-reporting/tokenizer-mixin.js
generated
vendored
Normal file
17
node_modules/jsdom/node_modules/parse5/lib/extensions/error-reporting/tokenizer-mixin.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
const ErrorReportingMixinBase = require('./mixin-base');
|
||||
const ErrorReportingPreprocessorMixin = require('./preprocessor-mixin');
|
||||
const Mixin = require('../../utils/mixin');
|
||||
|
||||
class ErrorReportingTokenizerMixin extends ErrorReportingMixinBase {
|
||||
constructor(tokenizer, opts) {
|
||||
super(tokenizer, opts);
|
||||
|
||||
const preprocessorMixin = Mixin.install(tokenizer.preprocessor, ErrorReportingPreprocessorMixin, opts);
|
||||
|
||||
this.posTracker = preprocessorMixin.posTracker;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ErrorReportingTokenizerMixin;
|
35
node_modules/jsdom/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js
generated
vendored
Normal file
35
node_modules/jsdom/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
const Mixin = require('../../utils/mixin');
|
||||
|
||||
class LocationInfoOpenElementStackMixin extends Mixin {
|
||||
constructor(stack, opts) {
|
||||
super(stack);
|
||||
|
||||
this.onItemPop = opts.onItemPop;
|
||||
}
|
||||
|
||||
_getOverriddenMethods(mxn, orig) {
|
||||
return {
|
||||
pop() {
|
||||
mxn.onItemPop(this.current);
|
||||
orig.pop.call(this);
|
||||
},
|
||||
|
||||
popAllUpToHtmlElement() {
|
||||
for (let i = this.stackTop; i > 0; i--) {
|
||||
mxn.onItemPop(this.items[i]);
|
||||
}
|
||||
|
||||
orig.popAllUpToHtmlElement.call(this);
|
||||
},
|
||||
|
||||
remove(element) {
|
||||
mxn.onItemPop(this.current);
|
||||
orig.remove.call(this, element);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LocationInfoOpenElementStackMixin;
|
222
node_modules/jsdom/node_modules/parse5/lib/extensions/location-info/parser-mixin.js
generated
vendored
Normal file
222
node_modules/jsdom/node_modules/parse5/lib/extensions/location-info/parser-mixin.js
generated
vendored
Normal file
@@ -0,0 +1,222 @@
|
||||
'use strict';
|
||||
|
||||
const Mixin = require('../../utils/mixin');
|
||||
const Tokenizer = require('../../tokenizer');
|
||||
const LocationInfoTokenizerMixin = require('./tokenizer-mixin');
|
||||
const LocationInfoOpenElementStackMixin = require('./open-element-stack-mixin');
|
||||
const HTML = require('../../common/html');
|
||||
|
||||
//Aliases
|
||||
const $ = HTML.TAG_NAMES;
|
||||
|
||||
class LocationInfoParserMixin extends Mixin {
|
||||
constructor(parser) {
|
||||
super(parser);
|
||||
|
||||
this.parser = parser;
|
||||
this.treeAdapter = this.parser.treeAdapter;
|
||||
this.posTracker = null;
|
||||
this.lastStartTagToken = null;
|
||||
this.lastFosterParentingLocation = null;
|
||||
this.currentToken = null;
|
||||
}
|
||||
|
||||
_setStartLocation(element) {
|
||||
let loc = null;
|
||||
|
||||
if (this.lastStartTagToken) {
|
||||
loc = Object.assign({}, this.lastStartTagToken.location);
|
||||
loc.startTag = this.lastStartTagToken.location;
|
||||
}
|
||||
|
||||
this.treeAdapter.setNodeSourceCodeLocation(element, loc);
|
||||
}
|
||||
|
||||
_setEndLocation(element, closingToken) {
|
||||
const loc = this.treeAdapter.getNodeSourceCodeLocation(element);
|
||||
|
||||
if (loc) {
|
||||
if (closingToken.location) {
|
||||
const ctLoc = closingToken.location;
|
||||
const tn = this.treeAdapter.getTagName(element);
|
||||
|
||||
// NOTE: For cases like <p> <p> </p> - First 'p' closes without a closing
|
||||
// tag and for cases like <td> <p> </td> - 'p' closes without a closing tag.
|
||||
const isClosingEndTag = closingToken.type === Tokenizer.END_TAG_TOKEN && tn === closingToken.tagName;
|
||||
|
||||
if (isClosingEndTag) {
|
||||
loc.endTag = Object.assign({}, ctLoc);
|
||||
loc.endLine = ctLoc.endLine;
|
||||
loc.endCol = ctLoc.endCol;
|
||||
loc.endOffset = ctLoc.endOffset;
|
||||
} else {
|
||||
loc.endLine = ctLoc.startLine;
|
||||
loc.endCol = ctLoc.startCol;
|
||||
loc.endOffset = ctLoc.startOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_getOverriddenMethods(mxn, orig) {
|
||||
return {
|
||||
_bootstrap(document, fragmentContext) {
|
||||
orig._bootstrap.call(this, document, fragmentContext);
|
||||
|
||||
mxn.lastStartTagToken = null;
|
||||
mxn.lastFosterParentingLocation = null;
|
||||
mxn.currentToken = null;
|
||||
|
||||
const tokenizerMixin = Mixin.install(this.tokenizer, LocationInfoTokenizerMixin);
|
||||
|
||||
mxn.posTracker = tokenizerMixin.posTracker;
|
||||
|
||||
Mixin.install(this.openElements, LocationInfoOpenElementStackMixin, {
|
||||
onItemPop: function(element) {
|
||||
mxn._setEndLocation(element, mxn.currentToken);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_runParsingLoop(scriptHandler) {
|
||||
orig._runParsingLoop.call(this, scriptHandler);
|
||||
|
||||
// NOTE: generate location info for elements
|
||||
// that remains on open element stack
|
||||
for (let i = this.openElements.stackTop; i >= 0; i--) {
|
||||
mxn._setEndLocation(this.openElements.items[i], mxn.currentToken);
|
||||
}
|
||||
},
|
||||
|
||||
//Token processing
|
||||
_processTokenInForeignContent(token) {
|
||||
mxn.currentToken = token;
|
||||
orig._processTokenInForeignContent.call(this, token);
|
||||
},
|
||||
|
||||
_processToken(token) {
|
||||
mxn.currentToken = token;
|
||||
orig._processToken.call(this, token);
|
||||
|
||||
//NOTE: <body> and <html> are never popped from the stack, so we need to updated
|
||||
//their end location explicitly.
|
||||
const requireExplicitUpdate =
|
||||
token.type === Tokenizer.END_TAG_TOKEN &&
|
||||
(token.tagName === $.HTML || (token.tagName === $.BODY && this.openElements.hasInScope($.BODY)));
|
||||
|
||||
if (requireExplicitUpdate) {
|
||||
for (let i = this.openElements.stackTop; i >= 0; i--) {
|
||||
const element = this.openElements.items[i];
|
||||
|
||||
if (this.treeAdapter.getTagName(element) === token.tagName) {
|
||||
mxn._setEndLocation(element, token);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
//Doctype
|
||||
_setDocumentType(token) {
|
||||
orig._setDocumentType.call(this, token);
|
||||
|
||||
const documentChildren = this.treeAdapter.getChildNodes(this.document);
|
||||
const cnLength = documentChildren.length;
|
||||
|
||||
for (let i = 0; i < cnLength; i++) {
|
||||
const node = documentChildren[i];
|
||||
|
||||
if (this.treeAdapter.isDocumentTypeNode(node)) {
|
||||
this.treeAdapter.setNodeSourceCodeLocation(node, token.location);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
//Elements
|
||||
_attachElementToTree(element) {
|
||||
//NOTE: _attachElementToTree is called from _appendElement, _insertElement and _insertTemplate methods.
|
||||
//So we will use token location stored in this methods for the element.
|
||||
mxn._setStartLocation(element);
|
||||
mxn.lastStartTagToken = null;
|
||||
orig._attachElementToTree.call(this, element);
|
||||
},
|
||||
|
||||
_appendElement(token, namespaceURI) {
|
||||
mxn.lastStartTagToken = token;
|
||||
orig._appendElement.call(this, token, namespaceURI);
|
||||
},
|
||||
|
||||
_insertElement(token, namespaceURI) {
|
||||
mxn.lastStartTagToken = token;
|
||||
orig._insertElement.call(this, token, namespaceURI);
|
||||
},
|
||||
|
||||
_insertTemplate(token) {
|
||||
mxn.lastStartTagToken = token;
|
||||
orig._insertTemplate.call(this, token);
|
||||
|
||||
const tmplContent = this.treeAdapter.getTemplateContent(this.openElements.current);
|
||||
|
||||
this.treeAdapter.setNodeSourceCodeLocation(tmplContent, null);
|
||||
},
|
||||
|
||||
_insertFakeRootElement() {
|
||||
orig._insertFakeRootElement.call(this);
|
||||
this.treeAdapter.setNodeSourceCodeLocation(this.openElements.current, null);
|
||||
},
|
||||
|
||||
//Comments
|
||||
_appendCommentNode(token, parent) {
|
||||
orig._appendCommentNode.call(this, token, parent);
|
||||
|
||||
const children = this.treeAdapter.getChildNodes(parent);
|
||||
const commentNode = children[children.length - 1];
|
||||
|
||||
this.treeAdapter.setNodeSourceCodeLocation(commentNode, token.location);
|
||||
},
|
||||
|
||||
//Text
|
||||
_findFosterParentingLocation() {
|
||||
//NOTE: store last foster parenting location, so we will be able to find inserted text
|
||||
//in case of foster parenting
|
||||
mxn.lastFosterParentingLocation = orig._findFosterParentingLocation.call(this);
|
||||
|
||||
return mxn.lastFosterParentingLocation;
|
||||
},
|
||||
|
||||
_insertCharacters(token) {
|
||||
orig._insertCharacters.call(this, token);
|
||||
|
||||
const hasFosterParent = this._shouldFosterParentOnInsertion();
|
||||
|
||||
const parent =
|
||||
(hasFosterParent && mxn.lastFosterParentingLocation.parent) ||
|
||||
this.openElements.currentTmplContent ||
|
||||
this.openElements.current;
|
||||
|
||||
const siblings = this.treeAdapter.getChildNodes(parent);
|
||||
|
||||
const textNodeIdx =
|
||||
hasFosterParent && mxn.lastFosterParentingLocation.beforeElement
|
||||
? siblings.indexOf(mxn.lastFosterParentingLocation.beforeElement) - 1
|
||||
: siblings.length - 1;
|
||||
|
||||
const textNode = siblings[textNodeIdx];
|
||||
|
||||
//NOTE: if we have location assigned by another token, then just update end position
|
||||
const tnLoc = this.treeAdapter.getNodeSourceCodeLocation(textNode);
|
||||
|
||||
if (tnLoc) {
|
||||
tnLoc.endLine = token.location.endLine;
|
||||
tnLoc.endCol = token.location.endCol;
|
||||
tnLoc.endOffset = token.location.endOffset;
|
||||
} else {
|
||||
this.treeAdapter.setNodeSourceCodeLocation(textNode, token.location);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LocationInfoParserMixin;
|
146
node_modules/jsdom/node_modules/parse5/lib/extensions/location-info/tokenizer-mixin.js
generated
vendored
Normal file
146
node_modules/jsdom/node_modules/parse5/lib/extensions/location-info/tokenizer-mixin.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
'use strict';
|
||||
|
||||
const Mixin = require('../../utils/mixin');
|
||||
const Tokenizer = require('../../tokenizer');
|
||||
const PositionTrackingPreprocessorMixin = require('../position-tracking/preprocessor-mixin');
|
||||
|
||||
class LocationInfoTokenizerMixin extends Mixin {
|
||||
constructor(tokenizer) {
|
||||
super(tokenizer);
|
||||
|
||||
this.tokenizer = tokenizer;
|
||||
this.posTracker = Mixin.install(tokenizer.preprocessor, PositionTrackingPreprocessorMixin);
|
||||
this.currentAttrLocation = null;
|
||||
this.ctLoc = null;
|
||||
}
|
||||
|
||||
_getCurrentLocation() {
|
||||
return {
|
||||
startLine: this.posTracker.line,
|
||||
startCol: this.posTracker.col,
|
||||
startOffset: this.posTracker.offset,
|
||||
endLine: -1,
|
||||
endCol: -1,
|
||||
endOffset: -1
|
||||
};
|
||||
}
|
||||
|
||||
_attachCurrentAttrLocationInfo() {
|
||||
this.currentAttrLocation.endLine = this.posTracker.line;
|
||||
this.currentAttrLocation.endCol = this.posTracker.col;
|
||||
this.currentAttrLocation.endOffset = this.posTracker.offset;
|
||||
|
||||
const currentToken = this.tokenizer.currentToken;
|
||||
const currentAttr = this.tokenizer.currentAttr;
|
||||
|
||||
if (!currentToken.location.attrs) {
|
||||
currentToken.location.attrs = Object.create(null);
|
||||
}
|
||||
|
||||
currentToken.location.attrs[currentAttr.name] = this.currentAttrLocation;
|
||||
}
|
||||
|
||||
_getOverriddenMethods(mxn, orig) {
|
||||
const methods = {
|
||||
_createStartTagToken() {
|
||||
orig._createStartTagToken.call(this);
|
||||
this.currentToken.location = mxn.ctLoc;
|
||||
},
|
||||
|
||||
_createEndTagToken() {
|
||||
orig._createEndTagToken.call(this);
|
||||
this.currentToken.location = mxn.ctLoc;
|
||||
},
|
||||
|
||||
_createCommentToken() {
|
||||
orig._createCommentToken.call(this);
|
||||
this.currentToken.location = mxn.ctLoc;
|
||||
},
|
||||
|
||||
_createDoctypeToken(initialName) {
|
||||
orig._createDoctypeToken.call(this, initialName);
|
||||
this.currentToken.location = mxn.ctLoc;
|
||||
},
|
||||
|
||||
_createCharacterToken(type, ch) {
|
||||
orig._createCharacterToken.call(this, type, ch);
|
||||
this.currentCharacterToken.location = mxn.ctLoc;
|
||||
},
|
||||
|
||||
_createEOFToken() {
|
||||
orig._createEOFToken.call(this);
|
||||
this.currentToken.location = mxn._getCurrentLocation();
|
||||
},
|
||||
|
||||
_createAttr(attrNameFirstCh) {
|
||||
orig._createAttr.call(this, attrNameFirstCh);
|
||||
mxn.currentAttrLocation = mxn._getCurrentLocation();
|
||||
},
|
||||
|
||||
_leaveAttrName(toState) {
|
||||
orig._leaveAttrName.call(this, toState);
|
||||
mxn._attachCurrentAttrLocationInfo();
|
||||
},
|
||||
|
||||
_leaveAttrValue(toState) {
|
||||
orig._leaveAttrValue.call(this, toState);
|
||||
mxn._attachCurrentAttrLocationInfo();
|
||||
},
|
||||
|
||||
_emitCurrentToken() {
|
||||
const ctLoc = this.currentToken.location;
|
||||
|
||||
//NOTE: if we have pending character token make it's end location equal to the
|
||||
//current token's start location.
|
||||
if (this.currentCharacterToken) {
|
||||
this.currentCharacterToken.location.endLine = ctLoc.startLine;
|
||||
this.currentCharacterToken.location.endCol = ctLoc.startCol;
|
||||
this.currentCharacterToken.location.endOffset = ctLoc.startOffset;
|
||||
}
|
||||
|
||||
if (this.currentToken.type === Tokenizer.EOF_TOKEN) {
|
||||
ctLoc.endLine = ctLoc.startLine;
|
||||
ctLoc.endCol = ctLoc.startCol;
|
||||
ctLoc.endOffset = ctLoc.startOffset;
|
||||
} else {
|
||||
ctLoc.endLine = mxn.posTracker.line;
|
||||
ctLoc.endCol = mxn.posTracker.col + 1;
|
||||
ctLoc.endOffset = mxn.posTracker.offset + 1;
|
||||
}
|
||||
|
||||
orig._emitCurrentToken.call(this);
|
||||
},
|
||||
|
||||
_emitCurrentCharacterToken() {
|
||||
const ctLoc = this.currentCharacterToken && this.currentCharacterToken.location;
|
||||
|
||||
//NOTE: if we have character token and it's location wasn't set in the _emitCurrentToken(),
|
||||
//then set it's location at the current preprocessor position.
|
||||
//We don't need to increment preprocessor position, since character token
|
||||
//emission is always forced by the start of the next character token here.
|
||||
//So, we already have advanced position.
|
||||
if (ctLoc && ctLoc.endOffset === -1) {
|
||||
ctLoc.endLine = mxn.posTracker.line;
|
||||
ctLoc.endCol = mxn.posTracker.col;
|
||||
ctLoc.endOffset = mxn.posTracker.offset;
|
||||
}
|
||||
|
||||
orig._emitCurrentCharacterToken.call(this);
|
||||
}
|
||||
};
|
||||
|
||||
//NOTE: patch initial states for each mode to obtain token start position
|
||||
Object.keys(Tokenizer.MODE).forEach(modeName => {
|
||||
const state = Tokenizer.MODE[modeName];
|
||||
|
||||
methods[state] = function(cp) {
|
||||
mxn.ctLoc = mxn._getCurrentLocation();
|
||||
orig[state].call(this, cp);
|
||||
};
|
||||
});
|
||||
|
||||
return methods;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LocationInfoTokenizerMixin;
|
64
node_modules/jsdom/node_modules/parse5/lib/extensions/position-tracking/preprocessor-mixin.js
generated
vendored
Normal file
64
node_modules/jsdom/node_modules/parse5/lib/extensions/position-tracking/preprocessor-mixin.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
'use strict';
|
||||
|
||||
const Mixin = require('../../utils/mixin');
|
||||
|
||||
class PositionTrackingPreprocessorMixin extends Mixin {
|
||||
constructor(preprocessor) {
|
||||
super(preprocessor);
|
||||
|
||||
this.preprocessor = preprocessor;
|
||||
this.isEol = false;
|
||||
this.lineStartPos = 0;
|
||||
this.droppedBufferSize = 0;
|
||||
|
||||
this.offset = 0;
|
||||
this.col = 0;
|
||||
this.line = 1;
|
||||
}
|
||||
|
||||
_getOverriddenMethods(mxn, orig) {
|
||||
return {
|
||||
advance() {
|
||||
const pos = this.pos + 1;
|
||||
const ch = this.html[pos];
|
||||
|
||||
//NOTE: LF should be in the last column of the line
|
||||
if (mxn.isEol) {
|
||||
mxn.isEol = false;
|
||||
mxn.line++;
|
||||
mxn.lineStartPos = pos;
|
||||
}
|
||||
|
||||
if (ch === '\n' || (ch === '\r' && this.html[pos + 1] !== '\n')) {
|
||||
mxn.isEol = true;
|
||||
}
|
||||
|
||||
mxn.col = pos - mxn.lineStartPos + 1;
|
||||
mxn.offset = mxn.droppedBufferSize + pos;
|
||||
|
||||
return orig.advance.call(this);
|
||||
},
|
||||
|
||||
retreat() {
|
||||
orig.retreat.call(this);
|
||||
|
||||
mxn.isEol = false;
|
||||
mxn.col = this.pos - mxn.lineStartPos + 1;
|
||||
},
|
||||
|
||||
dropParsedChunk() {
|
||||
const prevPos = this.pos;
|
||||
|
||||
orig.dropParsedChunk.call(this);
|
||||
|
||||
const reduction = prevPos - this.pos;
|
||||
|
||||
mxn.lineStartPos -= reduction;
|
||||
mxn.droppedBufferSize += reduction;
|
||||
mxn.offset = mxn.droppedBufferSize + this.pos;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = PositionTrackingPreprocessorMixin;
|
29
node_modules/jsdom/node_modules/parse5/lib/index.js
generated
vendored
Normal file
29
node_modules/jsdom/node_modules/parse5/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
const Parser = require('./parser');
|
||||
const Serializer = require('./serializer');
|
||||
|
||||
// Shorthands
|
||||
exports.parse = function parse(html, options) {
|
||||
const parser = new Parser(options);
|
||||
|
||||
return parser.parse(html);
|
||||
};
|
||||
|
||||
exports.parseFragment = function parseFragment(fragmentContext, html, options) {
|
||||
if (typeof fragmentContext === 'string') {
|
||||
options = html;
|
||||
html = fragmentContext;
|
||||
fragmentContext = null;
|
||||
}
|
||||
|
||||
const parser = new Parser(options);
|
||||
|
||||
return parser.parseFragment(html, fragmentContext);
|
||||
};
|
||||
|
||||
exports.serialize = function(node, options) {
|
||||
const serializer = new Serializer(node, options);
|
||||
|
||||
return serializer.serialize();
|
||||
};
|
181
node_modules/jsdom/node_modules/parse5/lib/parser/formatting-element-list.js
generated
vendored
Normal file
181
node_modules/jsdom/node_modules/parse5/lib/parser/formatting-element-list.js
generated
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
'use strict';
|
||||
|
||||
//Const
|
||||
const NOAH_ARK_CAPACITY = 3;
|
||||
|
||||
//List of formatting elements
|
||||
class FormattingElementList {
|
||||
constructor(treeAdapter) {
|
||||
this.length = 0;
|
||||
this.entries = [];
|
||||
this.treeAdapter = treeAdapter;
|
||||
this.bookmark = null;
|
||||
}
|
||||
|
||||
//Noah Ark's condition
|
||||
//OPTIMIZATION: at first we try to find possible candidates for exclusion using
|
||||
//lightweight heuristics without thorough attributes check.
|
||||
_getNoahArkConditionCandidates(newElement) {
|
||||
const candidates = [];
|
||||
|
||||
if (this.length >= NOAH_ARK_CAPACITY) {
|
||||
const neAttrsLength = this.treeAdapter.getAttrList(newElement).length;
|
||||
const neTagName = this.treeAdapter.getTagName(newElement);
|
||||
const neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement);
|
||||
|
||||
for (let i = this.length - 1; i >= 0; i--) {
|
||||
const entry = this.entries[i];
|
||||
|
||||
if (entry.type === FormattingElementList.MARKER_ENTRY) {
|
||||
break;
|
||||
}
|
||||
|
||||
const element = entry.element;
|
||||
const elementAttrs = this.treeAdapter.getAttrList(element);
|
||||
|
||||
const isCandidate =
|
||||
this.treeAdapter.getTagName(element) === neTagName &&
|
||||
this.treeAdapter.getNamespaceURI(element) === neNamespaceURI &&
|
||||
elementAttrs.length === neAttrsLength;
|
||||
|
||||
if (isCandidate) {
|
||||
candidates.push({ idx: i, attrs: elementAttrs });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return candidates.length < NOAH_ARK_CAPACITY ? [] : candidates;
|
||||
}
|
||||
|
||||
_ensureNoahArkCondition(newElement) {
|
||||
const candidates = this._getNoahArkConditionCandidates(newElement);
|
||||
let cLength = candidates.length;
|
||||
|
||||
if (cLength) {
|
||||
const neAttrs = this.treeAdapter.getAttrList(newElement);
|
||||
const neAttrsLength = neAttrs.length;
|
||||
const neAttrsMap = Object.create(null);
|
||||
|
||||
//NOTE: build attrs map for the new element so we can perform fast lookups
|
||||
for (let i = 0; i < neAttrsLength; i++) {
|
||||
const neAttr = neAttrs[i];
|
||||
|
||||
neAttrsMap[neAttr.name] = neAttr.value;
|
||||
}
|
||||
|
||||
for (let i = 0; i < neAttrsLength; i++) {
|
||||
for (let j = 0; j < cLength; j++) {
|
||||
const cAttr = candidates[j].attrs[i];
|
||||
|
||||
if (neAttrsMap[cAttr.name] !== cAttr.value) {
|
||||
candidates.splice(j, 1);
|
||||
cLength--;
|
||||
}
|
||||
|
||||
if (candidates.length < NOAH_ARK_CAPACITY) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//NOTE: remove bottommost candidates until Noah's Ark condition will not be met
|
||||
for (let i = cLength - 1; i >= NOAH_ARK_CAPACITY - 1; i--) {
|
||||
this.entries.splice(candidates[i].idx, 1);
|
||||
this.length--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Mutations
|
||||
insertMarker() {
|
||||
this.entries.push({ type: FormattingElementList.MARKER_ENTRY });
|
||||
this.length++;
|
||||
}
|
||||
|
||||
pushElement(element, token) {
|
||||
this._ensureNoahArkCondition(element);
|
||||
|
||||
this.entries.push({
|
||||
type: FormattingElementList.ELEMENT_ENTRY,
|
||||
element: element,
|
||||
token: token
|
||||
});
|
||||
|
||||
this.length++;
|
||||
}
|
||||
|
||||
insertElementAfterBookmark(element, token) {
|
||||
let bookmarkIdx = this.length - 1;
|
||||
|
||||
for (; bookmarkIdx >= 0; bookmarkIdx--) {
|
||||
if (this.entries[bookmarkIdx] === this.bookmark) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.entries.splice(bookmarkIdx + 1, 0, {
|
||||
type: FormattingElementList.ELEMENT_ENTRY,
|
||||
element: element,
|
||||
token: token
|
||||
});
|
||||
|
||||
this.length++;
|
||||
}
|
||||
|
||||
removeEntry(entry) {
|
||||
for (let i = this.length - 1; i >= 0; i--) {
|
||||
if (this.entries[i] === entry) {
|
||||
this.entries.splice(i, 1);
|
||||
this.length--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clearToLastMarker() {
|
||||
while (this.length) {
|
||||
const entry = this.entries.pop();
|
||||
|
||||
this.length--;
|
||||
|
||||
if (entry.type === FormattingElementList.MARKER_ENTRY) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Search
|
||||
getElementEntryInScopeWithTagName(tagName) {
|
||||
for (let i = this.length - 1; i >= 0; i--) {
|
||||
const entry = this.entries[i];
|
||||
|
||||
if (entry.type === FormattingElementList.MARKER_ENTRY) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (this.treeAdapter.getTagName(entry.element) === tagName) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
getElementEntry(element) {
|
||||
for (let i = this.length - 1; i >= 0; i--) {
|
||||
const entry = this.entries[i];
|
||||
|
||||
if (entry.type === FormattingElementList.ELEMENT_ENTRY && entry.element === element) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//Entry types
|
||||
FormattingElementList.MARKER_ENTRY = 'MARKER_ENTRY';
|
||||
FormattingElementList.ELEMENT_ENTRY = 'ELEMENT_ENTRY';
|
||||
|
||||
module.exports = FormattingElementList;
|
2956
node_modules/jsdom/node_modules/parse5/lib/parser/index.js
generated
vendored
Normal file
2956
node_modules/jsdom/node_modules/parse5/lib/parser/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
482
node_modules/jsdom/node_modules/parse5/lib/parser/open-element-stack.js
generated
vendored
Normal file
482
node_modules/jsdom/node_modules/parse5/lib/parser/open-element-stack.js
generated
vendored
Normal file
@@ -0,0 +1,482 @@
|
||||
'use strict';
|
||||
|
||||
const HTML = require('../common/html');
|
||||
|
||||
//Aliases
|
||||
const $ = HTML.TAG_NAMES;
|
||||
const NS = HTML.NAMESPACES;
|
||||
|
||||
//Element utils
|
||||
|
||||
//OPTIMIZATION: Integer comparisons are low-cost, so we can use very fast tag name length filters here.
|
||||
//It's faster than using dictionary.
|
||||
function isImpliedEndTagRequired(tn) {
|
||||
switch (tn.length) {
|
||||
case 1:
|
||||
return tn === $.P;
|
||||
|
||||
case 2:
|
||||
return tn === $.RB || tn === $.RP || tn === $.RT || tn === $.DD || tn === $.DT || tn === $.LI;
|
||||
|
||||
case 3:
|
||||
return tn === $.RTC;
|
||||
|
||||
case 6:
|
||||
return tn === $.OPTION;
|
||||
|
||||
case 8:
|
||||
return tn === $.OPTGROUP;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isImpliedEndTagRequiredThoroughly(tn) {
|
||||
switch (tn.length) {
|
||||
case 1:
|
||||
return tn === $.P;
|
||||
|
||||
case 2:
|
||||
return (
|
||||
tn === $.RB ||
|
||||
tn === $.RP ||
|
||||
tn === $.RT ||
|
||||
tn === $.DD ||
|
||||
tn === $.DT ||
|
||||
tn === $.LI ||
|
||||
tn === $.TD ||
|
||||
tn === $.TH ||
|
||||
tn === $.TR
|
||||
);
|
||||
|
||||
case 3:
|
||||
return tn === $.RTC;
|
||||
|
||||
case 5:
|
||||
return tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD;
|
||||
|
||||
case 6:
|
||||
return tn === $.OPTION;
|
||||
|
||||
case 7:
|
||||
return tn === $.CAPTION;
|
||||
|
||||
case 8:
|
||||
return tn === $.OPTGROUP || tn === $.COLGROUP;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isScopingElement(tn, ns) {
|
||||
switch (tn.length) {
|
||||
case 2:
|
||||
if (tn === $.TD || tn === $.TH) {
|
||||
return ns === NS.HTML;
|
||||
} else if (tn === $.MI || tn === $.MO || tn === $.MN || tn === $.MS) {
|
||||
return ns === NS.MATHML;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (tn === $.HTML) {
|
||||
return ns === NS.HTML;
|
||||
} else if (tn === $.DESC) {
|
||||
return ns === NS.SVG;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if (tn === $.TABLE) {
|
||||
return ns === NS.HTML;
|
||||
} else if (tn === $.MTEXT) {
|
||||
return ns === NS.MATHML;
|
||||
} else if (tn === $.TITLE) {
|
||||
return ns === NS.SVG;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
return (tn === $.APPLET || tn === $.OBJECT) && ns === NS.HTML;
|
||||
|
||||
case 7:
|
||||
return (tn === $.CAPTION || tn === $.MARQUEE) && ns === NS.HTML;
|
||||
|
||||
case 8:
|
||||
return tn === $.TEMPLATE && ns === NS.HTML;
|
||||
|
||||
case 13:
|
||||
return tn === $.FOREIGN_OBJECT && ns === NS.SVG;
|
||||
|
||||
case 14:
|
||||
return tn === $.ANNOTATION_XML && ns === NS.MATHML;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//Stack of open elements
|
||||
class OpenElementStack {
|
||||
constructor(document, treeAdapter) {
|
||||
this.stackTop = -1;
|
||||
this.items = [];
|
||||
this.current = document;
|
||||
this.currentTagName = null;
|
||||
this.currentTmplContent = null;
|
||||
this.tmplCount = 0;
|
||||
this.treeAdapter = treeAdapter;
|
||||
}
|
||||
|
||||
//Index of element
|
||||
_indexOf(element) {
|
||||
let idx = -1;
|
||||
|
||||
for (let i = this.stackTop; i >= 0; i--) {
|
||||
if (this.items[i] === element) {
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
//Update current element
|
||||
_isInTemplate() {
|
||||
return this.currentTagName === $.TEMPLATE && this.treeAdapter.getNamespaceURI(this.current) === NS.HTML;
|
||||
}
|
||||
|
||||
_updateCurrentElement() {
|
||||
this.current = this.items[this.stackTop];
|
||||
this.currentTagName = this.current && this.treeAdapter.getTagName(this.current);
|
||||
|
||||
this.currentTmplContent = this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : null;
|
||||
}
|
||||
|
||||
//Mutations
|
||||
push(element) {
|
||||
this.items[++this.stackTop] = element;
|
||||
this._updateCurrentElement();
|
||||
|
||||
if (this._isInTemplate()) {
|
||||
this.tmplCount++;
|
||||
}
|
||||
}
|
||||
|
||||
pop() {
|
||||
this.stackTop--;
|
||||
|
||||
if (this.tmplCount > 0 && this._isInTemplate()) {
|
||||
this.tmplCount--;
|
||||
}
|
||||
|
||||
this._updateCurrentElement();
|
||||
}
|
||||
|
||||
replace(oldElement, newElement) {
|
||||
const idx = this._indexOf(oldElement);
|
||||
|
||||
this.items[idx] = newElement;
|
||||
|
||||
if (idx === this.stackTop) {
|
||||
this._updateCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
insertAfter(referenceElement, newElement) {
|
||||
const insertionIdx = this._indexOf(referenceElement) + 1;
|
||||
|
||||
this.items.splice(insertionIdx, 0, newElement);
|
||||
|
||||
if (insertionIdx === ++this.stackTop) {
|
||||
this._updateCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
popUntilTagNamePopped(tagName) {
|
||||
while (this.stackTop > -1) {
|
||||
const tn = this.currentTagName;
|
||||
const ns = this.treeAdapter.getNamespaceURI(this.current);
|
||||
|
||||
this.pop();
|
||||
|
||||
if (tn === tagName && ns === NS.HTML) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
popUntilElementPopped(element) {
|
||||
while (this.stackTop > -1) {
|
||||
const poppedElement = this.current;
|
||||
|
||||
this.pop();
|
||||
|
||||
if (poppedElement === element) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
popUntilNumberedHeaderPopped() {
|
||||
while (this.stackTop > -1) {
|
||||
const tn = this.currentTagName;
|
||||
const ns = this.treeAdapter.getNamespaceURI(this.current);
|
||||
|
||||
this.pop();
|
||||
|
||||
if (
|
||||
tn === $.H1 ||
|
||||
tn === $.H2 ||
|
||||
tn === $.H3 ||
|
||||
tn === $.H4 ||
|
||||
tn === $.H5 ||
|
||||
(tn === $.H6 && ns === NS.HTML)
|
||||
) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
popUntilTableCellPopped() {
|
||||
while (this.stackTop > -1) {
|
||||
const tn = this.currentTagName;
|
||||
const ns = this.treeAdapter.getNamespaceURI(this.current);
|
||||
|
||||
this.pop();
|
||||
|
||||
if (tn === $.TD || (tn === $.TH && ns === NS.HTML)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
popAllUpToHtmlElement() {
|
||||
//NOTE: here we assume that root <html> element is always first in the open element stack, so
|
||||
//we perform this fast stack clean up.
|
||||
this.stackTop = 0;
|
||||
this._updateCurrentElement();
|
||||
}
|
||||
|
||||
clearBackToTableContext() {
|
||||
while (
|
||||
(this.currentTagName !== $.TABLE && this.currentTagName !== $.TEMPLATE && this.currentTagName !== $.HTML) ||
|
||||
this.treeAdapter.getNamespaceURI(this.current) !== NS.HTML
|
||||
) {
|
||||
this.pop();
|
||||
}
|
||||
}
|
||||
|
||||
clearBackToTableBodyContext() {
|
||||
while (
|
||||
(this.currentTagName !== $.TBODY &&
|
||||
this.currentTagName !== $.TFOOT &&
|
||||
this.currentTagName !== $.THEAD &&
|
||||
this.currentTagName !== $.TEMPLATE &&
|
||||
this.currentTagName !== $.HTML) ||
|
||||
this.treeAdapter.getNamespaceURI(this.current) !== NS.HTML
|
||||
) {
|
||||
this.pop();
|
||||
}
|
||||
}
|
||||
|
||||
clearBackToTableRowContext() {
|
||||
while (
|
||||
(this.currentTagName !== $.TR && this.currentTagName !== $.TEMPLATE && this.currentTagName !== $.HTML) ||
|
||||
this.treeAdapter.getNamespaceURI(this.current) !== NS.HTML
|
||||
) {
|
||||
this.pop();
|
||||
}
|
||||
}
|
||||
|
||||
remove(element) {
|
||||
for (let i = this.stackTop; i >= 0; i--) {
|
||||
if (this.items[i] === element) {
|
||||
this.items.splice(i, 1);
|
||||
this.stackTop--;
|
||||
this._updateCurrentElement();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Search
|
||||
tryPeekProperlyNestedBodyElement() {
|
||||
//Properly nested <body> element (should be second element in stack).
|
||||
const element = this.items[1];
|
||||
|
||||
return element && this.treeAdapter.getTagName(element) === $.BODY ? element : null;
|
||||
}
|
||||
|
||||
contains(element) {
|
||||
return this._indexOf(element) > -1;
|
||||
}
|
||||
|
||||
getCommonAncestor(element) {
|
||||
let elementIdx = this._indexOf(element);
|
||||
|
||||
return --elementIdx >= 0 ? this.items[elementIdx] : null;
|
||||
}
|
||||
|
||||
isRootHtmlElementCurrent() {
|
||||
return this.stackTop === 0 && this.currentTagName === $.HTML;
|
||||
}
|
||||
|
||||
//Element in scope
|
||||
hasInScope(tagName) {
|
||||
for (let i = this.stackTop; i >= 0; i--) {
|
||||
const tn = this.treeAdapter.getTagName(this.items[i]);
|
||||
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
||||
|
||||
if (tn === tagName && ns === NS.HTML) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isScopingElement(tn, ns)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
hasNumberedHeaderInScope() {
|
||||
for (let i = this.stackTop; i >= 0; i--) {
|
||||
const tn = this.treeAdapter.getTagName(this.items[i]);
|
||||
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
||||
|
||||
if (
|
||||
(tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) &&
|
||||
ns === NS.HTML
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isScopingElement(tn, ns)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
hasInListItemScope(tagName) {
|
||||
for (let i = this.stackTop; i >= 0; i--) {
|
||||
const tn = this.treeAdapter.getTagName(this.items[i]);
|
||||
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
||||
|
||||
if (tn === tagName && ns === NS.HTML) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (((tn === $.UL || tn === $.OL) && ns === NS.HTML) || isScopingElement(tn, ns)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
hasInButtonScope(tagName) {
|
||||
for (let i = this.stackTop; i >= 0; i--) {
|
||||
const tn = this.treeAdapter.getTagName(this.items[i]);
|
||||
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
||||
|
||||
if (tn === tagName && ns === NS.HTML) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((tn === $.BUTTON && ns === NS.HTML) || isScopingElement(tn, ns)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
hasInTableScope(tagName) {
|
||||
for (let i = this.stackTop; i >= 0; i--) {
|
||||
const tn = this.treeAdapter.getTagName(this.items[i]);
|
||||
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
||||
|
||||
if (ns !== NS.HTML) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tn === tagName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tn === $.TABLE || tn === $.TEMPLATE || tn === $.HTML) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
hasTableBodyContextInTableScope() {
|
||||
for (let i = this.stackTop; i >= 0; i--) {
|
||||
const tn = this.treeAdapter.getTagName(this.items[i]);
|
||||
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
||||
|
||||
if (ns !== NS.HTML) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tn === $.TBODY || tn === $.THEAD || tn === $.TFOOT) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tn === $.TABLE || tn === $.HTML) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
hasInSelectScope(tagName) {
|
||||
for (let i = this.stackTop; i >= 0; i--) {
|
||||
const tn = this.treeAdapter.getTagName(this.items[i]);
|
||||
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
||||
|
||||
if (ns !== NS.HTML) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tn === tagName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tn !== $.OPTION && tn !== $.OPTGROUP) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Implied end tags
|
||||
generateImpliedEndTags() {
|
||||
while (isImpliedEndTagRequired(this.currentTagName)) {
|
||||
this.pop();
|
||||
}
|
||||
}
|
||||
|
||||
generateImpliedEndTagsThoroughly() {
|
||||
while (isImpliedEndTagRequiredThoroughly(this.currentTagName)) {
|
||||
this.pop();
|
||||
}
|
||||
}
|
||||
|
||||
generateImpliedEndTagsWithExclusion(exclusionTagName) {
|
||||
while (isImpliedEndTagRequired(this.currentTagName) && this.currentTagName !== exclusionTagName) {
|
||||
this.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = OpenElementStack;
|
176
node_modules/jsdom/node_modules/parse5/lib/serializer/index.js
generated
vendored
Normal file
176
node_modules/jsdom/node_modules/parse5/lib/serializer/index.js
generated
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
'use strict';
|
||||
|
||||
const defaultTreeAdapter = require('../tree-adapters/default');
|
||||
const mergeOptions = require('../utils/merge-options');
|
||||
const doctype = require('../common/doctype');
|
||||
const HTML = require('../common/html');
|
||||
|
||||
//Aliases
|
||||
const $ = HTML.TAG_NAMES;
|
||||
const NS = HTML.NAMESPACES;
|
||||
|
||||
//Default serializer options
|
||||
const DEFAULT_OPTIONS = {
|
||||
treeAdapter: defaultTreeAdapter
|
||||
};
|
||||
|
||||
//Escaping regexes
|
||||
const AMP_REGEX = /&/g;
|
||||
const NBSP_REGEX = /\u00a0/g;
|
||||
const DOUBLE_QUOTE_REGEX = /"/g;
|
||||
const LT_REGEX = /</g;
|
||||
const GT_REGEX = />/g;
|
||||
|
||||
//Serializer
|
||||
class Serializer {
|
||||
constructor(node, options) {
|
||||
this.options = mergeOptions(DEFAULT_OPTIONS, options);
|
||||
this.treeAdapter = this.options.treeAdapter;
|
||||
|
||||
this.html = '';
|
||||
this.startNode = node;
|
||||
}
|
||||
|
||||
//API
|
||||
serialize() {
|
||||
this._serializeChildNodes(this.startNode);
|
||||
|
||||
return this.html;
|
||||
}
|
||||
|
||||
//Internals
|
||||
_serializeChildNodes(parentNode) {
|
||||
const childNodes = this.treeAdapter.getChildNodes(parentNode);
|
||||
|
||||
if (childNodes) {
|
||||
for (let i = 0, cnLength = childNodes.length; i < cnLength; i++) {
|
||||
const currentNode = childNodes[i];
|
||||
|
||||
if (this.treeAdapter.isElementNode(currentNode)) {
|
||||
this._serializeElement(currentNode);
|
||||
} else if (this.treeAdapter.isTextNode(currentNode)) {
|
||||
this._serializeTextNode(currentNode);
|
||||
} else if (this.treeAdapter.isCommentNode(currentNode)) {
|
||||
this._serializeCommentNode(currentNode);
|
||||
} else if (this.treeAdapter.isDocumentTypeNode(currentNode)) {
|
||||
this._serializeDocumentTypeNode(currentNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_serializeElement(node) {
|
||||
const tn = this.treeAdapter.getTagName(node);
|
||||
const ns = this.treeAdapter.getNamespaceURI(node);
|
||||
|
||||
this.html += '<' + tn;
|
||||
this._serializeAttributes(node);
|
||||
this.html += '>';
|
||||
|
||||
if (
|
||||
tn !== $.AREA &&
|
||||
tn !== $.BASE &&
|
||||
tn !== $.BASEFONT &&
|
||||
tn !== $.BGSOUND &&
|
||||
tn !== $.BR &&
|
||||
tn !== $.COL &&
|
||||
tn !== $.EMBED &&
|
||||
tn !== $.FRAME &&
|
||||
tn !== $.HR &&
|
||||
tn !== $.IMG &&
|
||||
tn !== $.INPUT &&
|
||||
tn !== $.KEYGEN &&
|
||||
tn !== $.LINK &&
|
||||
tn !== $.META &&
|
||||
tn !== $.PARAM &&
|
||||
tn !== $.SOURCE &&
|
||||
tn !== $.TRACK &&
|
||||
tn !== $.WBR
|
||||
) {
|
||||
const childNodesHolder =
|
||||
tn === $.TEMPLATE && ns === NS.HTML ? this.treeAdapter.getTemplateContent(node) : node;
|
||||
|
||||
this._serializeChildNodes(childNodesHolder);
|
||||
this.html += '</' + tn + '>';
|
||||
}
|
||||
}
|
||||
|
||||
_serializeAttributes(node) {
|
||||
const attrs = this.treeAdapter.getAttrList(node);
|
||||
|
||||
for (let i = 0, attrsLength = attrs.length; i < attrsLength; i++) {
|
||||
const attr = attrs[i];
|
||||
const value = Serializer.escapeString(attr.value, true);
|
||||
|
||||
this.html += ' ';
|
||||
|
||||
if (!attr.namespace) {
|
||||
this.html += attr.name;
|
||||
} else if (attr.namespace === NS.XML) {
|
||||
this.html += 'xml:' + attr.name;
|
||||
} else if (attr.namespace === NS.XMLNS) {
|
||||
if (attr.name !== 'xmlns') {
|
||||
this.html += 'xmlns:';
|
||||
}
|
||||
|
||||
this.html += attr.name;
|
||||
} else if (attr.namespace === NS.XLINK) {
|
||||
this.html += 'xlink:' + attr.name;
|
||||
} else {
|
||||
this.html += attr.prefix + ':' + attr.name;
|
||||
}
|
||||
|
||||
this.html += '="' + value + '"';
|
||||
}
|
||||
}
|
||||
|
||||
_serializeTextNode(node) {
|
||||
const content = this.treeAdapter.getTextNodeContent(node);
|
||||
const parent = this.treeAdapter.getParentNode(node);
|
||||
let parentTn = void 0;
|
||||
|
||||
if (parent && this.treeAdapter.isElementNode(parent)) {
|
||||
parentTn = this.treeAdapter.getTagName(parent);
|
||||
}
|
||||
|
||||
if (
|
||||
parentTn === $.STYLE ||
|
||||
parentTn === $.SCRIPT ||
|
||||
parentTn === $.XMP ||
|
||||
parentTn === $.IFRAME ||
|
||||
parentTn === $.NOEMBED ||
|
||||
parentTn === $.NOFRAMES ||
|
||||
parentTn === $.PLAINTEXT ||
|
||||
parentTn === $.NOSCRIPT
|
||||
) {
|
||||
this.html += content;
|
||||
} else {
|
||||
this.html += Serializer.escapeString(content, false);
|
||||
}
|
||||
}
|
||||
|
||||
_serializeCommentNode(node) {
|
||||
this.html += '<!--' + this.treeAdapter.getCommentNodeContent(node) + '-->';
|
||||
}
|
||||
|
||||
_serializeDocumentTypeNode(node) {
|
||||
const name = this.treeAdapter.getDocumentTypeNodeName(node);
|
||||
|
||||
this.html += '<' + doctype.serializeContent(name, null, null) + '>';
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: used in tests and by rewriting stream
|
||||
Serializer.escapeString = function(str, attrMode) {
|
||||
str = str.replace(AMP_REGEX, '&').replace(NBSP_REGEX, ' ');
|
||||
|
||||
if (attrMode) {
|
||||
str = str.replace(DOUBLE_QUOTE_REGEX, '"');
|
||||
} else {
|
||||
str = str.replace(LT_REGEX, '<').replace(GT_REGEX, '>');
|
||||
}
|
||||
|
||||
return str;
|
||||
};
|
||||
|
||||
module.exports = Serializer;
|
2196
node_modules/jsdom/node_modules/parse5/lib/tokenizer/index.js
generated
vendored
Normal file
2196
node_modules/jsdom/node_modules/parse5/lib/tokenizer/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5
node_modules/jsdom/node_modules/parse5/lib/tokenizer/named-entity-data.js
generated
vendored
Normal file
5
node_modules/jsdom/node_modules/parse5/lib/tokenizer/named-entity-data.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
159
node_modules/jsdom/node_modules/parse5/lib/tokenizer/preprocessor.js
generated
vendored
Normal file
159
node_modules/jsdom/node_modules/parse5/lib/tokenizer/preprocessor.js
generated
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
'use strict';
|
||||
|
||||
const unicode = require('../common/unicode');
|
||||
const ERR = require('../common/error-codes');
|
||||
|
||||
//Aliases
|
||||
const $ = unicode.CODE_POINTS;
|
||||
|
||||
//Const
|
||||
const DEFAULT_BUFFER_WATERLINE = 1 << 16;
|
||||
|
||||
//Preprocessor
|
||||
//NOTE: HTML input preprocessing
|
||||
//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#preprocessing-the-input-stream)
|
||||
class Preprocessor {
|
||||
constructor() {
|
||||
this.html = null;
|
||||
|
||||
this.pos = -1;
|
||||
this.lastGapPos = -1;
|
||||
this.lastCharPos = -1;
|
||||
|
||||
this.gapStack = [];
|
||||
|
||||
this.skipNextNewLine = false;
|
||||
|
||||
this.lastChunkWritten = false;
|
||||
this.endOfChunkHit = false;
|
||||
this.bufferWaterline = DEFAULT_BUFFER_WATERLINE;
|
||||
}
|
||||
|
||||
_err() {
|
||||
// NOTE: err reporting is noop by default. Enabled by mixin.
|
||||
}
|
||||
|
||||
_addGap() {
|
||||
this.gapStack.push(this.lastGapPos);
|
||||
this.lastGapPos = this.pos;
|
||||
}
|
||||
|
||||
_processSurrogate(cp) {
|
||||
//NOTE: try to peek a surrogate pair
|
||||
if (this.pos !== this.lastCharPos) {
|
||||
const nextCp = this.html.charCodeAt(this.pos + 1);
|
||||
|
||||
if (unicode.isSurrogatePair(nextCp)) {
|
||||
//NOTE: we have a surrogate pair. Peek pair character and recalculate code point.
|
||||
this.pos++;
|
||||
|
||||
//NOTE: add gap that should be avoided during retreat
|
||||
this._addGap();
|
||||
|
||||
return unicode.getSurrogatePairCodePoint(cp, nextCp);
|
||||
}
|
||||
}
|
||||
|
||||
//NOTE: we are at the end of a chunk, therefore we can't infer surrogate pair yet.
|
||||
else if (!this.lastChunkWritten) {
|
||||
this.endOfChunkHit = true;
|
||||
return $.EOF;
|
||||
}
|
||||
|
||||
//NOTE: isolated surrogate
|
||||
this._err(ERR.surrogateInInputStream);
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
dropParsedChunk() {
|
||||
if (this.pos > this.bufferWaterline) {
|
||||
this.lastCharPos -= this.pos;
|
||||
this.html = this.html.substring(this.pos);
|
||||
this.pos = 0;
|
||||
this.lastGapPos = -1;
|
||||
this.gapStack = [];
|
||||
}
|
||||
}
|
||||
|
||||
write(chunk, isLastChunk) {
|
||||
if (this.html) {
|
||||
this.html += chunk;
|
||||
} else {
|
||||
this.html = chunk;
|
||||
}
|
||||
|
||||
this.lastCharPos = this.html.length - 1;
|
||||
this.endOfChunkHit = false;
|
||||
this.lastChunkWritten = isLastChunk;
|
||||
}
|
||||
|
||||
insertHtmlAtCurrentPos(chunk) {
|
||||
this.html = this.html.substring(0, this.pos + 1) + chunk + this.html.substring(this.pos + 1, this.html.length);
|
||||
|
||||
this.lastCharPos = this.html.length - 1;
|
||||
this.endOfChunkHit = false;
|
||||
}
|
||||
|
||||
advance() {
|
||||
this.pos++;
|
||||
|
||||
if (this.pos > this.lastCharPos) {
|
||||
this.endOfChunkHit = !this.lastChunkWritten;
|
||||
return $.EOF;
|
||||
}
|
||||
|
||||
let cp = this.html.charCodeAt(this.pos);
|
||||
|
||||
//NOTE: any U+000A LINE FEED (LF) characters that immediately follow a U+000D CARRIAGE RETURN (CR) character
|
||||
//must be ignored.
|
||||
if (this.skipNextNewLine && cp === $.LINE_FEED) {
|
||||
this.skipNextNewLine = false;
|
||||
this._addGap();
|
||||
return this.advance();
|
||||
}
|
||||
|
||||
//NOTE: all U+000D CARRIAGE RETURN (CR) characters must be converted to U+000A LINE FEED (LF) characters
|
||||
if (cp === $.CARRIAGE_RETURN) {
|
||||
this.skipNextNewLine = true;
|
||||
return $.LINE_FEED;
|
||||
}
|
||||
|
||||
this.skipNextNewLine = false;
|
||||
|
||||
if (unicode.isSurrogate(cp)) {
|
||||
cp = this._processSurrogate(cp);
|
||||
}
|
||||
|
||||
//OPTIMIZATION: first check if code point is in the common allowed
|
||||
//range (ASCII alphanumeric, whitespaces, big chunk of BMP)
|
||||
//before going into detailed performance cost validation.
|
||||
const isCommonValidRange =
|
||||
(cp > 0x1f && cp < 0x7f) || cp === $.LINE_FEED || cp === $.CARRIAGE_RETURN || (cp > 0x9f && cp < 0xfdd0);
|
||||
|
||||
if (!isCommonValidRange) {
|
||||
this._checkForProblematicCharacters(cp);
|
||||
}
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
_checkForProblematicCharacters(cp) {
|
||||
if (unicode.isControlCodePoint(cp)) {
|
||||
this._err(ERR.controlCharacterInInputStream);
|
||||
} else if (unicode.isUndefinedCodePoint(cp)) {
|
||||
this._err(ERR.noncharacterInInputStream);
|
||||
}
|
||||
}
|
||||
|
||||
retreat() {
|
||||
if (this.pos === this.lastGapPos) {
|
||||
this.lastGapPos = this.gapStack.pop();
|
||||
this.pos--;
|
||||
}
|
||||
|
||||
this.pos--;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Preprocessor;
|
217
node_modules/jsdom/node_modules/parse5/lib/tree-adapters/default.js
generated
vendored
Normal file
217
node_modules/jsdom/node_modules/parse5/lib/tree-adapters/default.js
generated
vendored
Normal file
@@ -0,0 +1,217 @@
|
||||
'use strict';
|
||||
|
||||
const { DOCUMENT_MODE } = require('../common/html');
|
||||
|
||||
//Node construction
|
||||
exports.createDocument = function() {
|
||||
return {
|
||||
nodeName: '#document',
|
||||
mode: DOCUMENT_MODE.NO_QUIRKS,
|
||||
childNodes: []
|
||||
};
|
||||
};
|
||||
|
||||
exports.createDocumentFragment = function() {
|
||||
return {
|
||||
nodeName: '#document-fragment',
|
||||
childNodes: []
|
||||
};
|
||||
};
|
||||
|
||||
exports.createElement = function(tagName, namespaceURI, attrs) {
|
||||
return {
|
||||
nodeName: tagName,
|
||||
tagName: tagName,
|
||||
attrs: attrs,
|
||||
namespaceURI: namespaceURI,
|
||||
childNodes: [],
|
||||
parentNode: null
|
||||
};
|
||||
};
|
||||
|
||||
exports.createCommentNode = function(data) {
|
||||
return {
|
||||
nodeName: '#comment',
|
||||
data: data,
|
||||
parentNode: null
|
||||
};
|
||||
};
|
||||
|
||||
const createTextNode = function(value) {
|
||||
return {
|
||||
nodeName: '#text',
|
||||
value: value,
|
||||
parentNode: null
|
||||
};
|
||||
};
|
||||
|
||||
//Tree mutation
|
||||
const appendChild = (exports.appendChild = function(parentNode, newNode) {
|
||||
parentNode.childNodes.push(newNode);
|
||||
newNode.parentNode = parentNode;
|
||||
});
|
||||
|
||||
const insertBefore = (exports.insertBefore = function(parentNode, newNode, referenceNode) {
|
||||
const insertionIdx = parentNode.childNodes.indexOf(referenceNode);
|
||||
|
||||
parentNode.childNodes.splice(insertionIdx, 0, newNode);
|
||||
newNode.parentNode = parentNode;
|
||||
});
|
||||
|
||||
exports.setTemplateContent = function(templateElement, contentElement) {
|
||||
templateElement.content = contentElement;
|
||||
};
|
||||
|
||||
exports.getTemplateContent = function(templateElement) {
|
||||
return templateElement.content;
|
||||
};
|
||||
|
||||
exports.setDocumentType = function(document, name, publicId, systemId) {
|
||||
let doctypeNode = null;
|
||||
|
||||
for (let i = 0; i < document.childNodes.length; i++) {
|
||||
if (document.childNodes[i].nodeName === '#documentType') {
|
||||
doctypeNode = document.childNodes[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (doctypeNode) {
|
||||
doctypeNode.name = name;
|
||||
doctypeNode.publicId = publicId;
|
||||
doctypeNode.systemId = systemId;
|
||||
} else {
|
||||
appendChild(document, {
|
||||
nodeName: '#documentType',
|
||||
name: name,
|
||||
publicId: publicId,
|
||||
systemId: systemId
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.setDocumentMode = function(document, mode) {
|
||||
document.mode = mode;
|
||||
};
|
||||
|
||||
exports.getDocumentMode = function(document) {
|
||||
return document.mode;
|
||||
};
|
||||
|
||||
exports.detachNode = function(node) {
|
||||
if (node.parentNode) {
|
||||
const idx = node.parentNode.childNodes.indexOf(node);
|
||||
|
||||
node.parentNode.childNodes.splice(idx, 1);
|
||||
node.parentNode = null;
|
||||
}
|
||||
};
|
||||
|
||||
exports.insertText = function(parentNode, text) {
|
||||
if (parentNode.childNodes.length) {
|
||||
const prevNode = parentNode.childNodes[parentNode.childNodes.length - 1];
|
||||
|
||||
if (prevNode.nodeName === '#text') {
|
||||
prevNode.value += text;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
appendChild(parentNode, createTextNode(text));
|
||||
};
|
||||
|
||||
exports.insertTextBefore = function(parentNode, text, referenceNode) {
|
||||
const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
|
||||
|
||||
if (prevNode && prevNode.nodeName === '#text') {
|
||||
prevNode.value += text;
|
||||
} else {
|
||||
insertBefore(parentNode, createTextNode(text), referenceNode);
|
||||
}
|
||||
};
|
||||
|
||||
exports.adoptAttributes = function(recipient, attrs) {
|
||||
const recipientAttrsMap = [];
|
||||
|
||||
for (let i = 0; i < recipient.attrs.length; i++) {
|
||||
recipientAttrsMap.push(recipient.attrs[i].name);
|
||||
}
|
||||
|
||||
for (let j = 0; j < attrs.length; j++) {
|
||||
if (recipientAttrsMap.indexOf(attrs[j].name) === -1) {
|
||||
recipient.attrs.push(attrs[j]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//Tree traversing
|
||||
exports.getFirstChild = function(node) {
|
||||
return node.childNodes[0];
|
||||
};
|
||||
|
||||
exports.getChildNodes = function(node) {
|
||||
return node.childNodes;
|
||||
};
|
||||
|
||||
exports.getParentNode = function(node) {
|
||||
return node.parentNode;
|
||||
};
|
||||
|
||||
exports.getAttrList = function(element) {
|
||||
return element.attrs;
|
||||
};
|
||||
|
||||
//Node data
|
||||
exports.getTagName = function(element) {
|
||||
return element.tagName;
|
||||
};
|
||||
|
||||
exports.getNamespaceURI = function(element) {
|
||||
return element.namespaceURI;
|
||||
};
|
||||
|
||||
exports.getTextNodeContent = function(textNode) {
|
||||
return textNode.value;
|
||||
};
|
||||
|
||||
exports.getCommentNodeContent = function(commentNode) {
|
||||
return commentNode.data;
|
||||
};
|
||||
|
||||
exports.getDocumentTypeNodeName = function(doctypeNode) {
|
||||
return doctypeNode.name;
|
||||
};
|
||||
|
||||
exports.getDocumentTypeNodePublicId = function(doctypeNode) {
|
||||
return doctypeNode.publicId;
|
||||
};
|
||||
|
||||
exports.getDocumentTypeNodeSystemId = function(doctypeNode) {
|
||||
return doctypeNode.systemId;
|
||||
};
|
||||
|
||||
//Node types
|
||||
exports.isTextNode = function(node) {
|
||||
return node.nodeName === '#text';
|
||||
};
|
||||
|
||||
exports.isCommentNode = function(node) {
|
||||
return node.nodeName === '#comment';
|
||||
};
|
||||
|
||||
exports.isDocumentTypeNode = function(node) {
|
||||
return node.nodeName === '#documentType';
|
||||
};
|
||||
|
||||
exports.isElementNode = function(node) {
|
||||
return !!node.tagName;
|
||||
};
|
||||
|
||||
// Source code location
|
||||
exports.setNodeSourceCodeLocation = function(node, location) {
|
||||
node.sourceCodeLocation = location;
|
||||
};
|
||||
|
||||
exports.getNodeSourceCodeLocation = function(node) {
|
||||
return node.sourceCodeLocation;
|
||||
};
|
13
node_modules/jsdom/node_modules/parse5/lib/utils/merge-options.js
generated
vendored
Normal file
13
node_modules/jsdom/node_modules/parse5/lib/utils/merge-options.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function mergeOptions(defaults, options) {
|
||||
options = options || Object.create(null);
|
||||
|
||||
return [defaults, options].reduce((merged, optObj) => {
|
||||
Object.keys(optObj).forEach(key => {
|
||||
merged[key] = optObj[key];
|
||||
});
|
||||
|
||||
return merged;
|
||||
}, Object.create(null));
|
||||
};
|
39
node_modules/jsdom/node_modules/parse5/lib/utils/mixin.js
generated
vendored
Normal file
39
node_modules/jsdom/node_modules/parse5/lib/utils/mixin.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
class Mixin {
|
||||
constructor(host) {
|
||||
const originalMethods = {};
|
||||
const overriddenMethods = this._getOverriddenMethods(this, originalMethods);
|
||||
|
||||
for (const key of Object.keys(overriddenMethods)) {
|
||||
if (typeof overriddenMethods[key] === 'function') {
|
||||
originalMethods[key] = host[key];
|
||||
host[key] = overriddenMethods[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_getOverriddenMethods() {
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
Mixin.install = function(host, Ctor, opts) {
|
||||
if (!host.__mixins) {
|
||||
host.__mixins = [];
|
||||
}
|
||||
|
||||
for (let i = 0; i < host.__mixins.length; i++) {
|
||||
if (host.__mixins[i].constructor === Ctor) {
|
||||
return host.__mixins[i];
|
||||
}
|
||||
}
|
||||
|
||||
const mixin = new Ctor(host, opts);
|
||||
|
||||
host.__mixins.push(mixin);
|
||||
|
||||
return mixin;
|
||||
};
|
||||
|
||||
module.exports = Mixin;
|
67
node_modules/jsdom/node_modules/parse5/package.json
generated
vendored
Normal file
67
node_modules/jsdom/node_modules/parse5/package.json
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"_from": "parse5@5.1.1",
|
||||
"_id": "parse5@5.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==",
|
||||
"_location": "/jsdom/parse5",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "parse5@5.1.1",
|
||||
"name": "parse5",
|
||||
"escapedName": "parse5",
|
||||
"rawSpec": "5.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "5.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jsdom"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz",
|
||||
"_shasum": "f68e4e5ba1852ac2cadc00f4555fff6c2abb6178",
|
||||
"_spec": "parse5@5.1.1",
|
||||
"_where": "D:\\Projects\\vanillajs-seed\\node_modules\\jsdom",
|
||||
"author": {
|
||||
"name": "Ivan Nikulin",
|
||||
"email": "ifaaan@gmail.com",
|
||||
"url": "https://github.com/inikulin"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/inikulin/parse5/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": "https://github.com/inikulin/parse5/graphs/contributors",
|
||||
"deprecated": false,
|
||||
"description": "HTML parser and serializer.",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"gitHead": "9c7556ed05e4ff4d884ab2447e27ce3817c42e79",
|
||||
"homepage": "https://github.com/inikulin/parse5",
|
||||
"keywords": [
|
||||
"html",
|
||||
"parser",
|
||||
"html5",
|
||||
"WHATWG",
|
||||
"specification",
|
||||
"fast",
|
||||
"html parser",
|
||||
"html5 parser",
|
||||
"htmlparser",
|
||||
"parse5",
|
||||
"serializer",
|
||||
"html serializer",
|
||||
"htmlserializer",
|
||||
"parse",
|
||||
"serialize"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/index.js",
|
||||
"name": "parse5",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/inikulin/parse5.git"
|
||||
},
|
||||
"version": "5.1.1"
|
||||
}
|
Reference in New Issue
Block a user