projen 0.71.51 → 0.71.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +3 -3
- package/lib/awscdk/auto-discover.js +5 -5
- package/lib/awscdk/awscdk-app-java.js +1 -1
- package/lib/awscdk/awscdk-app-py.js +1 -1
- package/lib/awscdk/awscdk-app-ts.js +1 -1
- package/lib/awscdk/awscdk-construct.js +2 -2
- package/lib/awscdk/awscdk-deps-java.js +1 -1
- package/lib/awscdk/awscdk-deps-js.js +1 -1
- package/lib/awscdk/awscdk-deps-py.js +1 -1
- package/lib/awscdk/awscdk-deps.js +1 -1
- package/lib/awscdk/cdk-config.js +1 -1
- package/lib/awscdk/cdk-tasks.js +1 -1
- package/lib/awscdk/integration-test.js +1 -1
- package/lib/awscdk/lambda-extension.js +1 -1
- package/lib/awscdk/lambda-function.js +2 -2
- package/lib/build/build-workflow.js +1 -1
- package/lib/cdk/auto-discover-base.js +2 -2
- package/lib/cdk/construct-lib.js +1 -1
- package/lib/cdk/integration-test-base.js +1 -1
- package/lib/cdk/jsii-docgen.js +1 -1
- package/lib/cdk/jsii-project.js +1 -1
- package/lib/cdk8s/auto-discover.js +2 -2
- package/lib/cdk8s/cdk8s-app-py.js +1 -1
- package/lib/cdk8s/cdk8s-app-ts.js +1 -1
- package/lib/cdk8s/cdk8s-construct.js +1 -1
- package/lib/cdk8s/cdk8s-deps-py.js +1 -1
- package/lib/cdk8s/cdk8s-deps.js +1 -1
- package/lib/cdk8s/integration-test.js +1 -1
- package/lib/cdktf/cdktf-construct.js +1 -1
- package/lib/circleci/circleci.js +1 -1
- package/lib/component.js +1 -1
- package/lib/dependencies.js +1 -1
- package/lib/dev-env.js +1 -1
- package/lib/docker-compose/docker-compose-service.js +1 -1
- package/lib/docker-compose/docker-compose.js +1 -1
- package/lib/file.js +1 -1
- package/lib/gitattributes.js +1 -1
- package/lib/github/actions-provider.js +1 -1
- package/lib/github/auto-approve.js +1 -1
- package/lib/github/auto-merge.js +1 -1
- package/lib/github/dependabot.js +1 -1
- package/lib/github/github-credentials.js +1 -1
- package/lib/github/github-project.js +1 -1
- package/lib/github/github.js +1 -1
- package/lib/github/mergify.js +1 -1
- package/lib/github/pr-template.js +1 -1
- package/lib/github/pull-request-lint.js +1 -1
- package/lib/github/stale.js +1 -1
- package/lib/github/task-workflow.js +1 -1
- package/lib/github/workflow-actions.js +1 -1
- package/lib/github/workflow-jobs.js +1 -1
- package/lib/github/workflows.js +1 -1
- package/lib/gitlab/configuration.js +1 -1
- package/lib/gitlab/gitlab-configuration.js +1 -1
- package/lib/gitlab/nested-configuration.js +1 -1
- package/lib/gitpod.js +1 -1
- package/lib/ignore-file.js +1 -1
- package/lib/ini.js +1 -1
- package/lib/java/java-project.js +1 -1
- package/lib/java/junit.js +1 -1
- package/lib/java/maven-compile.js +1 -1
- package/lib/java/maven-packaging.js +1 -1
- package/lib/java/maven-sample.js +1 -1
- package/lib/java/pom.js +1 -1
- package/lib/java/projenrc.js +1 -1
- package/lib/javascript/bundler.js +1 -1
- package/lib/javascript/eslint.js +1 -1
- package/lib/javascript/jest.js +4 -4
- package/lib/javascript/node-package.js +1 -1
- package/lib/javascript/node-project.js +1 -1
- package/lib/javascript/npm-config.js +1 -1
- package/lib/javascript/prettier.js +1 -1
- package/lib/javascript/projenrc.js +1 -1
- package/lib/javascript/typescript-config.js +2 -2
- package/lib/javascript/upgrade-dependencies.js +2 -2
- package/lib/json-patch.js +1 -1
- package/lib/json.js +1 -1
- package/lib/license.js +1 -1
- package/lib/logger.js +1 -1
- package/lib/makefile.js +1 -1
- package/lib/object-file.js +1 -1
- package/lib/project-build.js +1 -1
- package/lib/project.js +1 -1
- package/lib/projects.js +1 -1
- package/lib/projenrc-json.js +2 -2
- package/lib/projenrc.js +1 -1
- package/lib/python/pip.js +1 -1
- package/lib/python/poetry.js +2 -2
- package/lib/python/projenrc.js +1 -1
- package/lib/python/pytest-sample.js +1 -1
- package/lib/python/pytest.js +1 -1
- package/lib/python/python-project.js +1 -1
- package/lib/python/python-sample.js +1 -1
- package/lib/python/requirements-file.js +1 -1
- package/lib/python/setuppy.js +1 -1
- package/lib/python/setuptools.js +1 -1
- package/lib/python/venv.js +1 -1
- package/lib/readme.js +1 -1
- package/lib/release/publisher.js +1 -1
- package/lib/release/release-trigger.js +1 -1
- package/lib/release/release.js +1 -1
- package/lib/renovatebot.js +1 -1
- package/lib/sample-file.js +2 -2
- package/lib/semver.js +1 -1
- package/lib/source-code.js +1 -1
- package/lib/task-runtime.js +1 -1
- package/lib/task.js +1 -1
- package/lib/tasks.js +1 -1
- package/lib/testing.js +1 -1
- package/lib/textfile.js +1 -1
- package/lib/toml.js +1 -1
- package/lib/typescript/projenrc-ts.js +1 -1
- package/lib/typescript/projenrc.js +1 -1
- package/lib/typescript/typescript-typedoc.js +1 -1
- package/lib/typescript/typescript.js +3 -3
- package/lib/version.js +1 -1
- package/lib/vscode/devcontainer.js +1 -1
- package/lib/vscode/extensions.js +1 -1
- package/lib/vscode/launch-config.js +1 -1
- package/lib/vscode/settings.js +1 -1
- package/lib/vscode/vscode.js +1 -1
- package/lib/web/next.js +3 -3
- package/lib/web/postcss.js +1 -1
- package/lib/web/react.js +4 -4
- package/lib/web/tailwind.js +1 -1
- package/lib/xmlfile.js +1 -1
- package/lib/yaml.js +1 -1
- package/node_modules/@oozcitak/dom/LICENSE +21 -21
- package/node_modules/@oozcitak/dom/README.md +32 -32
- package/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.d.ts +12 -0
- package/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.js +23 -3
- package/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/package.json +72 -72
- package/node_modules/xmlbuilder2/CHANGELOG.md +95 -1
- package/node_modules/xmlbuilder2/README.md +5 -4
- package/node_modules/xmlbuilder2/lib/builder/XMLBuilderCBImpl.d.ts +3 -1
- package/node_modules/xmlbuilder2/lib/builder/XMLBuilderCBImpl.js +44 -53
- package/node_modules/xmlbuilder2/lib/builder/XMLBuilderCBImpl.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/constants.d.ts +1 -0
- package/node_modules/xmlbuilder2/lib/constants.js +4 -0
- package/node_modules/xmlbuilder2/lib/constants.js.map +1 -0
- package/node_modules/xmlbuilder2/lib/interfaces.d.ts +20 -8
- package/node_modules/xmlbuilder2/lib/interfaces.js +1 -0
- package/node_modules/xmlbuilder2/lib/interfaces.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/readers/BaseReader.d.ts +14 -1
- package/node_modules/xmlbuilder2/lib/readers/BaseReader.js +30 -1
- package/node_modules/xmlbuilder2/lib/readers/BaseReader.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/readers/ObjectReader.js +12 -5
- package/node_modules/xmlbuilder2/lib/readers/ObjectReader.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/readers/XMLReader.js +11 -5
- package/node_modules/xmlbuilder2/lib/readers/XMLReader.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/BaseWriter.d.ts +1 -1
- package/node_modules/xmlbuilder2/lib/writers/BaseWriter.js +58 -92
- package/node_modules/xmlbuilder2/lib/writers/BaseWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/JSONWriter.js +1 -3
- package/node_modules/xmlbuilder2/lib/writers/JSONWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/MapWriter.js +0 -2
- package/node_modules/xmlbuilder2/lib/writers/MapWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/ObjectWriter.js +1 -2
- package/node_modules/xmlbuilder2/lib/writers/ObjectWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/XMLWriter.js +1 -2
- package/node_modules/xmlbuilder2/lib/writers/XMLWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/YAMLWriter.js +1 -3
- package/node_modules/xmlbuilder2/lib/writers/YAMLWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/xmlbuilder2.min.js +2 -2
- package/node_modules/xmlbuilder2/node_modules/js-yaml/CHANGELOG.md +6 -0
- package/node_modules/xmlbuilder2/node_modules/js-yaml/dist/js-yaml.js +2 -2
- package/node_modules/xmlbuilder2/node_modules/js-yaml/dist/js-yaml.min.js +1 -1
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/loader.js +1 -1
- package/node_modules/xmlbuilder2/node_modules/js-yaml/package.json +1 -1
- package/node_modules/xmlbuilder2/package.json +7 -7
- package/package.json +2 -2
- package/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl2.d.ts +0 -2
- package/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl2.js +0 -962
- package/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl2.js.map +0 -1
- package/node_modules/xmlbuilder2/node_modules/@types/node/LICENSE +0 -21
- package/node_modules/xmlbuilder2/node_modules/@types/node/README.md +0 -16
- package/node_modules/xmlbuilder2/node_modules/@types/node/assert/strict.d.ts +0 -8
- package/node_modules/xmlbuilder2/node_modules/@types/node/assert.d.ts +0 -957
- package/node_modules/xmlbuilder2/node_modules/@types/node/async_hooks.d.ts +0 -538
- package/node_modules/xmlbuilder2/node_modules/@types/node/buffer.d.ts +0 -2348
- package/node_modules/xmlbuilder2/node_modules/@types/node/child_process.d.ts +0 -1368
- package/node_modules/xmlbuilder2/node_modules/@types/node/cluster.d.ts +0 -410
- package/node_modules/xmlbuilder2/node_modules/@types/node/console.d.ts +0 -412
- package/node_modules/xmlbuilder2/node_modules/@types/node/constants.d.ts +0 -18
- package/node_modules/xmlbuilder2/node_modules/@types/node/crypto.d.ts +0 -3962
- package/node_modules/xmlbuilder2/node_modules/@types/node/dgram.d.ts +0 -545
- package/node_modules/xmlbuilder2/node_modules/@types/node/diagnostics_channel.d.ts +0 -191
- package/node_modules/xmlbuilder2/node_modules/@types/node/dns/promises.d.ts +0 -370
- package/node_modules/xmlbuilder2/node_modules/@types/node/dns.d.ts +0 -667
- package/node_modules/xmlbuilder2/node_modules/@types/node/dom-events.d.ts +0 -126
- package/node_modules/xmlbuilder2/node_modules/@types/node/domain.d.ts +0 -170
- package/node_modules/xmlbuilder2/node_modules/@types/node/events.d.ts +0 -682
- package/node_modules/xmlbuilder2/node_modules/@types/node/fs/promises.d.ts +0 -1189
- package/node_modules/xmlbuilder2/node_modules/@types/node/fs.d.ts +0 -4011
- package/node_modules/xmlbuilder2/node_modules/@types/node/globals.d.ts +0 -302
- package/node_modules/xmlbuilder2/node_modules/@types/node/globals.global.d.ts +0 -1
- package/node_modules/xmlbuilder2/node_modules/@types/node/http.d.ts +0 -1724
- package/node_modules/xmlbuilder2/node_modules/@types/node/http2.d.ts +0 -2129
- package/node_modules/xmlbuilder2/node_modules/@types/node/https.d.ts +0 -441
- package/node_modules/xmlbuilder2/node_modules/@types/node/index.d.ts +0 -134
- package/node_modules/xmlbuilder2/node_modules/@types/node/inspector.d.ts +0 -2748
- package/node_modules/xmlbuilder2/node_modules/@types/node/module.d.ts +0 -116
- package/node_modules/xmlbuilder2/node_modules/@types/node/net.d.ts +0 -886
- package/node_modules/xmlbuilder2/node_modules/@types/node/os.d.ts +0 -477
- package/node_modules/xmlbuilder2/node_modules/@types/node/package.json +0 -237
- package/node_modules/xmlbuilder2/node_modules/@types/node/path.d.ts +0 -191
- package/node_modules/xmlbuilder2/node_modules/@types/node/perf_hooks.d.ts +0 -638
- package/node_modules/xmlbuilder2/node_modules/@types/node/process.d.ts +0 -1485
- package/node_modules/xmlbuilder2/node_modules/@types/node/punycode.d.ts +0 -117
- package/node_modules/xmlbuilder2/node_modules/@types/node/querystring.d.ts +0 -131
- package/node_modules/xmlbuilder2/node_modules/@types/node/readline/promises.d.ts +0 -145
- package/node_modules/xmlbuilder2/node_modules/@types/node/readline.d.ts +0 -653
- package/node_modules/xmlbuilder2/node_modules/@types/node/repl.d.ts +0 -424
- package/node_modules/xmlbuilder2/node_modules/@types/node/stream/consumers.d.ts +0 -12
- package/node_modules/xmlbuilder2/node_modules/@types/node/stream/promises.d.ts +0 -42
- package/node_modules/xmlbuilder2/node_modules/@types/node/stream/web.d.ts +0 -330
- package/node_modules/xmlbuilder2/node_modules/@types/node/stream.d.ts +0 -1392
- package/node_modules/xmlbuilder2/node_modules/@types/node/string_decoder.d.ts +0 -67
- package/node_modules/xmlbuilder2/node_modules/@types/node/test.d.ts +0 -997
- package/node_modules/xmlbuilder2/node_modules/@types/node/timers/promises.d.ts +0 -93
- package/node_modules/xmlbuilder2/node_modules/@types/node/timers.d.ts +0 -101
- package/node_modules/xmlbuilder2/node_modules/@types/node/tls.d.ts +0 -1119
- package/node_modules/xmlbuilder2/node_modules/@types/node/trace_events.d.ts +0 -182
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/assert.d.ts +0 -957
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -538
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2348
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1368
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/cluster.d.ts +0 -410
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/console.d.ts +0 -412
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/constants.d.ts +0 -18
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/crypto.d.ts +0 -3961
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/dgram.d.ts +0 -545
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -191
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -370
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/dns.d.ts +0 -667
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -126
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/events.d.ts +0 -682
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1189
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/fs.d.ts +0 -4011
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/globals.d.ts +0 -302
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/http.d.ts +0 -1723
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/http2.d.ts +0 -2129
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/https.d.ts +0 -441
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/index.d.ts +0 -88
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2748
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/module.d.ts +0 -116
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/net.d.ts +0 -886
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/os.d.ts +0 -477
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/path.d.ts +0 -191
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -638
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/process.d.ts +0 -1485
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/querystring.d.ts +0 -131
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -145
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/readline.d.ts +0 -653
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/repl.d.ts +0 -424
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -42
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -330
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/stream.d.ts +0 -1392
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/test.d.ts +0 -997
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/timers.d.ts +0 -101
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/tls.d.ts +0 -1119
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/tty.d.ts +0 -205
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/url.d.ts +0 -892
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/util.d.ts +0 -2044
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/v8.d.ts +0 -635
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/vm.d.ts +0 -894
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/wasi.d.ts +0 -152
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -693
- package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
- package/node_modules/xmlbuilder2/node_modules/@types/node/tty.d.ts +0 -205
- package/node_modules/xmlbuilder2/node_modules/@types/node/url.d.ts +0 -892
- package/node_modules/xmlbuilder2/node_modules/@types/node/util.d.ts +0 -2052
- package/node_modules/xmlbuilder2/node_modules/@types/node/v8.d.ts +0 -635
- package/node_modules/xmlbuilder2/node_modules/@types/node/vm.d.ts +0 -894
- package/node_modules/xmlbuilder2/node_modules/@types/node/wasi.d.ts +0 -152
- package/node_modules/xmlbuilder2/node_modules/@types/node/worker_threads.d.ts +0 -693
- package/node_modules/xmlbuilder2/node_modules/@types/node/zlib.d.ts +0 -517
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/CHANGELOG.md +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/LICENSE +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/README.md +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/index.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/append/constant.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/append.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/count.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/help.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/store/constant.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/store/false.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/store/true.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/store.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/subparsers.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/version.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action_container.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/argparse.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/argument/error.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/argument/exclusive.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/argument/group.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/argument_parser.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/const.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/help/added_formatters.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/help/formatter.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/namespace.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/utils.js +0 -0
- /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/package.json +0 -0
|
@@ -1,962 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __values = (this && this.__values) || function(o) {
|
|
3
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
-
if (m) return m.call(o);
|
|
5
|
-
if (o && typeof o.length === "number") return {
|
|
6
|
-
next: function () {
|
|
7
|
-
if (o && i >= o.length) o = void 0;
|
|
8
|
-
return { value: o && o[i++], done: !o };
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
-
};
|
|
13
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
-
if (!m) return o;
|
|
16
|
-
var i = m.call(o), r, ar = [], e;
|
|
17
|
-
try {
|
|
18
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
-
}
|
|
20
|
-
catch (error) { e = { error: error }; }
|
|
21
|
-
finally {
|
|
22
|
-
try {
|
|
23
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
-
}
|
|
25
|
-
finally { if (e) throw e.error; }
|
|
26
|
-
}
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
var interfaces_1 = require("../dom/interfaces");
|
|
31
|
-
var infra_1 = require("@oozcitak/infra");
|
|
32
|
-
var algorithm_1 = require("../algorithm");
|
|
33
|
-
var util_1 = require("../util");
|
|
34
|
-
var AbsoluteURLs;
|
|
35
|
-
(function (AbsoluteURLs) {
|
|
36
|
-
AbsoluteURLs[AbsoluteURLs["kDoNotResolveURLs"] = 0] = "kDoNotResolveURLs";
|
|
37
|
-
AbsoluteURLs[AbsoluteURLs["kResolveAllURLs"] = 1] = "kResolveAllURLs";
|
|
38
|
-
AbsoluteURLs[AbsoluteURLs["kResolveNonLocalURLs"] = 2] = "kResolveNonLocalURLs";
|
|
39
|
-
})(AbsoluteURLs || (AbsoluteURLs = {}));
|
|
40
|
-
var SerializationType;
|
|
41
|
-
(function (SerializationType) {
|
|
42
|
-
SerializationType[SerializationType["kHTML"] = 0] = "kHTML";
|
|
43
|
-
SerializationType[SerializationType["kXML"] = 1] = "kXML";
|
|
44
|
-
})(SerializationType || (SerializationType = {}));
|
|
45
|
-
var IncludeShadowRoots;
|
|
46
|
-
(function (IncludeShadowRoots) {
|
|
47
|
-
IncludeShadowRoots[IncludeShadowRoots["kNoShadowRoots"] = 0] = "kNoShadowRoots";
|
|
48
|
-
IncludeShadowRoots[IncludeShadowRoots["kIncludeShadowRoots"] = 1] = "kIncludeShadowRoots";
|
|
49
|
-
})(IncludeShadowRoots || (IncludeShadowRoots = {}));
|
|
50
|
-
var ChildrenOnly;
|
|
51
|
-
(function (ChildrenOnly) {
|
|
52
|
-
ChildrenOnly[ChildrenOnly["kIncludeNode"] = 0] = "kIncludeNode";
|
|
53
|
-
ChildrenOnly[ChildrenOnly["kChildrenOnly"] = 1] = "kChildrenOnly";
|
|
54
|
-
})(ChildrenOnly || (ChildrenOnly = {}));
|
|
55
|
-
var EntityMask;
|
|
56
|
-
(function (EntityMask) {
|
|
57
|
-
EntityMask[EntityMask["kEntityAmp"] = 1] = "kEntityAmp";
|
|
58
|
-
EntityMask[EntityMask["kEntityLt"] = 2] = "kEntityLt";
|
|
59
|
-
EntityMask[EntityMask["kEntityGt"] = 4] = "kEntityGt";
|
|
60
|
-
EntityMask[EntityMask["kEntityQuot"] = 8] = "kEntityQuot";
|
|
61
|
-
EntityMask[EntityMask["kEntityNbsp"] = 16] = "kEntityNbsp";
|
|
62
|
-
EntityMask[EntityMask["kEntityTab"] = 32] = "kEntityTab";
|
|
63
|
-
EntityMask[EntityMask["kEntityLineFeed"] = 64] = "kEntityLineFeed";
|
|
64
|
-
EntityMask[EntityMask["kEntityCarriageReturn"] = 128] = "kEntityCarriageReturn";
|
|
65
|
-
// Non-breaking space needs to be escaped in innerHTML for compatibility
|
|
66
|
-
// reasons. See http://trac.webkit.org/changeset/32879. However, we cannot do
|
|
67
|
-
// this in an XML document because it does not have the entity reference
|
|
68
|
-
// defined (see bug 19215).
|
|
69
|
-
EntityMask[EntityMask["kEntityMaskInCDATA"] = 0] = "kEntityMaskInCDATA";
|
|
70
|
-
EntityMask[EntityMask["kEntityMaskInPCDATA"] = 7] = "kEntityMaskInPCDATA";
|
|
71
|
-
EntityMask[EntityMask["kEntityMaskInHTMLPCDATA"] = 23] = "kEntityMaskInHTMLPCDATA";
|
|
72
|
-
EntityMask[EntityMask["kEntityMaskInAttributeValue"] = 239] = "kEntityMaskInAttributeValue";
|
|
73
|
-
EntityMask[EntityMask["kEntityMaskInHTMLAttributeValue"] = 25] = "kEntityMaskInHTMLAttributeValue";
|
|
74
|
-
})(EntityMask || (EntityMask = {}));
|
|
75
|
-
;
|
|
76
|
-
function serializeToString(root) {
|
|
77
|
-
var accumulator = new MarkupAccumulator(AbsoluteURLs.kDoNotResolveURLs, SerializationType.kXML, IncludeShadowRoots.kNoShadowRoots);
|
|
78
|
-
return accumulator.SerializeNodes(root, ChildrenOnly.kIncludeNode);
|
|
79
|
-
}
|
|
80
|
-
exports.serializeToString = serializeToString;
|
|
81
|
-
function ElementCannotHaveEndTag(node) {
|
|
82
|
-
//auto* html_element = DynamicTo<HTMLElement>(node);
|
|
83
|
-
//if (!html_element) return false;
|
|
84
|
-
//return !html_element->ShouldSerializeEndTag();
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
function EqualIgnoringNullity(a, b) {
|
|
88
|
-
if (a === null && b !== null && b.length === 0)
|
|
89
|
-
return true;
|
|
90
|
-
if (b === null && a !== null && a.length === 0)
|
|
91
|
-
return true;
|
|
92
|
-
return a === b;
|
|
93
|
-
}
|
|
94
|
-
var MarkupAccumulator = /** @class */ (function () {
|
|
95
|
-
function MarkupAccumulator(resolve_urls_method, serialization_type, include_shadow_roots_) {
|
|
96
|
-
this.include_shadow_roots_ = include_shadow_roots_;
|
|
97
|
-
this.markup_ = { str: "" };
|
|
98
|
-
this.namespace_stack_ = [];
|
|
99
|
-
// https://w3c.github.io/DOM-Parsing/#dfn-generated-namespace-prefix-index
|
|
100
|
-
this.prefix_index_ = 1;
|
|
101
|
-
this.formatter_ = new MarkupFormatter(resolve_urls_method, serialization_type);
|
|
102
|
-
}
|
|
103
|
-
MarkupAccumulator.prototype.AppendEndTag = function (element, prefix) {
|
|
104
|
-
this.formatter_.AppendEndMarkup(this.markup_, element, prefix, element.localName);
|
|
105
|
-
};
|
|
106
|
-
MarkupAccumulator.prototype.AppendStartMarkup = function (node) {
|
|
107
|
-
if (util_1.Guard.isTextNode(node)) {
|
|
108
|
-
this.formatter_.AppendText(this.markup_, node);
|
|
109
|
-
}
|
|
110
|
-
else if (util_1.Guard.isAttrNode(node)) {
|
|
111
|
-
// Only XMLSerializer can pass an Attr. So, |documentIsHTML| flag is
|
|
112
|
-
// false.
|
|
113
|
-
this.formatter_.AppendAttributeValue(this.markup_, node.value, false);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
this.formatter_.AppendStartMarkup(this.markup_, node);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
MarkupAccumulator.prototype.AppendCustomAttributes = function () { };
|
|
120
|
-
MarkupAccumulator.prototype.ShouldIgnoreAttribute = function () {
|
|
121
|
-
return false;
|
|
122
|
-
};
|
|
123
|
-
MarkupAccumulator.prototype.ShouldIgnoreElement = function () {
|
|
124
|
-
return false;
|
|
125
|
-
};
|
|
126
|
-
MarkupAccumulator.prototype.AppendElement = function (element) {
|
|
127
|
-
var e_1, _a, e_2, _b;
|
|
128
|
-
var data = this.AppendStartTagOpen(element);
|
|
129
|
-
if (this.SerializeAsHTML()) {
|
|
130
|
-
// https://html.spec.whatwg.org/C/#html-fragment-serialisation-algorithm
|
|
131
|
-
var attributes = element.attributes;
|
|
132
|
-
// 3.2. Element: If current node's is value is not null, and the
|
|
133
|
-
// element does not have an is attribute in its attribute list, ...
|
|
134
|
-
var is_value = element._is;
|
|
135
|
-
if (is_value !== null && attributes.getNamedItem("is") === undefined) {
|
|
136
|
-
var isAttr = algorithm_1.create_attr(element._nodeDocument, "is");
|
|
137
|
-
isAttr.value = is_value;
|
|
138
|
-
this.AppendAttribute(element, isAttr);
|
|
139
|
-
}
|
|
140
|
-
try {
|
|
141
|
-
for (var attributes_1 = __values(attributes), attributes_1_1 = attributes_1.next(); !attributes_1_1.done; attributes_1_1 = attributes_1.next()) {
|
|
142
|
-
var attribute = attributes_1_1.value;
|
|
143
|
-
if (!this.ShouldIgnoreAttribute())
|
|
144
|
-
this.AppendAttribute(element, attribute);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
148
|
-
finally {
|
|
149
|
-
try {
|
|
150
|
-
if (attributes_1_1 && !attributes_1_1.done && (_a = attributes_1.return)) _a.call(attributes_1);
|
|
151
|
-
}
|
|
152
|
-
finally { if (e_1) throw e_1.error; }
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
try {
|
|
157
|
-
// https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node
|
|
158
|
-
for (var _c = __values(element.attributes), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
159
|
-
var attribute = _d.value;
|
|
160
|
-
if (data.ignore_namespace_definition_attribute_ &&
|
|
161
|
-
attribute.namespaceURI == infra_1.namespace.XMLNS &&
|
|
162
|
-
attribute.prefix === "") {
|
|
163
|
-
// Drop xmlns= only if it's inconsistent with element's namespace.
|
|
164
|
-
// https://github.com/w3c/DOM-Parsing/issues/47
|
|
165
|
-
if (!EqualIgnoringNullity(attribute.value, element.namespaceURI))
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
if (!this.ShouldIgnoreAttribute())
|
|
169
|
-
this.AppendAttribute(element, attribute);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
173
|
-
finally {
|
|
174
|
-
try {
|
|
175
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
176
|
-
}
|
|
177
|
-
finally { if (e_2) throw e_2.error; }
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
// Give an opportunity to subclasses to add their own attributes.
|
|
181
|
-
this.AppendCustomAttributes();
|
|
182
|
-
this.AppendStartTagClose(element);
|
|
183
|
-
return data.serialized_prefix_;
|
|
184
|
-
};
|
|
185
|
-
MarkupAccumulator.prototype.AppendStartTagOpen = function (element) {
|
|
186
|
-
var data = new ElementSerializationData();
|
|
187
|
-
data.serialized_prefix_ = element.prefix;
|
|
188
|
-
if (this.SerializeAsHTML()) {
|
|
189
|
-
this.formatter_.AppendStartTagOpen(this.markup_, element);
|
|
190
|
-
return data;
|
|
191
|
-
}
|
|
192
|
-
// https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node
|
|
193
|
-
var namespace_context = this.namespace_stack_[this.namespace_stack_.length - 1];
|
|
194
|
-
if (namespace_context === undefined) {
|
|
195
|
-
throw new Error("namespace_context is undefined");
|
|
196
|
-
}
|
|
197
|
-
// 5. Let ignore namespace definition attribute be a boolean flag with value
|
|
198
|
-
// false.
|
|
199
|
-
data.ignore_namespace_definition_attribute_ = false;
|
|
200
|
-
// 8. Let local default namespace be the result of recording the namespace
|
|
201
|
-
// information for node given map and local prefixes map.
|
|
202
|
-
var local_default_namespace = namespace_context.RecordNamespaceInformation(element);
|
|
203
|
-
// 9. Let inherited ns be a copy of namespace.
|
|
204
|
-
var inherited_ns = namespace_context.ContextNamespace();
|
|
205
|
-
// 10. Let ns be the value of node's namespaceURI attribute.
|
|
206
|
-
var ns = element.namespaceURI;
|
|
207
|
-
// 11. If inherited ns is equal to ns, then:
|
|
208
|
-
if (inherited_ns == ns) {
|
|
209
|
-
// 11.1. If local default namespace is not null, then set ignore namespace
|
|
210
|
-
// definition attribute to true.
|
|
211
|
-
data.ignore_namespace_definition_attribute_ = local_default_namespace !== null;
|
|
212
|
-
// 11.3. Otherwise, append to qualified name the value of node's
|
|
213
|
-
// localName. The node's prefix if it exists, is dropped.
|
|
214
|
-
// 11.4. Append the value of qualified name to markup.
|
|
215
|
-
this.formatter_.AppendStartTagOpen(this.markup_, null, element.localName);
|
|
216
|
-
data.serialized_prefix_ = null;
|
|
217
|
-
return data;
|
|
218
|
-
}
|
|
219
|
-
// 12. Otherwise, inherited ns is not equal to ns (the node's own namespace is
|
|
220
|
-
// different from the context namespace of its parent). Run these sub-steps:
|
|
221
|
-
// 12.1. Let prefix be the value of node's prefix attribute.
|
|
222
|
-
var prefix = element.prefix;
|
|
223
|
-
// 12.2. Let candidate prefix be the result of retrieving a preferred prefix
|
|
224
|
-
// string prefix from map given namespace ns.
|
|
225
|
-
var candidate_prefix = null;
|
|
226
|
-
if (ns && (prefix || ns != local_default_namespace)) {
|
|
227
|
-
candidate_prefix = this.RetrievePreferredPrefixString(ns, prefix);
|
|
228
|
-
}
|
|
229
|
-
// 12.4. if candidate prefix is not null (a namespace prefix is defined which
|
|
230
|
-
// maps to ns), then:
|
|
231
|
-
if (candidate_prefix !== null && this.LookupNamespaceURI(candidate_prefix)) {
|
|
232
|
-
// 12.4.1. Append to qualified name the concatenation of candidate prefix,
|
|
233
|
-
// ":" (U+003A COLON), and node's localName.
|
|
234
|
-
// 12.4.3. Append the value of qualified name to markup.
|
|
235
|
-
this.formatter_.AppendStartTagOpen(this.markup_, candidate_prefix, element.localName);
|
|
236
|
-
data.serialized_prefix_ = candidate_prefix;
|
|
237
|
-
// 12.4.2. If the local default namespace is not null (there exists a
|
|
238
|
-
// locally-defined default namespace declaration attribute) and its value is
|
|
239
|
-
// not the XML namespace, then let inherited ns get the value of local
|
|
240
|
-
// default namespace unless the local default namespace is the empty string
|
|
241
|
-
// in which case let it get null (the context namespace is changed to the
|
|
242
|
-
// declared default, rather than this node's own namespace).
|
|
243
|
-
if (local_default_namespace != infra_1.namespace.XML) {
|
|
244
|
-
namespace_context.InheritLocalDefaultNamespace(local_default_namespace);
|
|
245
|
-
}
|
|
246
|
-
return data;
|
|
247
|
-
}
|
|
248
|
-
// 12.5. Otherwise, if prefix is not null, then:
|
|
249
|
-
if (prefix) {
|
|
250
|
-
// 12.5.1. If the local prefixes map contains a key matching prefix, then
|
|
251
|
-
// let prefix be the result of generating a prefix providing as input map,
|
|
252
|
-
// ns, and prefix index
|
|
253
|
-
if (element.hasAttribute("xmlns:" + prefix)) {
|
|
254
|
-
prefix = this.GeneratePrefix(ns);
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
// 12.5.2. Add prefix to map given namespace ns.
|
|
258
|
-
this.AddPrefix(prefix, ns);
|
|
259
|
-
}
|
|
260
|
-
// 12.5.3. Append to qualified name the concatenation of prefix, ":" (U+003A
|
|
261
|
-
// COLON), and node's localName.
|
|
262
|
-
// 12.5.4. Append the value of qualified name to markup.
|
|
263
|
-
this.formatter_.AppendStartTagOpen(this.markup_, prefix, element.localName);
|
|
264
|
-
data.serialized_prefix_ = prefix;
|
|
265
|
-
// 12.5.5. Append the following to markup, in the order listed:
|
|
266
|
-
this.formatter_.AppendAttribute(this.markup_, "xmlns", prefix, ns || "", false);
|
|
267
|
-
// 12.5.5.7. If local default namespace is not null (there exists a
|
|
268
|
-
// locally-defined default namespace declaration attribute), then let
|
|
269
|
-
// inherited ns get the value of local default namespace unless the local
|
|
270
|
-
// default namespace is the empty string in which case let it get null.
|
|
271
|
-
namespace_context.InheritLocalDefaultNamespace(local_default_namespace);
|
|
272
|
-
return data;
|
|
273
|
-
}
|
|
274
|
-
// 12.6. Otherwise, if local default namespace is null, or local default
|
|
275
|
-
// namespace is not null and its value is not equal to ns, then:
|
|
276
|
-
if (local_default_namespace === null ||
|
|
277
|
-
!EqualIgnoringNullity(local_default_namespace, ns)) {
|
|
278
|
-
// 12.6.1. Set the ignore namespace definition attribute flag to true.
|
|
279
|
-
data.ignore_namespace_definition_attribute_ = true;
|
|
280
|
-
// 12.6.3. Let the value of inherited ns be ns.
|
|
281
|
-
namespace_context.SetContextNamespace(ns);
|
|
282
|
-
// 12.6.4. Append the value of qualified name to markup.
|
|
283
|
-
this.formatter_.AppendStartTagOpen(this.markup_, element);
|
|
284
|
-
// 12.6.5. Append the following to markup, in the order listed:
|
|
285
|
-
this.formatter_.AppendAttribute(this.markup_, null, "xmlns", ns || "", false);
|
|
286
|
-
return data;
|
|
287
|
-
}
|
|
288
|
-
// 12.7. Otherwise, the node has a local default namespace that matches
|
|
289
|
-
// ns. Append to qualified name the value of node's localName, let the value
|
|
290
|
-
// of inherited ns be ns, and append the value of qualified name to markup.
|
|
291
|
-
console.assert(EqualIgnoringNullity(local_default_namespace, ns));
|
|
292
|
-
namespace_context.SetContextNamespace(ns);
|
|
293
|
-
this.formatter_.AppendStartTagOpen(this.markup_, element);
|
|
294
|
-
return data;
|
|
295
|
-
};
|
|
296
|
-
MarkupAccumulator.prototype.AppendStartTagClose = function (element) {
|
|
297
|
-
this.formatter_.AppendStartTagClose(this.markup_, element);
|
|
298
|
-
};
|
|
299
|
-
MarkupAccumulator.prototype.AppendAttribute = function (element, attribute) {
|
|
300
|
-
var value = this.formatter_.ResolveURLIfNeeded(element, attribute);
|
|
301
|
-
if (this.SerializeAsHTML()) {
|
|
302
|
-
this.formatter_.AppendAttributeAsHTML(this.markup_, attribute, value);
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
this.AppendAttributeAsXMLWithNamespace(attribute, value);
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
MarkupAccumulator.prototype.AppendAttributeAsXMLWithNamespace = function (attribute, value) {
|
|
309
|
-
// https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes
|
|
310
|
-
// 3.3. Let attribute namespace be the value of attr's namespaceURI value.
|
|
311
|
-
var attribute_namespace = attribute.namespaceURI;
|
|
312
|
-
// 3.4. Let candidate prefix be null.
|
|
313
|
-
var candidate_prefix = null;
|
|
314
|
-
if (attribute_namespace === null) {
|
|
315
|
-
this.formatter_.AppendAttribute(this.markup_, candidate_prefix, attribute.localName, value, false);
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
// 3.5. If attribute namespace is not null, then run these sub-steps:
|
|
319
|
-
// 3.5.1. Let candidate prefix be the result of retrieving a preferred
|
|
320
|
-
// prefix string from map given namespace attribute namespace with preferred
|
|
321
|
-
// prefix being attr's prefix value.
|
|
322
|
-
candidate_prefix =
|
|
323
|
-
this.RetrievePreferredPrefixString(attribute_namespace, attribute.prefix);
|
|
324
|
-
// 3.5.2. If the value of attribute namespace is the XMLNS namespace, then
|
|
325
|
-
// run these steps:
|
|
326
|
-
if (attribute_namespace == infra_1.namespace.XMLNS) {
|
|
327
|
-
if (!attribute.prefix && attribute.localName !== "xmlns")
|
|
328
|
-
candidate_prefix = "xmlns";
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
// 3.5.3. Otherwise, the attribute namespace in not the XMLNS namespace.
|
|
332
|
-
// Run these steps:
|
|
333
|
-
if (this.ShouldAddNamespaceAttribute(attribute, candidate_prefix)) {
|
|
334
|
-
if (!candidate_prefix || this.LookupNamespaceURI(candidate_prefix)) {
|
|
335
|
-
// 3.5.3.1. Let candidate prefix be the result of generating a prefix
|
|
336
|
-
// providing map, attribute namespace, and prefix index as input.
|
|
337
|
-
candidate_prefix = this.GeneratePrefix(attribute_namespace);
|
|
338
|
-
// 3.5.3.2. Append the following to result, in the order listed:
|
|
339
|
-
this.formatter_.AppendAttribute(this.markup_, "xmlns", candidate_prefix, attribute_namespace, false);
|
|
340
|
-
}
|
|
341
|
-
else {
|
|
342
|
-
this.AppendNamespace(candidate_prefix, attribute_namespace);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
this.formatter_.AppendAttribute(this.markup_, candidate_prefix, attribute.localName, value, false);
|
|
347
|
-
};
|
|
348
|
-
MarkupAccumulator.prototype.ShouldAddNamespaceAttribute = function (attribute, candidate_prefix) {
|
|
349
|
-
// xmlns and xmlns:prefix attributes should be handled by another branch in
|
|
350
|
-
// AppendAttributeAsXMLWithNamespace().
|
|
351
|
-
console.assert(attribute.namespaceURI !== infra_1.namespace.XMLNS);
|
|
352
|
-
// Null namespace is checked earlier in AppendAttributeAsXMLWithNamespace().
|
|
353
|
-
console.assert(attribute.namespaceURI);
|
|
354
|
-
// Attributes without a prefix will need one generated for them, and an xmlns
|
|
355
|
-
// attribute for that prefix.
|
|
356
|
-
if (!candidate_prefix)
|
|
357
|
-
return true;
|
|
358
|
-
return !EqualIgnoringNullity(this.LookupNamespaceURI(candidate_prefix), attribute.namespaceURI);
|
|
359
|
-
};
|
|
360
|
-
MarkupAccumulator.prototype.AppendNamespace = function (prefix, namespace_uri) {
|
|
361
|
-
var found_uri = this.LookupNamespaceURI(prefix);
|
|
362
|
-
if (!EqualIgnoringNullity(found_uri, namespace_uri)) {
|
|
363
|
-
this.AddPrefix(prefix, namespace_uri);
|
|
364
|
-
if (!prefix) {
|
|
365
|
-
this.formatter_.AppendAttribute(this.markup_, null, "xmlns", namespace_uri, false);
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
this.formatter_.AppendAttribute(this.markup_, "xmlns", prefix, namespace_uri, false);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
};
|
|
372
|
-
MarkupAccumulator.prototype.PushNamespaces = function () {
|
|
373
|
-
if (this.SerializeAsHTML())
|
|
374
|
-
return;
|
|
375
|
-
console.assert(this.namespace_stack_.length > 0);
|
|
376
|
-
// TODO(tkent): Avoid to copy the whole map.
|
|
377
|
-
// We can't do |namespace_stack_.emplace_back(namespace_stack_.back())|
|
|
378
|
-
// because back() returns a reference in the vector backing, and
|
|
379
|
-
// emplace_back() can reallocate it.
|
|
380
|
-
this.namespace_stack_.push(this.namespace_stack_[this.namespace_stack_.length - 1].Clone());
|
|
381
|
-
};
|
|
382
|
-
MarkupAccumulator.prototype.PopNamespaces = function () {
|
|
383
|
-
if (this.SerializeAsHTML())
|
|
384
|
-
return;
|
|
385
|
-
this.namespace_stack_.pop();
|
|
386
|
-
};
|
|
387
|
-
// https://w3c.github.io/DOM-Parsing/#dfn-retrieving-a-preferred-prefix-string
|
|
388
|
-
MarkupAccumulator.prototype.RetrievePreferredPrefixString = function (ns, preferred_prefix) {
|
|
389
|
-
var e_3, _a;
|
|
390
|
-
console.assert(ns);
|
|
391
|
-
var ns_for_preferred = this.LookupNamespaceURI(preferred_prefix);
|
|
392
|
-
// Preserve the prefix if the prefix is used in the scope and the namespace
|
|
393
|
-
// for it is matches to the node's one.
|
|
394
|
-
// This is equivalent to the following step in the specification:
|
|
395
|
-
// 2.1. If prefix matches preferred prefix, then stop running these steps and
|
|
396
|
-
// return prefix.
|
|
397
|
-
if (preferred_prefix && ns_for_preferred !== null &&
|
|
398
|
-
EqualIgnoringNullity(ns_for_preferred, ns))
|
|
399
|
-
return preferred_prefix;
|
|
400
|
-
var candidate_list = this.namespace_stack_[this.namespace_stack_.length - 1].PrefixList(ns);
|
|
401
|
-
try {
|
|
402
|
-
// Get the last effective prefix.
|
|
403
|
-
//
|
|
404
|
-
// <el1 xmlns:p="U1" xmlns:q="U1">
|
|
405
|
-
// <el2 xmlns:q="U2">
|
|
406
|
-
// el2.setAttributeNS(U1, 'n', 'v');
|
|
407
|
-
// We should get 'p'.
|
|
408
|
-
//
|
|
409
|
-
// <el1 xmlns="U1">
|
|
410
|
-
// el1.setAttributeNS(U1, 'n', 'v');
|
|
411
|
-
// We should not get '' for attributes.
|
|
412
|
-
for (var candidate_list_1 = __values(candidate_list), candidate_list_1_1 = candidate_list_1.next(); !candidate_list_1_1.done; candidate_list_1_1 = candidate_list_1.next()) {
|
|
413
|
-
var candidate_prefix = candidate_list_1_1.value;
|
|
414
|
-
console.assert(candidate_prefix);
|
|
415
|
-
var ns_for_candidate = this.LookupNamespaceURI(candidate_prefix);
|
|
416
|
-
if (EqualIgnoringNullity(ns_for_candidate, ns))
|
|
417
|
-
return candidate_prefix;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
421
|
-
finally {
|
|
422
|
-
try {
|
|
423
|
-
if (candidate_list_1_1 && !candidate_list_1_1.done && (_a = candidate_list_1.return)) _a.call(candidate_list_1);
|
|
424
|
-
}
|
|
425
|
-
finally { if (e_3) throw e_3.error; }
|
|
426
|
-
}
|
|
427
|
-
// No prefixes for |ns|.
|
|
428
|
-
// Preserve the prefix if the prefix is not used in the current scope.
|
|
429
|
-
if (preferred_prefix && ns_for_preferred === null)
|
|
430
|
-
return preferred_prefix;
|
|
431
|
-
// If a prefix is not specified, or the prefix is mapped to a
|
|
432
|
-
// different namespace, we should generate new prefix.
|
|
433
|
-
return null;
|
|
434
|
-
};
|
|
435
|
-
MarkupAccumulator.prototype.AddPrefix = function (prefix, namespace_uri) {
|
|
436
|
-
this.namespace_stack_[this.namespace_stack_.length - 1].Add(prefix, namespace_uri);
|
|
437
|
-
};
|
|
438
|
-
MarkupAccumulator.prototype.LookupNamespaceURI = function (prefix) {
|
|
439
|
-
return this.namespace_stack_[this.namespace_stack_.length - 1].LookupNamespaceURI(prefix);
|
|
440
|
-
};
|
|
441
|
-
// https://w3c.github.io/DOM-Parsing/#dfn-generating-a-prefix
|
|
442
|
-
MarkupAccumulator.prototype.GeneratePrefix = function (new_namespace) {
|
|
443
|
-
var generated_prefix = "";
|
|
444
|
-
do {
|
|
445
|
-
// 1. Let generated prefix be the concatenation of the string "ns" and the
|
|
446
|
-
// current numerical value of prefix index.
|
|
447
|
-
generated_prefix = "ns" + this.prefix_index_.toString();
|
|
448
|
-
// 2. Let the value of prefix index be incremented by one.
|
|
449
|
-
this.prefix_index_++;
|
|
450
|
-
} while (this.LookupNamespaceURI(generated_prefix));
|
|
451
|
-
// 3. Add to map the generated prefix given the new namespace namespace.
|
|
452
|
-
this.AddPrefix(generated_prefix, new_namespace);
|
|
453
|
-
// 4. Return the value of generated prefix.
|
|
454
|
-
return generated_prefix;
|
|
455
|
-
};
|
|
456
|
-
MarkupAccumulator.prototype.SerializeAsHTML = function () {
|
|
457
|
-
return this.formatter_.SerializeAsHTML();
|
|
458
|
-
};
|
|
459
|
-
MarkupAccumulator.prototype.GetAuxiliaryDOMTree = function (element) {
|
|
460
|
-
var shadow_root = element._shadowRoot;
|
|
461
|
-
if (!shadow_root || this.include_shadow_roots_ != IncludeShadowRoots.kIncludeShadowRoots)
|
|
462
|
-
return [null, null];
|
|
463
|
-
var shadowroot_type = shadow_root._mode;
|
|
464
|
-
// Wrap the shadowroot into a declarative Shadow DOM <template shadowroot>
|
|
465
|
-
// element.
|
|
466
|
-
var template_element = algorithm_1.create_element(element._nodeDocument, "template", null, null);
|
|
467
|
-
template_element.setAttribute("shadowroot", shadowroot_type);
|
|
468
|
-
return [shadow_root, template_element];
|
|
469
|
-
};
|
|
470
|
-
MarkupAccumulator.prototype.SerializeNodesWithNamespaces = function (target_node, children_only) {
|
|
471
|
-
var e_4, _a, e_5, _b, e_6, _c;
|
|
472
|
-
if (!util_1.Guard.isElementNode(target_node)) {
|
|
473
|
-
if (!children_only)
|
|
474
|
-
this.AppendStartMarkup(target_node);
|
|
475
|
-
try {
|
|
476
|
-
for (var _d = __values(target_node._children), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
477
|
-
var child = _e.value;
|
|
478
|
-
this.SerializeNodesWithNamespaces(child, ChildrenOnly.kIncludeNode);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
482
|
-
finally {
|
|
483
|
-
try {
|
|
484
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
485
|
-
}
|
|
486
|
-
finally { if (e_4) throw e_4.error; }
|
|
487
|
-
}
|
|
488
|
-
return;
|
|
489
|
-
}
|
|
490
|
-
var target_element = target_node;
|
|
491
|
-
if (this.ShouldIgnoreElement())
|
|
492
|
-
return;
|
|
493
|
-
this.PushNamespaces();
|
|
494
|
-
var prefix_override = null;
|
|
495
|
-
if (!children_only)
|
|
496
|
-
prefix_override = this.AppendElement(target_element);
|
|
497
|
-
var has_end_tag = !(this.SerializeAsHTML() && ElementCannotHaveEndTag(target_element));
|
|
498
|
-
if (has_end_tag) {
|
|
499
|
-
var parent = target_element;
|
|
500
|
-
try {
|
|
501
|
-
// if (auto * template_element = DynamicTo<HTMLTemplateElement>(target_element))
|
|
502
|
-
// parent = template_element -> content()
|
|
503
|
-
for (var _f = __values(parent._children), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
504
|
-
var child = _g.value;
|
|
505
|
-
this.SerializeNodesWithNamespaces(child, ChildrenOnly.kIncludeNode);
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
509
|
-
finally {
|
|
510
|
-
try {
|
|
511
|
-
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
512
|
-
}
|
|
513
|
-
finally { if (e_5) throw e_5.error; }
|
|
514
|
-
}
|
|
515
|
-
// Traverses other DOM tree, i.e., shadow tree.
|
|
516
|
-
var _h = __read(this.GetAuxiliaryDOMTree(target_element), 2), auxiliary_tree = _h[0], enclosing_element = _h[1];
|
|
517
|
-
if (auxiliary_tree) {
|
|
518
|
-
var enclosing_element_prefix = null;
|
|
519
|
-
if (enclosing_element) {
|
|
520
|
-
enclosing_element_prefix = this.AppendElement(enclosing_element);
|
|
521
|
-
}
|
|
522
|
-
try {
|
|
523
|
-
for (var _j = __values(auxiliary_tree._children), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
524
|
-
var child = _k.value;
|
|
525
|
-
this.SerializeNodesWithNamespaces(child, ChildrenOnly.kIncludeNode);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
529
|
-
finally {
|
|
530
|
-
try {
|
|
531
|
-
if (_k && !_k.done && (_c = _j.return)) _c.call(_j);
|
|
532
|
-
}
|
|
533
|
-
finally { if (e_6) throw e_6.error; }
|
|
534
|
-
}
|
|
535
|
-
if (enclosing_element) {
|
|
536
|
-
this.AppendEndTag(enclosing_element, enclosing_element_prefix);
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
if (!children_only) {
|
|
540
|
-
this.AppendEndTag(target_element, prefix_override);
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
this.PopNamespaces();
|
|
544
|
-
};
|
|
545
|
-
MarkupAccumulator.prototype.SerializeNodes = function (target_node, children_only) {
|
|
546
|
-
if (!this.SerializeAsHTML()) {
|
|
547
|
-
// https://w3c.github.io/DOM-Parsing/#dfn-xml-serialization
|
|
548
|
-
// 2. Let prefix map be a new namespace prefix map.
|
|
549
|
-
this.namespace_stack_ = [];
|
|
550
|
-
this.namespace_stack_.push(new NamespaceContext());
|
|
551
|
-
// 3. Add the XML namespace with prefix value "xml" to prefix map.
|
|
552
|
-
this.AddPrefix("xml", infra_1.namespace.XML);
|
|
553
|
-
// 4. Let prefix index be a generated namespace prefix index with value 1.
|
|
554
|
-
this.prefix_index_ = 1;
|
|
555
|
-
}
|
|
556
|
-
this.SerializeNodesWithNamespaces(target_node, children_only);
|
|
557
|
-
return this.ToString();
|
|
558
|
-
};
|
|
559
|
-
MarkupAccumulator.prototype.ToString = function () { return this.markup_.str; };
|
|
560
|
-
return MarkupAccumulator;
|
|
561
|
-
}());
|
|
562
|
-
var NamespaceContext = /** @class */ (function () {
|
|
563
|
-
function NamespaceContext() {
|
|
564
|
-
this.prefix_ns_map_ = new Map();
|
|
565
|
-
// Map a namespace URI to a list of prefixes.
|
|
566
|
-
// https://w3c.github.io/DOM-Parsing/#the-namespace-prefix-map
|
|
567
|
-
this.ns_prefixes_map_ = new Map();
|
|
568
|
-
// https://w3c.github.io/DOM-Parsing/#dfn-context-namespace
|
|
569
|
-
this.context_namespace_ = null;
|
|
570
|
-
}
|
|
571
|
-
// https://w3c.github.io/DOM-Parsing/#dfn-add
|
|
572
|
-
//
|
|
573
|
-
// This function doesn't accept empty prefix and empty namespace URI.
|
|
574
|
-
// - The default namespace is managed separately.
|
|
575
|
-
// - Namespace URI never be empty if the prefix is not empty.
|
|
576
|
-
NamespaceContext.prototype.Add = function (prefix, namespace_uri) {
|
|
577
|
-
if (prefix === null)
|
|
578
|
-
throw new Error("prefix should not be empty.");
|
|
579
|
-
if (namespace_uri === null)
|
|
580
|
-
throw new Error("namespace_uri should not be empty.");
|
|
581
|
-
this.prefix_ns_map_.set(prefix, namespace_uri);
|
|
582
|
-
this.ns_prefixes_map_.set(namespace_uri, [prefix]);
|
|
583
|
-
};
|
|
584
|
-
// https://w3c.github.io/DOM-Parsing/#dfn-recording-the-namespace-information
|
|
585
|
-
NamespaceContext.prototype.RecordNamespaceInformation = function (element) {
|
|
586
|
-
var e_7, _a;
|
|
587
|
-
var local_default_namespace = "";
|
|
588
|
-
try {
|
|
589
|
-
// 2. For each attribute attr in element's attributes, in the order they are
|
|
590
|
-
// specified in the element's attribute list:
|
|
591
|
-
for (var _b = __values(element.attributes), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
592
|
-
var attr = _c.value;
|
|
593
|
-
// We don't check xmlns namespace of attr here because xmlns attributes in
|
|
594
|
-
// HTML documents don't have namespace URI. Some web tests serialize
|
|
595
|
-
// HTML documents with XMLSerializer, and Firefox has the same behavior.
|
|
596
|
-
if (attr.prefix === "" && attr.localName === "xmlns") {
|
|
597
|
-
// 3.1. If attribute prefix is null, then attr is a default namespace
|
|
598
|
-
// declaration. Set the default namespace attr value to attr's value
|
|
599
|
-
// and stop running these steps, returning to Main to visit the next
|
|
600
|
-
// attribute.
|
|
601
|
-
local_default_namespace = attr.value;
|
|
602
|
-
}
|
|
603
|
-
else if (attr.prefix == "xmlns") {
|
|
604
|
-
this.Add(attr.prefix ? attr.localName : "", attr.value);
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
609
|
-
finally {
|
|
610
|
-
try {
|
|
611
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
612
|
-
}
|
|
613
|
-
finally { if (e_7) throw e_7.error; }
|
|
614
|
-
}
|
|
615
|
-
// 3. Return the value of default namespace attr value.
|
|
616
|
-
return local_default_namespace;
|
|
617
|
-
};
|
|
618
|
-
NamespaceContext.prototype.LookupNamespaceURI = function (prefix) {
|
|
619
|
-
if (prefix === null)
|
|
620
|
-
return "";
|
|
621
|
-
return this.prefix_ns_map_.get(prefix) || "";
|
|
622
|
-
};
|
|
623
|
-
NamespaceContext.prototype.ContextNamespace = function () { return this.context_namespace_; };
|
|
624
|
-
NamespaceContext.prototype.SetContextNamespace = function (context_ns) {
|
|
625
|
-
this.context_namespace_ = context_ns;
|
|
626
|
-
};
|
|
627
|
-
NamespaceContext.prototype.InheritLocalDefaultNamespace = function (local_default_namespace) {
|
|
628
|
-
if (!local_default_namespace) {
|
|
629
|
-
return;
|
|
630
|
-
}
|
|
631
|
-
this.SetContextNamespace(local_default_namespace === "" ?
|
|
632
|
-
null : local_default_namespace);
|
|
633
|
-
};
|
|
634
|
-
NamespaceContext.prototype.PrefixList = function (ns) {
|
|
635
|
-
return this.ns_prefixes_map_.get(ns ? ns : "") || [];
|
|
636
|
-
};
|
|
637
|
-
NamespaceContext.prototype.Clone = function () {
|
|
638
|
-
var e_8, _a, e_9, _b;
|
|
639
|
-
var clone = new NamespaceContext();
|
|
640
|
-
try {
|
|
641
|
-
for (var _c = __values(this.prefix_ns_map_), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
642
|
-
var _e = __read(_d.value, 2), key = _e[0], val = _e[1];
|
|
643
|
-
clone.prefix_ns_map_.set(key, val);
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
647
|
-
finally {
|
|
648
|
-
try {
|
|
649
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
650
|
-
}
|
|
651
|
-
finally { if (e_8) throw e_8.error; }
|
|
652
|
-
}
|
|
653
|
-
try {
|
|
654
|
-
for (var _f = __values(this.ns_prefixes_map_), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
655
|
-
var _h = __read(_g.value, 2), key = _h[0], val = _h[1];
|
|
656
|
-
clone.ns_prefixes_map_.set(key, val.slice());
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
660
|
-
finally {
|
|
661
|
-
try {
|
|
662
|
-
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
663
|
-
}
|
|
664
|
-
finally { if (e_9) throw e_9.error; }
|
|
665
|
-
}
|
|
666
|
-
clone.context_namespace_ = this.context_namespace_;
|
|
667
|
-
return clone;
|
|
668
|
-
};
|
|
669
|
-
return NamespaceContext;
|
|
670
|
-
}());
|
|
671
|
-
// This stores values used to serialize an element. The values are not
|
|
672
|
-
// inherited to child node serialization.
|
|
673
|
-
var ElementSerializationData = /** @class */ (function () {
|
|
674
|
-
function ElementSerializationData() {
|
|
675
|
-
// https://w3c.github.io/DOM-Parsing/#dfn-ignore-namespace-definition-attribute
|
|
676
|
-
this.ignore_namespace_definition_attribute_ = false;
|
|
677
|
-
this.serialized_prefix_ = null;
|
|
678
|
-
}
|
|
679
|
-
return ElementSerializationData;
|
|
680
|
-
}());
|
|
681
|
-
var MarkupFormatter = /** @class */ (function () {
|
|
682
|
-
function MarkupFormatter(resolve_urls_method_, serialization_type_) {
|
|
683
|
-
this.resolve_urls_method_ = resolve_urls_method_;
|
|
684
|
-
this.serialization_type_ = serialization_type_;
|
|
685
|
-
}
|
|
686
|
-
MarkupFormatter.prototype.SerializeAsHTML = function () {
|
|
687
|
-
return this.serialization_type_ == SerializationType.kHTML;
|
|
688
|
-
};
|
|
689
|
-
MarkupFormatter.prototype.ResolveURLIfNeeded = function (element, attribute) {
|
|
690
|
-
var value = attribute.value;
|
|
691
|
-
/*
|
|
692
|
-
switch (this.resolve_urls_method_) {
|
|
693
|
-
case AbsoluteURLs.kResolveAllURLs:
|
|
694
|
-
if (element.IsURLAttribute(attribute))
|
|
695
|
-
return element.GetDocument().CompleteURL(value).GetString()
|
|
696
|
-
break
|
|
697
|
-
|
|
698
|
-
case AbsoluteURLs.kResolveNonLocalURLs:
|
|
699
|
-
if (element.IsURLAttribute(attribute) &&
|
|
700
|
-
!element.GetDocument().Url().IsLocalFile())
|
|
701
|
-
return element.GetDocument().CompleteURL(value).GetString()
|
|
702
|
-
break
|
|
703
|
-
|
|
704
|
-
case AbsoluteURLs.kDoNotResolveURLs:
|
|
705
|
-
break
|
|
706
|
-
}
|
|
707
|
-
*/
|
|
708
|
-
return value;
|
|
709
|
-
};
|
|
710
|
-
MarkupFormatter.prototype.EntityMaskForText = function (text) {
|
|
711
|
-
if (!this.SerializeAsHTML()) {
|
|
712
|
-
return EntityMask.kEntityMaskInPCDATA;
|
|
713
|
-
}
|
|
714
|
-
/**
|
|
715
|
-
// TODO(hajimehoshi): We need to switch EditingStrategy.
|
|
716
|
-
parent_name = text.parentElement?._qualifiedName
|
|
717
|
-
|
|
718
|
-
if (parent_name === "script" ||
|
|
719
|
-
parent_name === "style" ||
|
|
720
|
-
parent_name === "xmp" ||
|
|
721
|
-
parent_name === "iframe" ||
|
|
722
|
-
parent_name === "plaintext" ||
|
|
723
|
-
parent_name === "noembed" ||
|
|
724
|
-
parent_name === "noframes" ||
|
|
725
|
-
(parent_name === "noscript" &&
|
|
726
|
-
text.GetDocument().GetFrame() &&
|
|
727
|
-
text.GetDocument().CanExecuteScripts(kNotAboutToExecuteScript))))
|
|
728
|
-
return kEntityMaskInCDATA;
|
|
729
|
-
*/
|
|
730
|
-
return EntityMask.kEntityMaskInHTMLPCDATA;
|
|
731
|
-
};
|
|
732
|
-
MarkupFormatter.prototype.AppendAttribute = function (result, prefix, local_name, value, document_is_html) {
|
|
733
|
-
result.str += ' ';
|
|
734
|
-
if (prefix) {
|
|
735
|
-
result.str += prefix;
|
|
736
|
-
result.str += ':';
|
|
737
|
-
}
|
|
738
|
-
result.str += local_name;
|
|
739
|
-
result.str += "=\"";
|
|
740
|
-
this.AppendAttributeValue(result, value, document_is_html);
|
|
741
|
-
result.str += '"';
|
|
742
|
-
};
|
|
743
|
-
MarkupFormatter.prototype.AppendAttributeAsHTML = function (result, attribute, value) {
|
|
744
|
-
// https://html.spec.whatwg.org/C/#attribute's-serialised-name
|
|
745
|
-
var _a = __read(algorithm_1.namespace_extractQName(attribute._qualifiedName), 2), prefix = _a[0], localName = _a[1];
|
|
746
|
-
if (attribute.namespaceURI === infra_1.namespace.XMLNS) {
|
|
747
|
-
if (!prefix && localName !== "xmlns")
|
|
748
|
-
prefix = "xmlns";
|
|
749
|
-
}
|
|
750
|
-
else if (attribute.namespaceURI === infra_1.namespace.XML) {
|
|
751
|
-
prefix = "xml";
|
|
752
|
-
}
|
|
753
|
-
else if (attribute.namespaceURI === infra_1.namespace.XLink) {
|
|
754
|
-
prefix = "xlink";
|
|
755
|
-
}
|
|
756
|
-
this.AppendAttribute(result, prefix, localName, value, true);
|
|
757
|
-
};
|
|
758
|
-
MarkupFormatter.prototype.AppendAttributeAsXMLWithoutNamespace = function (result, attribute, value) {
|
|
759
|
-
var attribute_namespace = attribute.namespaceURI;
|
|
760
|
-
var candidate_prefix = attribute.prefix;
|
|
761
|
-
if (attribute_namespace === infra_1.namespace.XMLNS) {
|
|
762
|
-
if (!attribute.prefix && attribute.localName != "xmlns")
|
|
763
|
-
candidate_prefix = "xmlns";
|
|
764
|
-
}
|
|
765
|
-
else if (attribute_namespace === infra_1.namespace.XML) {
|
|
766
|
-
if (!candidate_prefix)
|
|
767
|
-
candidate_prefix = "xml";
|
|
768
|
-
}
|
|
769
|
-
else if (attribute_namespace == infra_1.namespace.XLink) {
|
|
770
|
-
if (!candidate_prefix)
|
|
771
|
-
candidate_prefix = "xlink";
|
|
772
|
-
}
|
|
773
|
-
this.AppendAttribute(result, candidate_prefix, attribute.localName, value, false);
|
|
774
|
-
};
|
|
775
|
-
MarkupFormatter.prototype.AppendAttributeValue = function (result, attribute, document_is_html) {
|
|
776
|
-
this.AppendCharactersReplacingEntities(result, attribute, 0, attribute.length, document_is_html ? EntityMask.kEntityMaskInHTMLAttributeValue : EntityMask.kEntityMaskInAttributeValue);
|
|
777
|
-
};
|
|
778
|
-
MarkupFormatter.prototype.AppendStartMarkup = function (result, node) {
|
|
779
|
-
switch (node.nodeType) {
|
|
780
|
-
case interfaces_1.NodeType.Text:
|
|
781
|
-
break;
|
|
782
|
-
case interfaces_1.NodeType.Comment:
|
|
783
|
-
this.AppendComment(result, node.data);
|
|
784
|
-
break;
|
|
785
|
-
case interfaces_1.NodeType.Document:
|
|
786
|
-
this.AppendXMLDeclaration(result, node);
|
|
787
|
-
break;
|
|
788
|
-
case interfaces_1.NodeType.DocumentFragment:
|
|
789
|
-
break;
|
|
790
|
-
case interfaces_1.NodeType.DocumentType:
|
|
791
|
-
this.AppendDocumentType(result, node);
|
|
792
|
-
break;
|
|
793
|
-
case interfaces_1.NodeType.ProcessingInstruction:
|
|
794
|
-
this.AppendProcessingInstruction(result, node.target, node.data);
|
|
795
|
-
break;
|
|
796
|
-
case interfaces_1.NodeType.Element:
|
|
797
|
-
break;
|
|
798
|
-
case interfaces_1.NodeType.CData:
|
|
799
|
-
this.AppendCDATASection(result, node.data);
|
|
800
|
-
break;
|
|
801
|
-
case interfaces_1.NodeType.Attribute:
|
|
802
|
-
break;
|
|
803
|
-
}
|
|
804
|
-
};
|
|
805
|
-
MarkupFormatter.prototype.AppendEndMarkup = function (result, element, prefix, local_name) {
|
|
806
|
-
if (prefix === void 0) { prefix = element.prefix; }
|
|
807
|
-
if (local_name === void 0) { local_name = element.localName; }
|
|
808
|
-
if (this.ShouldSelfClose(element) || (!element.hasChildNodes() && ElementCannotHaveEndTag(element))) {
|
|
809
|
-
return;
|
|
810
|
-
}
|
|
811
|
-
result.str += "</";
|
|
812
|
-
if (prefix) {
|
|
813
|
-
result.str += prefix + ':';
|
|
814
|
-
}
|
|
815
|
-
result.str += local_name + '>';
|
|
816
|
-
};
|
|
817
|
-
MarkupFormatter.prototype.AppendStartTagOpen = function (result, elementOrPrefix, local_name) {
|
|
818
|
-
var prefix = util_1.Guard.isElementNode(elementOrPrefix) ? elementOrPrefix.prefix : elementOrPrefix;
|
|
819
|
-
var localName = util_1.Guard.isElementNode(elementOrPrefix) ? elementOrPrefix.localName : (local_name || "");
|
|
820
|
-
result.str += '<';
|
|
821
|
-
if (prefix) {
|
|
822
|
-
result.str += prefix;
|
|
823
|
-
result.str += ":";
|
|
824
|
-
}
|
|
825
|
-
result.str += localName;
|
|
826
|
-
};
|
|
827
|
-
MarkupFormatter.prototype.AppendStartTagClose = function (result, element) {
|
|
828
|
-
if (this.ShouldSelfClose(element)) {
|
|
829
|
-
//if (element.IsHTMLElement())
|
|
830
|
-
// result.Append(' ') // XHTML 1.0 <-> HTML compatibility.
|
|
831
|
-
result.str += '/';
|
|
832
|
-
}
|
|
833
|
-
result.str += '>';
|
|
834
|
-
};
|
|
835
|
-
MarkupFormatter.prototype.AppendText = function (result, text) {
|
|
836
|
-
var str = text.data;
|
|
837
|
-
this.AppendCharactersReplacingEntities(result, str, 0, str.length, this.EntityMaskForText(text));
|
|
838
|
-
};
|
|
839
|
-
MarkupFormatter.prototype.AppendComment = function (result, comment) {
|
|
840
|
-
// FIXME: Comment content is not escaped, but XMLSerializer (and possibly
|
|
841
|
-
// other callers) should raise an exception if it includes "-->".
|
|
842
|
-
result.str += "<!--" + comment + "-->";
|
|
843
|
-
};
|
|
844
|
-
MarkupFormatter.prototype.AppendXMLDeclaration = function (result, document) {
|
|
845
|
-
/*
|
|
846
|
-
if (!document.HasXMLDeclaration())
|
|
847
|
-
return
|
|
848
|
-
|
|
849
|
-
result.Append("<?xml version=\"")
|
|
850
|
-
result.Append(document.xmlVersion())
|
|
851
|
-
const String& encoding = document.xmlEncoding()
|
|
852
|
-
if (!encoding.IsEmpty()) {
|
|
853
|
-
result.Append("\" encoding=\"")
|
|
854
|
-
result.Append(encoding)
|
|
855
|
-
}
|
|
856
|
-
if (document.XmlStandaloneStatus() != Document:: kStandaloneUnspecified) {
|
|
857
|
-
result.Append("\" standalone=\"")
|
|
858
|
-
if (document.xmlStandalone())
|
|
859
|
-
result.Append("yes")
|
|
860
|
-
else
|
|
861
|
-
result.Append("no")
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
result.Append("\"?>")
|
|
865
|
-
*/
|
|
866
|
-
};
|
|
867
|
-
MarkupFormatter.prototype.AppendDocumentType = function (result, n) {
|
|
868
|
-
if (!n.name)
|
|
869
|
-
return;
|
|
870
|
-
result.str += "<!DOCTYPE " + n.name;
|
|
871
|
-
if (n.publicId) {
|
|
872
|
-
result.str += " PUBLIC \"" + n.publicId + "\"";
|
|
873
|
-
if (n.systemId) {
|
|
874
|
-
result.str += " \"" + n.systemId + "\"";
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
else if (n.systemId) {
|
|
878
|
-
result.str += " SYSTEM \"" + n.systemId + "\"";
|
|
879
|
-
}
|
|
880
|
-
result.str += ">";
|
|
881
|
-
};
|
|
882
|
-
MarkupFormatter.prototype.AppendProcessingInstruction = function (result, target, data) {
|
|
883
|
-
// FIXME: PI data is not escaped, but XMLSerializer (and possibly other
|
|
884
|
-
// callers) this should raise an exception if it includes "?>".
|
|
885
|
-
result.str += "<?" + target + ' ' + data + "?>";
|
|
886
|
-
};
|
|
887
|
-
MarkupFormatter.prototype.AppendCDATASection = function (result, section) {
|
|
888
|
-
// FIXME: CDATA content is not escaped, but XMLSerializer (and possibly other
|
|
889
|
-
// callers) should raise an exception if it includes "]]>".
|
|
890
|
-
result.str += "<![CDATA[" + section + "]]>";
|
|
891
|
-
};
|
|
892
|
-
// Rules of self-closure
|
|
893
|
-
// 1. No elements in HTML documents use the self-closing syntax.
|
|
894
|
-
// 2. Elements w/ children never self-close because they use a separate end tag.
|
|
895
|
-
// 3. HTML elements which do not listed in spec will close with a
|
|
896
|
-
// separate end tag.
|
|
897
|
-
// 4. Other elements self-close.
|
|
898
|
-
MarkupFormatter.prototype.ShouldSelfClose = function (element) {
|
|
899
|
-
if (this.SerializeAsHTML())
|
|
900
|
-
return false;
|
|
901
|
-
else if (element.hasChildNodes())
|
|
902
|
-
return false;
|
|
903
|
-
else if (false && !ElementCannotHaveEndTag(element))
|
|
904
|
-
return false;
|
|
905
|
-
else
|
|
906
|
-
return true;
|
|
907
|
-
};
|
|
908
|
-
MarkupFormatter.prototype.AppendCharactersReplacingEntities = function (result, source, offset, length, entity_mask) {
|
|
909
|
-
/*
|
|
910
|
-
DEFINE_STATIC_LOCAL(const std:: string, amp_reference, ("&"));
|
|
911
|
-
DEFINE_STATIC_LOCAL(const std:: string, lt_reference, ("<"));
|
|
912
|
-
DEFINE_STATIC_LOCAL(const std:: string, gt_reference, (">"));
|
|
913
|
-
DEFINE_STATIC_LOCAL(const std:: string, quot_reference, ("""));
|
|
914
|
-
DEFINE_STATIC_LOCAL(const std:: string, nbsp_reference, (" "));
|
|
915
|
-
DEFINE_STATIC_LOCAL(const std:: string, tab_reference, ("	"));
|
|
916
|
-
DEFINE_STATIC_LOCAL(const std:: string, line_feed_reference, (" "));
|
|
917
|
-
DEFINE_STATIC_LOCAL(const std:: string, carriage_return_reference, (" "));
|
|
918
|
-
|
|
919
|
-
static const EntityDescription kEntityMaps[] = {
|
|
920
|
-
{ '&', amp_reference, kEntityAmp },
|
|
921
|
-
{ '<', lt_reference, kEntityLt },
|
|
922
|
-
{ '>', gt_reference, kEntityGt },
|
|
923
|
-
{ '"', quot_reference, kEntityQuot },
|
|
924
|
-
{ kNoBreakSpaceCharacter, nbsp_reference, kEntityNbsp },
|
|
925
|
-
{ '\t', tab_reference, kEntityTab },
|
|
926
|
-
{ '\n', line_feed_reference, kEntityLineFeed },
|
|
927
|
-
{ '\r', carriage_return_reference, kEntityCarriageReturn },
|
|
928
|
-
};
|
|
929
|
-
*/
|
|
930
|
-
if (!(offset + length))
|
|
931
|
-
return;
|
|
932
|
-
console.assert(offset + length <= source.length);
|
|
933
|
-
/*
|
|
934
|
-
StringBuilder& result,
|
|
935
|
-
CharType* text,
|
|
936
|
-
unsigned length,
|
|
937
|
-
const EntityDescription entity_maps[],
|
|
938
|
-
unsigned entity_maps_count,
|
|
939
|
-
EntityMask entity_mask) {
|
|
940
|
-
unsigned position_after_last_entity = 0;
|
|
941
|
-
for (unsigned i = 0; i < length; ++i) {
|
|
942
|
-
for (unsigned entity_index = 0; entity_index < entity_maps_count;
|
|
943
|
-
++entity_index) {
|
|
944
|
-
if (text[i] == entity_maps[entity_index].entity &&
|
|
945
|
-
entity_maps[entity_index].mask & entity_mask) {
|
|
946
|
-
result.Append(text + position_after_last_entity,
|
|
947
|
-
i - position_after_last_entity);
|
|
948
|
-
const std::string& replacement = entity_maps[entity_index].reference;
|
|
949
|
-
result.Append(replacement.c_str(), replacement.length());
|
|
950
|
-
position_after_last_entity = i + 1;
|
|
951
|
-
break;
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
result.Append(text + position_after_last_entity,
|
|
956
|
-
length - position_after_last_entity);
|
|
957
|
-
*/
|
|
958
|
-
result.str += source;
|
|
959
|
-
};
|
|
960
|
-
return MarkupFormatter;
|
|
961
|
-
}());
|
|
962
|
-
//# sourceMappingURL=XMLSerializerImpl2.js.map
|