├── .editorconfig ├── .eslintignore ├── .eslintignore-sync ├── .eslintrc.json ├── .gitattributes ├── .github ├── CODEOWNERS ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ ├── bug.md │ ├── feature.md │ └── maintenance.md ├── PULL_REQUEST_TEMPLATE.md ├── stale.yml └── workflows │ ├── changelog.yml │ └── tests.yml ├── .gitignore ├── .prettierignore ├── .prettierignore-sync ├── .prettierrc.json ├── LICENSE ├── README.md ├── SECURITY.md ├── lerna.json ├── package-lock.json ├── package.json ├── packages ├── custom-elements │ ├── CHANGELOG.md │ ├── DEVELOPING.md │ ├── LICENSE.md │ ├── README.md │ ├── externs │ │ ├── custom-elements.d.ts │ │ └── custom-elements.js │ ├── gulpfile.js │ ├── package-lock.json │ ├── package.json │ ├── rollup.config.js │ ├── ts_src │ │ ├── AlreadyConstructedMarker.ts │ │ ├── CustomElementInternals.ts │ │ ├── CustomElementRegistry.ts │ │ ├── CustomElementState.ts │ │ ├── Deferred.ts │ │ ├── DocumentConstructionObserver.ts │ │ ├── Patch │ │ │ ├── Document.ts │ │ │ ├── DocumentFragment.ts │ │ │ ├── Element.ts │ │ │ ├── HTMLElement.ts │ │ │ ├── Interface │ │ │ │ ├── ChildNode.ts │ │ │ │ └── ParentNode.ts │ │ │ ├── Native.ts │ │ │ └── Node.ts │ │ ├── Utilities.ts │ │ ├── custom-elements.ts │ │ ├── env.d.ts │ │ └── native-shim.ts │ └── tsconfig.json ├── formdata-event │ ├── CHANGELOG.md │ ├── DESIGN.md │ ├── gulpfile.js │ ├── package-lock.json │ ├── package.json │ ├── ts_src │ │ ├── dispatch_formdata_for_submission.ts │ │ ├── environment │ │ │ ├── document.ts │ │ │ ├── element.ts │ │ │ ├── event.ts │ │ │ ├── event_target.ts │ │ │ ├── form_data.ts │ │ │ ├── globals.ts │ │ │ ├── html_collection.ts │ │ │ ├── html_form_element.ts │ │ │ ├── html_input_element.ts │ │ │ ├── node.ts │ │ │ └── window.ts │ │ ├── environment_api │ │ │ ├── document.ts │ │ │ ├── element.ts │ │ │ ├── event.ts │ │ │ ├── event_target.ts │ │ │ ├── html_collection.ts │ │ │ ├── html_form_element.ts │ │ │ ├── html_input_element.ts │ │ │ └── node.ts │ │ ├── event_listener_array.ts │ │ ├── form_data_event.ts │ │ ├── formdata_listener_added.ts │ │ ├── index.ts │ │ ├── submit_listener_added.ts │ │ └── wrappers │ │ │ ├── event.ts │ │ │ ├── event_target.ts │ │ │ ├── form_data.ts │ │ │ ├── html_form_element.ts │ │ │ └── wrap_constructor.ts │ └── tsconfig.json ├── html-imports │ ├── CHANGELOG.md │ ├── LICENSE.md │ ├── README.md │ ├── externs │ │ ├── html-imports.d.ts │ │ └── html-imports.js │ ├── gulpfile.js │ ├── package-lock.json │ ├── package.json │ └── src │ │ └── html-imports.js ├── scoped-custom-element-registry │ ├── .gitignore │ ├── CHANGELOG.md │ ├── README.md │ ├── closure-flags.txt │ ├── demo │ │ └── index.html │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── scoped-custom-element-registry.ts │ │ └── types.d.ts │ ├── test │ │ ├── Element.test.html │ │ ├── Element.test.html.js │ │ ├── ShadowRoot.test.html │ │ ├── ShadowRoot.test.html.js │ │ ├── common-registry-tests.js │ │ ├── form-associated.test.js │ │ ├── global-registry.test.html │ │ ├── global-registry.test.html.js │ │ ├── native-htmlelement.test.js │ │ ├── scoped-registry.test.html │ │ ├── scoped-registry.test.html.js │ │ └── utils.js │ ├── tsconfig.json │ └── web-test-runner.config.js ├── shady-css-scoped-element │ ├── LICENSE.md │ ├── README.md │ ├── externs │ │ └── shadycss-externs.js │ ├── gulpfile.js │ ├── package-lock.json │ ├── package.json │ └── src │ │ └── shady-css-scoped-element.js ├── shadycss │ ├── CHANGELOG.md │ ├── LICENSE.md │ ├── README.md │ ├── apply-shim.html │ ├── custom-style-interface.html │ ├── entrypoints │ │ ├── apply-shim.js │ │ ├── custom-style-interface.js │ │ └── scoping-shim.js │ ├── examples │ │ ├── custom-style-element.js │ │ └── document-style-lib.js │ ├── externs │ │ ├── shadycss-externs.js │ │ └── shadycss.d.ts │ ├── gulpfile.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── apply-shim-utils.js │ │ ├── apply-shim.js │ │ ├── common-regex.js │ │ ├── common-utils.js │ │ ├── css-parse.js │ │ ├── custom-style-interface.js │ │ ├── document-wait.js │ │ ├── document-watcher.js │ │ ├── env.d.ts │ │ ├── scoping-shim.js │ │ ├── style-cache.js │ │ ├── style-info.js │ │ ├── style-placeholder.js │ │ ├── style-properties.js │ │ ├── style-settings.js │ │ ├── style-transformer.js │ │ ├── style-util.js │ │ ├── template-map.js │ │ └── unscoped-style-handler.js │ ├── ts_src │ │ └── interface.ts │ └── tsconfig.json ├── shadydom │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── LICENSE.md │ ├── README.md │ ├── externs │ │ ├── shadydom.d.ts │ │ └── shadydom.js │ ├── gulpfile.js │ ├── package-lock.json │ ├── package.json │ ├── rollup.config.js │ └── src │ │ ├── array-splice.js │ │ ├── attach-shadow.js │ │ ├── env.d.ts │ │ ├── flush.js │ │ ├── innerHTML.js │ │ ├── link-nodes.js │ │ ├── observe-changes.js │ │ ├── patch-events.js │ │ ├── patch-instances.js │ │ ├── patch-native.js │ │ ├── patch-prototypes.js │ │ ├── patch-shadyRoot.js │ │ ├── patches │ │ ├── ChildNode.js │ │ ├── Document.js │ │ ├── DocumentOrFragment.js │ │ ├── DocumentOrShadowRoot.js │ │ ├── Element.js │ │ ├── ElementOrShadowRoot.js │ │ ├── EventTarget.js │ │ ├── HTMLElement.js │ │ ├── Node.js │ │ ├── ParentNode.js │ │ ├── ShadowRoot.js │ │ ├── Slot.js │ │ ├── Slotable.js │ │ ├── Window.js │ │ └── logicalQuerySelectorAll.md │ │ ├── selector-parser.js │ │ ├── shady-data.js │ │ ├── shadydom.js │ │ ├── style-scoping.js │ │ ├── utils.js │ │ └── wrapper.js ├── template │ ├── CHANGELOG.md │ ├── LICENSE.md │ ├── README.md │ ├── externs │ │ └── template.d.ts │ ├── gulpfile.js │ ├── package-lock.json │ ├── package.json │ └── template.js ├── tests │ ├── .eslintrc.json │ ├── README.md │ ├── chai.js │ ├── compile-js-plugin.js │ ├── core-js_url.js │ ├── custom-elements │ │ ├── catchReportedErrors.js │ │ ├── html │ │ │ ├── Document │ │ │ │ ├── createElement.test.html │ │ │ │ ├── createElementNS.test.html │ │ │ │ └── importNode.test.html │ │ │ ├── DocumentConstructionObserver.test.html │ │ │ ├── Element │ │ │ │ ├── attachShadow.test.html │ │ │ │ ├── innerHTML.test.html │ │ │ │ ├── insertAdjacentElement.test.html │ │ │ │ ├── insertAdjacentHTML.test.html │ │ │ │ ├── outerHTML.test.html │ │ │ │ ├── removeAttribute.test.html │ │ │ │ ├── removeAttributeNS.test.html │ │ │ │ ├── setAttribute.test.html │ │ │ │ ├── setAttributeNS.test.html │ │ │ │ └── toggleAttribute.test.html │ │ │ ├── HTMLElement │ │ │ │ └── constructor.test.html │ │ │ ├── Interface │ │ │ │ ├── ChildNode │ │ │ │ │ └── index.test.html │ │ │ │ └── ParentNode │ │ │ │ │ └── index.test.html │ │ │ ├── Node │ │ │ │ ├── appendChild.test.html │ │ │ │ ├── cloneNode.test.html │ │ │ │ ├── insertBefore.test.html │ │ │ │ ├── removeChild.test.html │ │ │ │ ├── replaceChild.test.html │ │ │ │ └── textContent.test.html │ │ │ ├── async-import.html │ │ │ ├── babel.test.html │ │ │ ├── closure.test.html │ │ │ ├── imported-doc.html │ │ │ ├── imports.test.html │ │ │ ├── incorrectly-imported-doc.html │ │ │ ├── instanceof.test.html │ │ │ ├── polyfill-define-lazy.test.html │ │ │ ├── polyfillWrapFlushCallback │ │ │ │ ├── defaultSyncFlush.test.html │ │ │ │ ├── defineDoesNotWalk.test.html │ │ │ │ ├── flushCallbackIsCalled.test.html │ │ │ │ ├── imperativelyCreatedBeforeFlush.test.html │ │ │ │ ├── multipleDefineCalls.test.html │ │ │ │ ├── multipleFlushCallbacks_blocking.test.html │ │ │ │ ├── multipleFlushCallbacks_ordering.test.html │ │ │ │ ├── upgradeInDefineCallOrder.test.html │ │ │ │ ├── whenDefined_after.test.html │ │ │ │ └── whenDefined_before.test.html │ │ │ ├── reactions.test.html │ │ │ ├── registry-upgrade.test.html │ │ │ ├── registry.test.html │ │ │ ├── shadow-dom.test.html │ │ │ ├── shim.test.html │ │ │ ├── sub-import.html │ │ │ ├── template-polyfill.test.html │ │ │ ├── typescript.test.html │ │ │ └── upgrade.test.html │ │ └── safari-gc-bug-workaround.js │ ├── environment.js │ ├── formdata-event │ │ ├── blank.html │ │ ├── dispatch_formdata_for_submission.html │ │ ├── form_data_event.html │ │ ├── formdata_listener_added.html │ │ ├── index.html │ │ ├── submit_listener_added.html │ │ ├── test_environment.html │ │ └── wrappers │ │ │ ├── event.html │ │ │ ├── form_data.html │ │ │ ├── html_form_element.html │ │ │ └── index.html │ ├── html-imports │ │ ├── html │ │ │ ├── HTMLImports-lazy.html │ │ │ ├── HTMLImportsLoaded-native.html │ │ │ ├── base │ │ │ │ └── imports-with-base.html │ │ │ ├── cloned-template-script.html │ │ │ ├── csp.html │ │ │ ├── csp.js │ │ │ ├── currentScript.html │ │ │ ├── dedupe.html │ │ │ ├── dynamic-all-imports-detail.html │ │ │ ├── dynamic-elements.html │ │ │ ├── dynamic-errors-detail.html │ │ │ ├── dynamic-importer.html │ │ │ ├── dynamic.html │ │ │ ├── encoding.html │ │ │ ├── es-module.html │ │ │ ├── import-for-element.html │ │ │ ├── imports │ │ │ │ ├── abs.html │ │ │ │ ├── base-1.html │ │ │ │ ├── base │ │ │ │ │ └── base-2.html │ │ │ │ ├── csp-import-1.html │ │ │ │ ├── csp-import-2.html │ │ │ │ ├── csp-script-1.js │ │ │ │ ├── csp-script-2.js │ │ │ │ ├── current-script.js │ │ │ │ ├── dedupe.html │ │ │ │ ├── dynamic-elements-import.html │ │ │ │ ├── dynamic-importer.html │ │ │ │ ├── empty-script.html │ │ │ │ ├── empty-style.html │ │ │ │ ├── encoding-import.html │ │ │ │ ├── es-module-1.js │ │ │ │ ├── es-module-2.js │ │ │ │ ├── es-module-3.js │ │ │ │ ├── es-module-import-1.html │ │ │ │ ├── es-module-import-2.html │ │ │ │ ├── es-module-inline.html │ │ │ │ ├── external-script.js │ │ │ │ ├── google.png │ │ │ │ ├── import-1-1.html │ │ │ │ ├── import-1-2.html │ │ │ │ ├── import-1-3.html │ │ │ │ ├── import-1.html │ │ │ │ ├── load-1.html │ │ │ │ ├── load-2.html │ │ │ │ ├── load-a.html │ │ │ │ ├── load-b.html │ │ │ │ ├── load-c.html │ │ │ │ ├── load-d.html │ │ │ │ ├── load-empty-async.html │ │ │ │ ├── load-empty.html │ │ │ │ ├── parsed-import-1.html │ │ │ │ ├── parsed-import-2.html │ │ │ │ ├── ready-state-check-import.html │ │ │ │ ├── resolve-import-b.html │ │ │ │ ├── resolve-import-c.html │ │ │ │ ├── script-1.html │ │ │ │ ├── script-2.html │ │ │ │ ├── sheet1.css │ │ │ │ ├── sheet2.css │ │ │ │ ├── sheet3.css │ │ │ │ ├── sheet4.css │ │ │ │ ├── style-elements-import.html │ │ │ │ ├── style-links-import.html │ │ │ │ ├── style-paths-import.html │ │ │ │ ├── styles.css │ │ │ │ ├── svg-style.html │ │ │ │ ├── template-import.html │ │ │ │ └── unclosed-import.html │ │ │ ├── lazy-import.html │ │ │ ├── link-import.html │ │ │ ├── load-404.html │ │ │ ├── load-empty.html │ │ │ ├── load-imports.html │ │ │ ├── load-loop.html │ │ │ ├── load-svg-style.html │ │ │ ├── load.html │ │ │ ├── parser.html │ │ │ ├── ready-state.html │ │ │ ├── resolve-import-a.html │ │ │ ├── resolve-import-c.html │ │ │ ├── resolve-path.html │ │ │ ├── style-links.html │ │ │ ├── style-paths.html │ │ │ └── unclosed.html │ │ └── index.html │ ├── package-lock.json │ ├── package.json │ ├── rollup.config.js │ ├── shady-css-scoped-element │ │ ├── index.html │ │ └── shady-css-scoped.html │ ├── shadycss │ │ ├── apply-shim.html │ │ ├── async-loading.html │ │ ├── chrome-devtools.html │ │ ├── complicated-mixin-ordering.html │ │ ├── css-parse.html │ │ ├── custom-style-import.html │ │ ├── custom-style-late.html │ │ ├── custom-style-only.html │ │ ├── custom-style-ordering.html │ │ ├── custom-style.html │ │ ├── deferred-apply.html │ │ ├── disable-runtime.html │ │ ├── dynamic-scoping.html │ │ ├── gulpfile.js │ │ ├── html-imports │ │ │ └── custom-style-import.html │ │ ├── interface.html │ │ ├── lazy-init.html │ │ ├── media-query.html │ │ ├── mixin-fallbacks.html │ │ ├── mixin-ordering.html │ │ ├── module │ │ │ ├── css-parse.js │ │ │ ├── custom-style-element.js │ │ │ ├── make-element.js │ │ │ ├── style-cache.js │ │ │ ├── style-info.js │ │ │ ├── style-placeholder.js │ │ │ ├── style-properties.js │ │ │ ├── style-settings.js │ │ │ ├── style-transformer.js │ │ │ ├── style-util.js │ │ │ └── svg-in-shadow.js │ │ ├── no-applyshim │ │ │ ├── custom-style-late.html │ │ │ ├── custom-style-only.html │ │ │ └── custom-style.html │ │ ├── no-scopingshim │ │ │ ├── apply-shim.html │ │ │ ├── complicated-mixin-ordering.html │ │ │ ├── custom-style-late.html │ │ │ ├── custom-style-only.html │ │ │ ├── custom-style.html │ │ │ └── mixin-ordering.html │ │ ├── ordering.html │ │ ├── placeholder-ordering.html │ │ ├── runner.html │ │ ├── scoping-api.html │ │ ├── scoping.html │ │ ├── settings.html │ │ ├── style-transformer.html │ │ ├── svg.html │ │ ├── test-flags.js │ │ ├── wc-1.html │ │ └── workarounds.html │ ├── shadydom │ │ ├── active-element.html │ │ ├── attach-while-loading.html │ │ ├── connect-disconnect.html │ │ ├── event-path.html │ │ ├── filter-mutations.html │ │ ├── live-childNodes.html │ │ ├── loader.js │ │ ├── native-access.html │ │ ├── observeChildren.html │ │ ├── perf │ │ │ └── composed-children-perf.html │ │ ├── prefer-performance.html │ │ ├── runner.html │ │ ├── shady-content.html │ │ ├── shady-dynamic.html │ │ ├── shady.html │ │ ├── slot-scenarios.html │ │ ├── slotchange.html │ │ ├── smoke │ │ │ ├── click.html │ │ │ ├── data-table.html │ │ │ ├── focus-api.html │ │ │ ├── focus.html │ │ │ ├── property-info.html │ │ │ ├── rel.html │ │ │ ├── smoke-nopatch.html │ │ │ └── smoke.html │ │ ├── sync-style-scoping.html │ │ └── wct-browser-config.js │ ├── template │ │ ├── basic.html │ │ ├── document-fragment.html │ │ └── runner.html │ ├── web-test-runner.config.js │ └── webcomponentsjs_ │ │ ├── async-loader-no-polyfills.html │ │ ├── async-loader-with-modules.html │ │ ├── baseuri.html │ │ ├── bundle-after-load.html │ │ ├── bundle-with-modules.html │ │ ├── child-node │ │ ├── after.html │ │ ├── before.html │ │ ├── index.html │ │ ├── remove.html │ │ └── replace-with.html │ │ ├── dev-loader-swizzled.html │ │ ├── dev-loader.html │ │ ├── event-listener-options.html │ │ ├── force-polyfills.html │ │ ├── get-attribute-names.html │ │ ├── imports │ │ ├── a1-define.html │ │ ├── a1-import.html │ │ ├── a1-instance.html │ │ ├── a1-reference.html │ │ ├── csp-import-1.html │ │ ├── csp-import-2.html │ │ ├── csp-script-1.js │ │ ├── csp-script-2.js │ │ ├── current-script.js │ │ ├── element-import-a.html │ │ ├── element-import-b.html │ │ ├── element-import.html │ │ ├── import-file.html │ │ ├── import-upgrade-order.html │ │ ├── script-1.html │ │ ├── script-2.html │ │ ├── simple-element-2.js │ │ ├── simple-element-es5.html │ │ ├── simple-element-es5.js │ │ ├── simple-element.html │ │ └── simple-element.js │ │ ├── integration-es5.html │ │ ├── integration.html │ │ ├── load.html │ │ ├── loader-after-load.html │ │ ├── loader-with-modules.html │ │ ├── loader-with-root-defined.html │ │ ├── matches.html │ │ ├── modules │ │ ├── common-subclass.js │ │ ├── module-a-sub.js │ │ ├── module-a.js │ │ └── module-b.js │ │ ├── object-assign.html │ │ ├── parent-node │ │ ├── append.html │ │ ├── index.html │ │ ├── prepend.html │ │ └── replace-children.html │ │ ├── promise.html │ │ ├── runner.html │ │ ├── svg-element-class-list.html │ │ ├── symbol.html │ │ ├── template-and-CE.html │ │ ├── toggle-attribute.html │ │ ├── trusted-types │ │ ├── enforcement.html │ │ ├── index.html │ │ ├── loader-only-test-page_src-replace_loader-allowed.html │ │ ├── loader-only-test-page_src-replace_none-allowed.html │ │ └── loader-only-test-page_wc-root_trusted-script-url.html │ │ ├── url.html │ │ └── wct-config.js ├── url │ ├── CHANGELOG.md │ ├── README.md │ ├── bower.json │ ├── gulpfile.js │ ├── package-lock.json │ ├── package.json │ ├── playground.html │ ├── testharness.css │ ├── testharness.js │ ├── testharnessreport.js │ ├── url.js │ ├── urltestgenerator.html │ ├── urltestharness.html │ ├── urltestparser.js │ ├── urltestrunner.html │ └── urltests.txt └── webcomponentsjs │ ├── .gitattributes │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── LICENSE.md │ ├── README.md │ ├── closure-output.txt │ ├── externs │ ├── webcomponents.d.ts │ └── webcomponents.js │ ├── gulpfile.js │ ├── license-header.txt │ ├── package-lock.json │ ├── package.json │ ├── src │ └── entrypoints │ │ ├── custom-elements-es5-adapter-index.js │ │ ├── webcomponents-bundle-index.js │ │ ├── webcomponents-ce-index.js │ │ ├── webcomponents-pf_dom-index.js │ │ ├── webcomponents-pf_js-index.js │ │ ├── webcomponents-sd-ce-index.js │ │ ├── webcomponents-sd-ce-pf-index.js │ │ └── webcomponents-sd-index.js │ ├── ts_src │ ├── flag-parser.ts │ ├── platform │ │ ├── baseuri.ts │ │ ├── child-node │ │ │ ├── after.ts │ │ │ ├── before.ts │ │ │ ├── index.ts │ │ │ ├── remove.ts │ │ │ └── replace-with.ts │ │ ├── custom-event.ts │ │ ├── custom_typings.d.ts │ │ ├── es6-misc.ts │ │ ├── event-listener-options.ts │ │ ├── get-attribute-names.ts │ │ ├── matches.ts │ │ ├── parent-node │ │ │ ├── append.ts │ │ │ ├── index.ts │ │ │ ├── prepend.ts │ │ │ └── replace-children.ts │ │ ├── promise.ts │ │ ├── svg-element-class-list.ts │ │ ├── symbol.ts │ │ └── toggle-attribute.ts │ └── unresolved.ts │ ├── tsconfig.json │ └── webcomponents-loader.js └── wct.conf.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | trim_trailing_whitespace = true 7 | indent_style = space 8 | indent_size = 2 -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | ############################################ 2 | # GENERATED BY IGNORE-SYNC, DO NOT EDIT!!! # 3 | # https://github.com/foray1010/ignore-sync # 4 | ############################################ 5 | 6 | # global 7 | node_modules/ 8 | coverage/ 9 | lerna-debug.log 10 | 11 | # shared in packages 12 | packages/*/node_modules/ 13 | packages/*/buildcache 14 | packages/*/*.tgz 15 | packages/*/*.min.js* 16 | 17 | # custom-elements package 18 | packages/custom-elements/src/ 19 | 20 | # formdata-event package 21 | packages/formdata-event/src/ 22 | 23 | # html-imports package 24 | packages/html-imports/html-imports.min.js* 25 | 26 | # shadycss package 27 | packages/shadycss/src/interface.* 28 | packages/shadycss/.tsbuildinfo 29 | 30 | # tests package 31 | packages/tests/chai-bundle.js 32 | packages/tests/core-js_url-bundle.js 33 | packages/tests/shadycss/module/generated/ 34 | 35 | # webcomponentsjs package 36 | packages/webcomponentsjs/bundles/ 37 | packages/webcomponentsjs/src/platform/ 38 | packages/webcomponentsjs/src/flag-parser.* 39 | packages/webcomponentsjs/src/unresolved.* 40 | packages/webcomponentsjs/custom-elements-es5-adapter.js 41 | packages/webcomponentsjs/webcomponents-bundle.d.ts 42 | packages/webcomponentsjs/webcomponents-bundle.js* 43 | 44 | packages/scoped-custom-element-registry/**/.wireit/ 45 | packages/scoped-custom-element-registry/**/.tsbuildinfo 46 | packages/scoped-custom-element-registry/**/build/ 47 | -------------------------------------------------------------------------------- /.eslintignore-sync: -------------------------------------------------------------------------------- 1 | [local] 2 | .gitignore 3 | 4 | [relative] 5 | packages/*/{.gitignore,.eslintignore} 6 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "eslint:recommended", 4 | "plugin:@typescript-eslint/eslint-recommended", 5 | "plugin:@typescript-eslint/recommended" 6 | ], 7 | "parser": "@typescript-eslint/parser", 8 | "parserOptions": { 9 | "ecmaVersion": 2020, 10 | "sourceType": "module" 11 | }, 12 | "plugins": ["@typescript-eslint", "html"], 13 | "env": { 14 | "browser": true, 15 | "es6": true, 16 | "mocha": true, 17 | "node": true 18 | }, 19 | "rules": { 20 | "no-prototype-builtins": "off", 21 | "@typescript-eslint/no-var-requires": "off", 22 | "@typescript-eslint/ban-types": "off", 23 | "@typescript-eslint/explicit-module-boundary-types": "off", 24 | "@typescript-eslint/no-empty-function": "off", 25 | "@typescript-eslint/no-explicit-any": "error", 26 | "@typescript-eslint/no-non-null-assertion": "off", 27 | "@typescript-eslint/no-this-alias": "off", 28 | "@typescript-eslint/no-unused-vars": [ 29 | "warn", 30 | { 31 | "argsIgnorePattern": "^_" 32 | } 33 | ] 34 | }, 35 | "overrides": [ 36 | { 37 | "files": ["gulpfile.js", "rollup.config.js"], 38 | "env": { 39 | "node": true 40 | }, 41 | "rules": { 42 | "@typescript-eslint/no-var-requires": "off" 43 | } 44 | }, 45 | { 46 | "files": ["packages/*/externs/**/*"], 47 | "rules": { 48 | "@typescript-eslint/no-unused-vars": "off" 49 | } 50 | } 51 | ] 52 | } 53 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.min.* binary 2 | package-lock.json binary -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @aomarks @bicknellr 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug 3 | about: Report an error or other polyfill problem 4 | labels: 'Type: Bug, Focus Area: Standards & Polyfills' 5 | --- 6 | 7 | ### Description 8 | 9 | 14 | 15 | ### Example 16 | 17 | 21 | 22 | ### Steps to reproduce 23 | 24 | 32 | 33 | #### Expected behavior 34 | 35 | 36 | 37 | #### Actual behavior 38 | 39 | 40 | 41 | ### Version 42 | 43 | 49 | 50 | ### Browsers affected 51 | 52 | 53 | 54 | - [ ] Chrome 55 | - [ ] Firefox 56 | - [ ] Edge 57 | - [ ] Safari 58 | - [ ] IE 11 59 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature 3 | about: Request a new polyfill feature 4 | labels: 'Type: Feature, Focus Area: Standards & Polyfills' 5 | --- 6 | 7 | ## Description 8 | 9 | 15 | 16 | ## Motivation 17 | 18 | 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/maintenance.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Maintenance 3 | about: Cleanup and other maintenance work 4 | labels: 'Type: Maintenance, Focus Area: Standards & Polyfills' 5 | --- 6 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Mark issues stale after 1 year 2 | daysUntilStale: 365 3 | # Delete stale issues after 2 years 4 | daysUntilClose: 730 5 | markComment: > 6 | This issue has been automatically marked as stale because it has not had 7 | recent activity. It will be closed if no further activity occurs. Thank you 8 | for your contributions. 9 | closeComment: > 10 | This issue has been automatically closed after being marked stale. If you're 11 | still facing this problem with the above solution, please comment and we'll 12 | reopen! 13 | -------------------------------------------------------------------------------- /.github/workflows/changelog.yml: -------------------------------------------------------------------------------- 1 | # This action requires that any PR targeting the master branch should touch at 2 | # least one CHANGELOG file. If a CHANGELOG entry is not required, add the "Skip 3 | # Changelog" label to disable this action. 4 | 5 | name: changelog 6 | 7 | on: 8 | pull_request: 9 | types: [opened, synchronize, reopened, labeled, unlabeled] 10 | branches: 11 | - master 12 | 13 | jobs: 14 | changelog: 15 | runs-on: ubuntu-latest 16 | if: "!contains(github.event.pull_request.labels.*.name, 'Skip Changelog')" 17 | 18 | steps: 19 | - uses: actions/checkout@v2 20 | 21 | - name: Check for CHANGELOG changes 22 | run: | 23 | # Only the latest commit of the feature branch is available 24 | # automatically (see https://github.com/webcomponents/polyfills). To 25 | # diff with the base branch, we need to fetch that too (and we only 26 | # need its latest commit). 27 | git fetch origin ${{ github.base_ref }} --depth=1 28 | if [[ $(git diff --name-only FETCH_HEAD | grep CHANGELOG) ]] 29 | then 30 | echo "A CHANGELOG was modified. Looks good!" 31 | else 32 | echo "No CHANGELOG was modified." 33 | echo "Please add a CHANGELOG entry, or add the \"Skip Changelog\" label if not required." 34 | false 35 | fi 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # global 2 | node_modules/ 3 | coverage/ 4 | lerna-debug.log 5 | 6 | # shared in packages 7 | packages/*/node_modules/ 8 | packages/*/buildcache 9 | packages/*/*.tgz 10 | packages/*/*.min.js* 11 | 12 | # custom-elements package 13 | packages/custom-elements/src/ 14 | 15 | # formdata-event package 16 | packages/formdata-event/src/ 17 | 18 | # html-imports package 19 | packages/html-imports/html-imports.min.js* 20 | 21 | # shadycss package 22 | packages/shadycss/src/interface.* 23 | packages/shadycss/.tsbuildinfo 24 | 25 | # tests package 26 | packages/tests/chai-bundle.js 27 | packages/tests/core-js_url-bundle.js 28 | packages/tests/shadycss/module/generated/ 29 | 30 | # webcomponentsjs package 31 | packages/webcomponentsjs/bundles/ 32 | packages/webcomponentsjs/src/platform/ 33 | packages/webcomponentsjs/src/flag-parser.* 34 | packages/webcomponentsjs/src/unresolved.* 35 | packages/webcomponentsjs/custom-elements-es5-adapter.js 36 | packages/webcomponentsjs/webcomponents-bundle.d.ts 37 | packages/webcomponentsjs/webcomponents-bundle.js* 38 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | ############################################ 2 | # GENERATED BY IGNORE-SYNC, DO NOT EDIT!!! # 3 | # https://github.com/foray1010/ignore-sync # 4 | ############################################ 5 | 6 | # global 7 | node_modules/ 8 | coverage/ 9 | lerna-debug.log 10 | 11 | # shared in packages 12 | packages/*/node_modules/ 13 | packages/*/buildcache 14 | packages/*/*.tgz 15 | packages/*/*.min.js* 16 | 17 | # custom-elements package 18 | packages/custom-elements/src/ 19 | 20 | # formdata-event package 21 | packages/formdata-event/src/ 22 | 23 | # html-imports package 24 | packages/html-imports/html-imports.min.js* 25 | 26 | # shadycss package 27 | packages/shadycss/src/interface.* 28 | packages/shadycss/.tsbuildinfo 29 | 30 | # tests package 31 | packages/tests/chai-bundle.js 32 | packages/tests/core-js_url-bundle.js 33 | packages/tests/shadycss/module/generated/ 34 | 35 | # webcomponentsjs package 36 | packages/webcomponentsjs/bundles/ 37 | packages/webcomponentsjs/src/platform/ 38 | packages/webcomponentsjs/src/flag-parser.* 39 | packages/webcomponentsjs/src/unresolved.* 40 | packages/webcomponentsjs/custom-elements-es5-adapter.js 41 | packages/webcomponentsjs/webcomponents-bundle.d.ts 42 | packages/webcomponentsjs/webcomponents-bundle.js* 43 | 44 | packages/scoped-custom-element-registry/**/.wireit/ 45 | packages/scoped-custom-element-registry/**/.tsbuildinfo 46 | packages/scoped-custom-element-registry/**/build/ 47 | 48 | LICENSE 49 | packages/*/LICENSE.md 50 | packages/tests/html-imports/html/imports/unclosed-import.html 51 | -------------------------------------------------------------------------------- /.prettierignore-sync: -------------------------------------------------------------------------------- 1 | [local] 2 | .gitignore 3 | 4 | [relative] 5 | packages/*/{.gitignore,.prettierignore} 6 | 7 | [inline] 8 | LICENSE 9 | packages/*/LICENSE.md 10 | packages/tests/html-imports/html/imports/unclosed-import.html 11 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "bracketSpacing": false, 3 | "quoteProps": "preserve", 4 | "singleQuote": true 5 | } 6 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | To report a suspected vulnerability please report it through GitHub at https://github.com/webcomponents/polyfills/security/advisories/new 6 | 7 | Please do not report any suspected vulnerabilities through public issues. 8 | 9 | ## Supported versions 10 | 11 | Only the latest major version of each polyfill is supported with security updates. 12 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "lerna": "3.13.3", 3 | "packages": ["packages/*"], 4 | "version": "independent", 5 | "command": { 6 | "publish": { 7 | "allowBranch": ["master"], 8 | "ignoreChanges": [ 9 | ".gitignore", 10 | ".travis.yml", 11 | "README.md", 12 | "appveyor.yml" 13 | ] 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/custom-elements/externs/custom-elements.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2021 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be found 6 | * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may 7 | * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by 8 | * Google as part of the polymer project is also subject to an additional IP 9 | * rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | // When building externally, this file is always assumed to be a module, but by 13 | // default it isn't when building internally, so we need this export statement. 14 | export {}; 15 | 16 | declare global { 17 | interface CustomElementRegistry { 18 | forcePolyfill?: boolean; 19 | polyfillWrapFlushCallback?(outer: (fn: () => void) => void): void; 20 | noDocumentConstructionObserver?: boolean; 21 | shadyDomFastWalk?: boolean; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/custom-elements/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@webcomponents/custom-elements", 3 | "version": "1.6.0", 4 | "publishConfig": { 5 | "access": "public" 6 | }, 7 | "description": "HTML Custom Elements Polyfill", 8 | "license": "BSD-3-Clause", 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/webcomponents/polyfills.git", 12 | "directory": "packages/custom-elements" 13 | }, 14 | "author": "The Polymer Project Authors (https://polymer.github.io/AUTHORS.txt)", 15 | "homepage": "https://github.com/webcomponents/polyfills/tree/master/packages/custom-elements", 16 | "bugs": "https://github.com/webcomponents/polyfills/issues?q=is%3Aissue+is%3Aopen+label%3A\"Package%3A+custom-elements\"", 17 | "main": "custom-elements.min.js", 18 | "scripts": { 19 | "build": "tsc && gulp", 20 | "build:watch": "chokidar --initial 'ts_src/**/*.ts' -c 'npm run build'", 21 | "debug": "rollup -c", 22 | "prepack": "npm run build" 23 | }, 24 | "files": [ 25 | "CHANGELOG.md", 26 | "custom-elements.min.js*", 27 | "externs/", 28 | "src/" 29 | ], 30 | "keywords": [ 31 | "custom-elements", 32 | "customelements", 33 | "web-components", 34 | "webcomponents", 35 | "polyfill", 36 | "shim" 37 | ], 38 | "devDependencies": { 39 | "@webcomponents/html-imports": "^1.3.1", 40 | "@webcomponents/shadydom": "^1.11.0" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/custom-elements/rollup.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | input: 'src/custom-elements.js', 3 | output: {file: 'custom-elements.min.js', format: 'iife', sourcemap: true}, 4 | }; 5 | -------------------------------------------------------------------------------- /packages/custom-elements/ts_src/AlreadyConstructedMarker.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2016 The Polymer Project Authors. All rights reserved. 4 | * This code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be found 6 | * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may 7 | * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by 8 | * Google as part of the polymer project is also subject to an additional IP 9 | * rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | /** 13 | * Represents the 'already constructed marker' used in custom 14 | * element construction stacks. 15 | * 16 | * https://html.spec.whatwg.org/#concept-already-constructed-marker 17 | */ 18 | const alreadyConstructedMarker = {} as {_alreadyConstructedMarker: never}; 19 | 20 | export default alreadyConstructedMarker; 21 | export type AlreadyConstructedMarkerType = typeof alreadyConstructedMarker; 22 | -------------------------------------------------------------------------------- /packages/custom-elements/ts_src/CustomElementState.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2016 The Polymer Project Authors. All rights reserved. 4 | * This code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be found 6 | * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may 7 | * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by 8 | * Google as part of the polymer project is also subject to an additional IP 9 | * rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | export const CustomElementState = { 13 | custom: 1, 14 | failed: 2, 15 | } as const; 16 | export type CustomElementState = 17 | | typeof CustomElementState.custom 18 | | typeof CustomElementState.failed; 19 | 20 | export default CustomElementState; 21 | -------------------------------------------------------------------------------- /packages/custom-elements/ts_src/Deferred.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2016 The Polymer Project Authors. All rights reserved. 4 | * This code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be found 6 | * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may 7 | * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by 8 | * Google as part of the polymer project is also subject to an additional IP 9 | * rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | export default class Deferred { 13 | private _value: T | undefined = undefined; 14 | 15 | private _resolve!: (val: T) => void; 16 | 17 | private readonly _promise: Promise; 18 | constructor() { 19 | this._promise = new Promise((resolve) => { 20 | this._resolve = resolve; 21 | }); 22 | } 23 | 24 | resolve(value: T) { 25 | if (this._value) { 26 | throw new Error('Already resolved.'); 27 | } 28 | 29 | this._value = value; 30 | this._resolve(value); 31 | } 32 | 33 | toPromise() { 34 | return this._promise; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/custom-elements/ts_src/Patch/DocumentFragment.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2016 The Polymer Project Authors. All rights reserved. 4 | * This code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be found 6 | * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may 7 | * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by 8 | * Google as part of the polymer project is also subject to an additional IP 9 | * rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | import CustomElementInternals from '../CustomElementInternals.js'; 13 | 14 | import PatchParentNode from './Interface/ParentNode.js'; 15 | import * as Native from './Native.js'; 16 | 17 | export default function (internals: CustomElementInternals) { 18 | PatchParentNode(internals, DocumentFragment.prototype, { 19 | prepend: Native.DocumentFragment_prepend, 20 | append: Native.DocumentFragment_append, 21 | }); 22 | } 23 | -------------------------------------------------------------------------------- /packages/custom-elements/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "incremental": true, 4 | "target": "es2019", 5 | "tsBuildInfoFile": "./buildcache", 6 | "module": "esnext", 7 | "declaration": true, 8 | "sourceMap": true, 9 | "outDir": "./src", 10 | "importHelpers": true, 11 | "strict": true, 12 | "noImplicitAny": true, 13 | "strictNullChecks": true, 14 | "strictFunctionTypes": true, 15 | "strictBindCallApply": true, 16 | "strictPropertyInitialization": true, 17 | "noImplicitThis": true, 18 | "alwaysStrict": true, 19 | "noUnusedLocals": true, 20 | "noUnusedParameters": true, 21 | "noImplicitReturns": true, 22 | "noFallthroughCasesInSwitch": true, 23 | "moduleResolution": "node" 24 | }, 25 | "include": [ 26 | "externs/**/*.d.ts", 27 | "node_modules/@webcomponents/html-imports/externs/html-imports.d.ts", 28 | "node_modules/@webcomponents/shadydom/externs/shadydom.d.ts", 29 | "ts_src/" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /packages/formdata-event/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [Unreleased] 9 | 10 | - Add the design doc to the repo. 11 | ([#381](https://github.com/webcomponents/polyfills/pull/381)) 12 | - Handle `stopPropagation` and `stopImmediatePropagation` calls on the 'submit' 13 | event. ([#379](https://github.com/webcomponents/polyfills/pull/379)) 14 | - Capture browser APIs used in `dispatchFormdataForSubmission`. 15 | ([#370](https://github.com/webcomponents/polyfills/pull/370)) 16 | - Modify the existing form to submit data from the FormData object. 17 | ([#361](https://github.com/webcomponents/polyfills/pull/361)) 18 | - formdata event polyfill: Add support for legacy browsers. 19 | ([#363](https://github.com/webcomponents/polyfills/pull/363)) 20 | - Initial, incomplete implementation of the 'formdata' event polyfill. 21 | ([#360](https://github.com/webcomponents/polyfills/pull/360)) 22 | -------------------------------------------------------------------------------- /packages/formdata-event/gulpfile.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | 'use strict'; 13 | 14 | const compilerPackage = require('google-closure-compiler'); 15 | const gulp = require('gulp'); 16 | const sourcemaps = require('gulp-sourcemaps'); 17 | 18 | const closureCompiler = compilerPackage.gulp(); 19 | 20 | gulp.task('default', () => { 21 | return gulp 22 | .src('./src/**/*.js', {base: './'}) 23 | .pipe(sourcemaps.init()) 24 | .pipe( 25 | closureCompiler({ 26 | compilation_level: 'ADVANCED', 27 | warning_level: 'VERBOSE', 28 | language_in: 'ECMASCRIPT_2019', 29 | language_out: 'ECMASCRIPT5_STRICT', 30 | dependency_mode: 'PRUNE', 31 | entry_point: ['/src/index'], 32 | js_output_file: 'formdata-event.min.js', 33 | output_wrapper: '(function(){\n%output%\n}).call(self);', 34 | assume_function_wrapper: true, 35 | rewrite_polyfills: false, 36 | }) 37 | ) 38 | .pipe(sourcemaps.write('/')) 39 | .pipe(gulp.dest('./')); 40 | }); 41 | -------------------------------------------------------------------------------- /packages/formdata-event/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@webcomponents/formdata-event", 3 | "version": "0.0.3", 4 | "lockfileVersion": 1 5 | } 6 | -------------------------------------------------------------------------------- /packages/formdata-event/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@webcomponents/formdata-event", 3 | "version": "0.0.3", 4 | "private": true, 5 | "publishConfig": { 6 | "access": "public" 7 | }, 8 | "description": "'formdata' event polyfill", 9 | "license": "BSD-3-Clause", 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/webcomponents/polyfills.git", 13 | "directory": "packages/formdata-event" 14 | }, 15 | "author": "The Polymer Project Authors (https://polymer.github.io/AUTHORS.txt)", 16 | "homepage": "https://github.com/webcomponents/polyfills/tree/master/packages/formdata-event", 17 | "bugs": "https://github.com/webcomponents/polyfills/issues?q=is%3Aissue+is%3Aopen+label%3A\"Package%3A+formdata-event\"", 18 | "main": "formdata-event.min.js", 19 | "scripts": { 20 | "build": "tsc && gulp", 21 | "build:watch": "chokidar --initial 'ts_src/**/*.ts' -c 'npm run build'", 22 | "prepack": "npm run build" 23 | }, 24 | "files": [ 25 | "CHANGELOG.md", 26 | "formdata-event.min.js*", 27 | "src/" 28 | ], 29 | "keywords": [ 30 | "formdata", 31 | "event", 32 | "polyfill" 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/environment/document.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | export const constructor = window.Document; 13 | 14 | export const prototype = constructor.prototype; 15 | 16 | export const methods = { 17 | createElement: prototype.createElement, 18 | createEvent: prototype.createEvent, 19 | }; 20 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/environment/element.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | export const constructor = window.Element; 13 | 14 | export const prototype = constructor.prototype; 15 | 16 | export const methods = { 17 | getAttribute: prototype.getAttribute, 18 | hasAttribute: prototype.hasAttribute, 19 | removeAttribute: prototype.removeAttribute, 20 | setAttribute: prototype.setAttribute, 21 | }; 22 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/environment/event.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | // Without this explicit type, TS seems to think that `window.Event` is the 13 | // wrapper from `wrappers/event.ts` at this point, which is typed in terms of 14 | // this binding, causing a cycle in its type. 15 | export const constructor: typeof Event = window.Event; 16 | 17 | export const prototype = constructor.prototype; 18 | 19 | export const methods = { 20 | initEvent: prototype.initEvent, 21 | stopImmediatePropagation: prototype?.stopImmediatePropagation, 22 | stopPropagation: prototype?.stopPropagation, 23 | }; 24 | 25 | export const descriptors = { 26 | defaultPrevented: Object.getOwnPropertyDescriptor( 27 | prototype, 28 | 'defaultPrevented' 29 | )!, 30 | target: Object.getOwnPropertyDescriptor(prototype, 'target')!, 31 | type: Object.getOwnPropertyDescriptor(prototype, 'type')!, 32 | }; 33 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/environment/event_target.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | export const constructor = window.EventTarget; 13 | 14 | export const prototype = constructor?.prototype; 15 | 16 | export const methods = { 17 | addEventListener: prototype?.addEventListener, 18 | removeEventListener: prototype?.removeEventListener, 19 | dispatchEvent: prototype?.dispatchEvent, 20 | }; 21 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/environment/form_data.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | export const constructor = window.FormData; 13 | 14 | export const prototype = constructor.prototype; 15 | 16 | export const methods = { 17 | append: prototype.append, 18 | delete: prototype.delete, 19 | set: prototype.set, 20 | }; 21 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/environment/globals.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | export const document = window.document; 13 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/environment/html_collection.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | export const constructor = window.HTMLCollection; 13 | 14 | export const prototype = constructor.prototype; 15 | 16 | export const descriptors = { 17 | length: Object.getOwnPropertyDescriptor(prototype, 'length'), 18 | }; 19 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/environment/html_form_element.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | export const constructor = window.HTMLFormElement; 13 | 14 | export const prototype = constructor.prototype; 15 | 16 | export const methods = { 17 | submit: prototype.submit, 18 | }; 19 | 20 | export const descriptors = { 21 | elements: Object.getOwnPropertyDescriptor(prototype, 'elements')!, 22 | }; 23 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/environment/html_input_element.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | export const constructor = window.HTMLInputElement; 13 | 14 | export const prototype = constructor.prototype; 15 | 16 | export const descriptors = { 17 | name: Object.getOwnPropertyDescriptor(prototype, 'name'), 18 | type: Object.getOwnPropertyDescriptor(prototype, 'type'), 19 | value: Object.getOwnPropertyDescriptor(prototype, 'value'), 20 | }; 21 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/environment/node.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | export const constructor = window.Node; 13 | 14 | export const prototype = constructor.prototype; 15 | 16 | export const methods = { 17 | addEventListener: prototype.addEventListener, 18 | appendChild: prototype.appendChild, 19 | dispatchEvent: prototype.dispatchEvent, 20 | getRootNode: prototype.getRootNode, 21 | insertBefore: prototype.insertBefore, 22 | removeChild: prototype.removeChild, 23 | removeEventListener: prototype.removeEventListener, 24 | }; 25 | 26 | export const descriptors = { 27 | parentNode: Object.getOwnPropertyDescriptor(prototype, 'parentNode')!, 28 | }; 29 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/environment/window.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | export const constructor = window.Window; 13 | 14 | export const prototype = constructor.prototype; 15 | 16 | export const methods = { 17 | addEventListener: prototype.addEventListener, 18 | removeEventListener: prototype.removeEventListener, 19 | dispatchEvent: prototype.dispatchEvent, 20 | }; 21 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/environment_api/document.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | import {methods as DocumentMethods} from '../environment/document.js'; 13 | 14 | export const createElement = ( 15 | doc: Document, 16 | localName: K, 17 | options?: ElementCreationOptions 18 | ): HTMLElementTagNameMap[K] => { 19 | return DocumentMethods.createElement.call( 20 | doc, 21 | localName, 22 | options 23 | ) as HTMLElementTagNameMap[K]; 24 | }; 25 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/environment_api/element.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | import {methods as ElementMethods} from '../environment/element.js'; 13 | 14 | export const hasAttribute = (element: Element, name: string): boolean => { 15 | return ElementMethods.hasAttribute.call(element, name); 16 | }; 17 | 18 | export const getAttribute = (element: Element, name: string): string | null => { 19 | return ElementMethods.getAttribute.call(element, name); 20 | }; 21 | 22 | export const removeAttribute = (element: Element, name: string): void => { 23 | ElementMethods.removeAttribute.call(element, name); 24 | }; 25 | 26 | export const setAttribute = ( 27 | element: Element, 28 | name: string, 29 | value: string 30 | ): void => { 31 | ElementMethods.setAttribute.call(element, name, value); 32 | }; 33 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/environment_api/html_collection.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | import {descriptors as HTMLCollectionDescriptors} from '../environment/html_collection.js'; 13 | 14 | const lengthDescriptor = HTMLCollectionDescriptors.length ?? {}; 15 | const lengthGetter = 16 | lengthDescriptor.get ?? 17 | function (this: HTMLCollection) { 18 | return this.length; 19 | }; 20 | export const getLength = (collection: HTMLCollection): number => 21 | lengthGetter.call(collection); 22 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/environment_api/html_form_element.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | import {descriptors as HTMLFormElementDescriptors} from '../environment/html_form_element.js'; 13 | 14 | export const getElements = (form: HTMLFormElement) => { 15 | return HTMLFormElementDescriptors.elements.get!.call(form); 16 | }; 17 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | import {install as installEvent} from './wrappers/event.js'; 13 | import {install as installEventTarget} from './wrappers/event_target.js'; 14 | import {install as installFormData} from './wrappers/form_data.js'; 15 | import {install as installFormDataEvent} from './form_data_event.js'; 16 | import {install as installHTMLFormElement} from './wrappers/html_form_element.js'; 17 | 18 | if (window['FormDataEvent'] === undefined) { 19 | installEvent(); 20 | installEventTarget(); 21 | installFormData(); 22 | installFormDataEvent(); 23 | installHTMLFormElement(); 24 | } 25 | -------------------------------------------------------------------------------- /packages/formdata-event/ts_src/wrappers/html_form_element.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be 6 | * found at http://polymer.github.io/AUTHORS.txt The complete set of 7 | * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code 8 | * distributed by Google as part of the polymer project is also subject to an 9 | * additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | // prettier-ignore 13 | import {prototype as HTMLFormElementPrototype, methods as HTMLFormElementMethods} from '../environment/html_form_element.js'; 14 | import {dispatchFormdataForSubmission} from '../dispatch_formdata_for_submission.js'; 15 | 16 | export const wrapSubmit = ( 17 | prototype: { 18 | submit: HTMLFormElement['submit']; 19 | }, 20 | original: HTMLFormElement['submit'] 21 | ) => { 22 | prototype.submit = function (this: HTMLFormElement) { 23 | dispatchFormdataForSubmission(this); 24 | return original.call(this); 25 | }; 26 | }; 27 | 28 | export const install = () => { 29 | if (HTMLFormElementPrototype) { 30 | wrapSubmit(HTMLFormElementPrototype, HTMLFormElementMethods.submit); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /packages/formdata-event/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "incremental": true, 4 | "target": "es2019", 5 | "tsBuildInfoFile": "./buildcache", 6 | "module": "esnext", 7 | "declaration": true, 8 | "sourceMap": true, 9 | "outDir": "./src", 10 | "importHelpers": true, 11 | "strict": true, 12 | "noImplicitAny": true, 13 | "strictNullChecks": true, 14 | "strictFunctionTypes": true, 15 | "strictBindCallApply": true, 16 | "strictPropertyInitialization": true, 17 | "noImplicitThis": true, 18 | "alwaysStrict": true, 19 | "noUnusedLocals": true, 20 | "noUnusedParameters": true, 21 | "noImplicitReturns": true, 22 | "noFallthroughCasesInSwitch": true, 23 | "moduleResolution": "node" 24 | }, 25 | "include": ["ts_src/"] 26 | } 27 | -------------------------------------------------------------------------------- /packages/html-imports/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | 9 | 10 | ## [1.3.1] - 2023-03-20 11 | 12 | - Update dependencies ([#542](https://github.com/webcomponents/polyfills/pull/542)) 13 | 14 | ## [1.3.0] - 2021-08-02 15 | 16 | - Add TS externs. ([#457](https://github.com/webcomponents/polyfills/pull/457)) 17 | - Upstream cl/345169174: Fix calls to XMLHttpRequest#getResponseHeader to accept 18 | null as a return value. 19 | ([#433](https://github.com/webcomponents/polyfills/pull/433)) 20 | 21 | ## [1.2.6] - 2020-10-21 22 | 23 | - Maintenance release (no user-facing changes) 24 | 25 | ## [1.2.5] - 2020-07-20 26 | 27 | - Maintenance release (no user-facing changes) 28 | 29 | ## [1.2.4] - 2020-03-16 30 | 31 | - Maintenance release (no user-facing changes) 32 | 33 | ## [1.2.3] - 2020-02-26 34 | 35 | - Maintenance release (no user-facing changes) 36 | 37 | ## [1.2.2] - 2019-09-19 38 | 39 | - Fix bug where ` 21 | 22 | 23 | ``` 24 | -------------------------------------------------------------------------------- /packages/shady-css-scoped-element/gulpfile.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2019 The Polymer Project Authors. All rights reserved. 4 | * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | * Code distributed by Google as part of the polymer project is also 8 | * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | 'use strict'; 12 | const gulp = require('gulp'); 13 | const sourcemaps = require('gulp-sourcemaps'); 14 | const closure = require('google-closure-compiler').gulp(); 15 | const closureOptions = { 16 | compilation_level: 'ADVANCED', 17 | warning_level: 'VERBOSE', 18 | language_in: 'ES6_STRICT', 19 | language_out: 'ES5_STRICT', 20 | js_output_file: 'shady-css-scoped-element.min.js', 21 | assume_function_wrapper: true, 22 | isolation_mode: 'IIFE', 23 | rewrite_polyfills: false, 24 | dependency_mode: 'PRUNE', 25 | entry_point: 'src/shady-css-scoped-element.js', 26 | externs: 'externs/shadycss-externs.js', 27 | }; 28 | 29 | gulp.task('default', () => { 30 | return gulp 31 | .src(['./src/shady-css-scoped-element.js'], {base: './', follow: true}) 32 | .pipe(sourcemaps.init()) 33 | .pipe(closure(closureOptions)) 34 | .pipe(sourcemaps.write('.')) 35 | .pipe(gulp.dest('.')); 36 | }); 37 | -------------------------------------------------------------------------------- /packages/shady-css-scoped-element/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@webcomponents/shady-css-scoped-element", 3 | "version": "0.0.8", 4 | "lockfileVersion": 1 5 | } 6 | -------------------------------------------------------------------------------- /packages/shady-css-scoped-element/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@webcomponents/shady-css-scoped-element", 3 | "version": "0.0.8", 4 | "private": true, 5 | "publishConfig": { 6 | "access": "public" 7 | }, 8 | "description": "ShadyCSS scoped element", 9 | "license": "BSD-3-Clause", 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/webcomponents/polyfills.git", 13 | "directory": "packages/shady-css-scoped-element" 14 | }, 15 | "author": "The Polymer Project Authors (https://polymer.github.io/AUTHORS.txt)", 16 | "homepage": "https://github.com/webcomponents/polyfills/tree/master/packages/shady-css-scoped-element", 17 | "bugs": "https://github.com/webcomponents/polyfills/issues?q=is%3Aissue+is%3Aopen+label%3A\"Package%3A+shady-css-scoped-element\"", 18 | "main": "shady-css-scoped.min.js", 19 | "scripts": { 20 | "build": "gulp", 21 | "build:watch": "chokidar --initial 'src/**/*.js' -c 'npm run build'", 22 | "debug": "cp src/shady-css-scoped-element.js shady-css-scoped-element.min.js", 23 | "prepack": "npm run build" 24 | }, 25 | "files": [ 26 | "shady-css-scoped-element.min.js*", 27 | "src/" 28 | ], 29 | "keywords": [ 30 | "custom-elements", 31 | "customelements", 32 | "web-components", 33 | "webcomponents", 34 | "polyfill", 35 | "shim" 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /packages/shadycss/apply-shim.html: -------------------------------------------------------------------------------- 1 | 10 | 11 | -------------------------------------------------------------------------------- /packages/shadycss/custom-style-interface.html: -------------------------------------------------------------------------------- 1 | 10 | 11 | -------------------------------------------------------------------------------- /packages/shadycss/examples/custom-style-element.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2016 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | /* 12 | Wrapper over 19 | 20 | */ 21 | (function () { 22 | 'use strict'; 23 | 24 | const CustomStyleInterface = window.ShadyCSS.CustomStyleInterface; 25 | 26 | class CustomStyle extends HTMLElement { 27 | constructor() { 28 | super(); 29 | this._style = null; 30 | CustomStyleInterface.addCustomStyle(this); 31 | } 32 | getStyle() { 33 | if (!this._style) { 34 | this._style = this.querySelector('style'); 35 | } 36 | return this._style; 37 | } 38 | } 39 | 40 | window.CustomStyle = CustomStyle; 41 | window.customElements.define('custom-style', CustomStyle); 42 | })(); 43 | -------------------------------------------------------------------------------- /packages/shadycss/src/common-regex.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | export const VAR_ASSIGN = /(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi; 12 | export const MIXIN_MATCH = /(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi; 13 | export const VAR_CONSUMED = /(--[\w-]+)\s*([:,;)]|$)/gi; 14 | export const ANIMATION_MATCH = /(animation\s*:)|(animation-name\s*:)/; 15 | export const MEDIA_MATCH = /@media\s(.*)/; 16 | export const IS_VAR = /^--/; 17 | export const BRACKETED = /\{[^}]*\}/g; 18 | export const HOST_PREFIX = '(?:^|[^.#[:])'; 19 | export const HOST_SUFFIX = '($|[.:[\\s>+~])'; 20 | -------------------------------------------------------------------------------- /packages/shadycss/src/env.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2021 The Polymer Project Authors. All rights reserved. This 4 | * code may only be used under the BSD style license found at 5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be found 6 | * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may 7 | * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by 8 | * Google as part of the polymer project is also subject to an additional IP 9 | * rights grant found at http://polymer.github.io/PATENTS.txt 10 | */ 11 | 12 | // When building externally, this file is always assumed to be a module, but by 13 | // default it isn't when building internally, so we need this export statement. 14 | export {}; 15 | 16 | declare global { 17 | interface Element { 18 | extends?: string; 19 | _element?: Element | null; 20 | __cssBuild?: string; 21 | } 22 | 23 | interface HTMLTemplateElement { 24 | _validating?: boolean; 25 | _prepared?: boolean; 26 | _domPrepared?: boolean; 27 | _content?: DocumentFragment | null; 28 | _gatheredStyle?: HTMLStyleElement | null; 29 | _style?: HTMLStyleElement | null; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/shadycss/src/template-map.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | 'use strict'; 12 | 13 | /** 14 | * @const {!Object} 15 | */ 16 | const templateMap = {}; 17 | export default templateMap; 18 | -------------------------------------------------------------------------------- /packages/shadycss/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2017", 4 | "module": "es2015", 5 | "moduleResolution": "node", 6 | "lib": ["DOM"], 7 | "strict": true, 8 | "declaration": true, 9 | "noUnusedLocals": true, 10 | "noUnusedParameters": true, 11 | "preserveConstEnums": true, 12 | "forceConsistentCasingInFileNames": true, 13 | "rootDir": "ts_src/", 14 | "outDir": "src/", 15 | "sourceMap": true, 16 | "incremental": true, 17 | "tsBuildInfoFile": ".tsbuildinfo" 18 | }, 19 | "include": ["ts_src/**/*"], 20 | "exclude": [] 21 | } 22 | -------------------------------------------------------------------------------- /packages/shadydom/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@webcomponents/shadydom", 3 | "version": "1.11.0", 4 | "lockfileVersion": 1 5 | } 6 | -------------------------------------------------------------------------------- /packages/shadydom/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@webcomponents/shadydom", 3 | "version": "1.11.0", 4 | "publishConfig": { 5 | "access": "public" 6 | }, 7 | "description": "Shadow DOM polyfill", 8 | "license": "BSD-3-Clause", 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/webcomponents/polyfills.git", 12 | "directory": "packages/shadydom" 13 | }, 14 | "author": "The Polymer Project Authors (https://polymer.github.io/AUTHORS.txt)", 15 | "homepage": "https://github.com/webcomponents/polyfills/tree/master/packages/shadydom", 16 | "bugs": "https://github.com/webcomponents/polyfills/issues?q=is%3Aissue+is%3Aopen+label%3A\"Package%3A+shadydom\"", 17 | "main": "shadydom.min.js", 18 | "scripts": { 19 | "build": "gulp", 20 | "build:watch": "chokidar --initial 'src/**/*.js' -c 'npm run build'", 21 | "debug": "rollup -c", 22 | "prepack": "npm run build", 23 | "regen-package-lock": "rm -rf node_modules package-lock.json; npm install" 24 | }, 25 | "files": [ 26 | "CHANGELOG.md", 27 | "externs/**/*.d.ts", 28 | "externs/**/*.js", 29 | "LICENSE.md", 30 | "shadydom.min.js*", 31 | "src/**/*.js", 32 | "README.md" 33 | ], 34 | "keywords": [ 35 | "shady-dom", 36 | "shadydom", 37 | "shadow-dom", 38 | "shadowdom", 39 | "web-components", 40 | "webcomponents", 41 | "polyfill", 42 | "shim" 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /packages/shadydom/rollup.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | input: 'src/shadydom.js', 3 | output: {file: 'shadydom.min.js', format: 'iife', sourcemap: true}, 4 | }; 5 | -------------------------------------------------------------------------------- /packages/shadydom/src/flush.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2016 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | import * as utils from './utils.js'; 12 | 13 | // render enqueuer/flusher 14 | let flushList = []; 15 | let scheduled; 16 | export function enqueue(callback) { 17 | if (!scheduled) { 18 | scheduled = true; 19 | utils.microtask(flush); 20 | } 21 | flushList.push(callback); 22 | } 23 | 24 | export function flush() { 25 | scheduled = false; 26 | let didFlush = Boolean(flushList.length); 27 | while (flushList.length) { 28 | flushList.shift()(); 29 | } 30 | return didFlush; 31 | } 32 | 33 | flush['list'] = flushList; 34 | -------------------------------------------------------------------------------- /packages/shadydom/src/patches/DocumentOrFragment.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2016 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | import * as utils from '../utils.js'; 11 | import {query} from './ParentNode.js'; 12 | 13 | export const DocumentOrFragmentPatches = utils.getOwnPropertyDescriptors({ 14 | /** 15 | * @this {Element} 16 | * @param {string} id 17 | */ 18 | getElementById(id) { 19 | if (id === '') { 20 | return null; 21 | } 22 | let result = query( 23 | this, 24 | function (n) { 25 | return n.id == id; 26 | }, 27 | function (n) { 28 | return Boolean(n); 29 | } 30 | )[0]; 31 | return result || null; 32 | }, 33 | }); 34 | -------------------------------------------------------------------------------- /packages/shadydom/src/patches/EventTarget.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2016 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | import * as utils from '../utils.js'; 12 | // prettier-ignore 13 | import {addEventListener, removeEventListener, dispatchEvent} from '../patch-events.js'; 14 | 15 | export const EventTargetPatches = utils.getOwnPropertyDescriptors({ 16 | dispatchEvent, 17 | 18 | addEventListener, 19 | 20 | removeEventListener, 21 | }); 22 | -------------------------------------------------------------------------------- /packages/shadydom/src/patches/HTMLElement.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2016 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | import * as utils from '../utils.js'; 12 | // prettier-ignore 13 | import {eventPropertyNamesForHTMLElement, wrappedDescriptorForEventProperty} from '../patch-events.js'; 14 | import {shadyDataForNode} from '../shady-data.js'; 15 | 16 | export const HTMLElementPatches = utils.getOwnPropertyDescriptors({ 17 | /** @this {HTMLElement} */ 18 | blur() { 19 | const nodeData = shadyDataForNode(this); 20 | let root = nodeData && nodeData.root; 21 | let shadowActive = root && root.activeElement; 22 | if (shadowActive) { 23 | shadowActive[utils.SHADY_PREFIX + 'blur'](); 24 | } else { 25 | this[utils.NATIVE_PREFIX + 'blur'](); 26 | } 27 | }, 28 | }); 29 | 30 | if (!utils.settings.preferPerformance) { 31 | eventPropertyNamesForHTMLElement.forEach((property) => { 32 | HTMLElementPatches[property] = wrappedDescriptorForEventProperty(property); 33 | }); 34 | } 35 | -------------------------------------------------------------------------------- /packages/shadydom/src/patches/Slotable.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2016 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | import * as utils from '../utils.js'; 12 | import {shadyDataForNode} from '../shady-data.js'; 13 | 14 | export const SlotablePatches = utils.getOwnPropertyDescriptors({ 15 | /** @this {Node} */ 16 | get assignedSlot() { 17 | // Force any parent's shadowRoot to flush so that distribution occurs 18 | // and this node has an assignedSlot. 19 | const parent = this[utils.SHADY_PREFIX + 'parentNode']; 20 | const ownerRoot = parent && parent[utils.SHADY_PREFIX + 'shadowRoot']; 21 | if (ownerRoot) { 22 | ownerRoot._render(); 23 | } 24 | const nodeData = shadyDataForNode(this); 25 | return (nodeData && nodeData.assignedSlot) || null; 26 | }, 27 | }); 28 | -------------------------------------------------------------------------------- /packages/shadydom/src/patches/Window.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2016 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | import * as utils from '../utils.js'; 11 | // prettier-ignore 12 | import {addEventListener, removeEventListener, dispatchEvent} from '../patch-events.js'; 13 | 14 | export const WindowPatches = utils.getOwnPropertyDescriptors({ 15 | // Ensure that `dispatchEvent` is patched directly on Window since on 16 | // IE11, Window does not descend from EventTarget. 17 | dispatchEvent, 18 | 19 | // NOTE: ensure these methods are bound to `window` so that `this` is correct 20 | // when called directly from global context without a receiver; e.g. 21 | // `addEventListener(...)`. 22 | addEventListener: addEventListener.bind(window), 23 | 24 | removeEventListener: removeEventListener.bind(window), 25 | }); 26 | -------------------------------------------------------------------------------- /packages/shadydom/src/shady-data.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2016 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | export class ShadyData { 12 | /** @override */ 13 | toJSON() { 14 | return {}; 15 | } 16 | } 17 | 18 | export function ensureShadyDataForNode(node) { 19 | if (!node.__shady) { 20 | node.__shady = new ShadyData(); 21 | } 22 | return node.__shady; 23 | } 24 | 25 | export function shadyDataForNode(node) { 26 | return node && node.__shady; 27 | } 28 | -------------------------------------------------------------------------------- /packages/template/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | 9 | 10 | ## [1.5.1] - 2023-03-30 11 | 12 | - Update dependencies ([#542](https://github.com/webcomponents/polyfills/pull/542)) 13 | 14 | ## [1.5.0] - 2021-08-02 15 | 16 | - Add TS externs. ([#457](https://github.com/webcomponents/polyfills/pull/457)) 17 | 18 | ## [1.4.4] - 2020-10-21 19 | 20 | - Maintenance release (no user-facing changes) 21 | 22 | ## [1.4.3] - 2020-07-20 23 | 24 | - Maintenance release (no user-facing changes) 25 | 26 | ## [1.4.2] - 2020-03-16 27 | 28 | - Maintenance release (no user-facing changes) 29 | -------------------------------------------------------------------------------- /packages/template/README.md: -------------------------------------------------------------------------------- 1 | # template 2 | 3 | A minimal polyfill for `