Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

element-internals-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

element-internals-polyfill - npm Package Compare versions

Comparing version 1.3.9 to 1.3.10

18

dist/element-internals.d.ts

@@ -86,1 +86,19 @@ import { ValidityState } from './ValidityState.js';

export declare function isElementInternalsSupported(): boolean;
/**
* Forcibly applies the polyfill for CustomStateSet.
*
* https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet
*/
export declare function forceCustomStateSetPolyfill(attachInternals?: HTMLElement['attachInternals']): void;
/**
* Forcibly applies the polyfill for ElementInternals. Useful for situations
* like Chrome extensions where Chrome supports ElementInternals, but the
* CustomElements polyfill is required.
*
* https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals
*
* @param forceCustomStateSet Optional: when true, forces the
* [CustomStateSet](https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet)
* polyfill as well.
*/
export declare function forceElementInternalsPolyfill(forceCustomStateSet?: boolean): void;

1

dist/index.d.ts

@@ -6,2 +6,3 @@ import { ElementInternals } from './element-internals.js';

export * from './types.js';
export { forceCustomStateSetPolyfill, forceElementInternalsPolyfill, } from './element-internals.js';
declare global {

@@ -8,0 +9,0 @@ interface Window {

60

dist/index.js

@@ -1,2 +0,2 @@

(function () {
(function (exports) {
'use strict';

@@ -198,2 +198,7 @@

const observer = new MutationObserver(fragmentObserverCallback);
if (window?.ShadyDOM?.inUse &&
fragment.mode &&
fragment.host) {
fragment = fragment.host;
}
observer.observe?.(fragment, { childList: true });

@@ -729,3 +734,23 @@ documentFragmentMap.set(fragment, observer);

}
if (!isElementInternalsSupported()) {
let hasElementInternalsPolyfillBeenApplied = false;
let hasCustomStateSetPolyfillBeenApplied = false;
function forceCustomStateSetPolyfill(attachInternals) {
if (hasCustomStateSetPolyfillBeenApplied) {
return;
}
hasCustomStateSetPolyfillBeenApplied = true;
window.CustomStateSet = CustomStateSet;
if (attachInternals) {
HTMLElement.prototype.attachInternals = function (...args) {
const internals = attachInternals.call(this, args);
internals.states = new CustomStateSet(this);
return internals;
};
}
}
function forceElementInternalsPolyfill(forceCustomStateSet = true) {
if (hasElementInternalsPolyfillBeenApplied) {
return;
}
hasElementInternalsPolyfillBeenApplied = true;
if (typeof window !== 'undefined') {

@@ -795,16 +820,25 @@ window.ElementInternals = ElementInternals;

}
if (typeof window !== 'undefined' && !window.CustomStateSet) {
window.CustomStateSet = CustomStateSet;
if (forceCustomStateSet ||
(typeof window !== "undefined" && !window.CustomStateSet)) {
forceCustomStateSetPolyfill();
}
}
else if (typeof window !== 'undefined' && !window.CustomStateSet) {
window.CustomStateSet = CustomStateSet;
const attachInternals = HTMLElement.prototype.attachInternals;
HTMLElement.prototype.attachInternals = function (...args) {
const internals = attachInternals.call(this, args);
internals.states = new CustomStateSet(this);
return internals;
};
const isCePolyfill = !!customElements.polyfillWrapFlushCallback;
if (!isCePolyfill) {
if (!isElementInternalsSupported()) {
forceElementInternalsPolyfill(false);
}
else if (typeof window !== "undefined" && !window.CustomStateSet) {
forceCustomStateSetPolyfill(HTMLElement.prototype.attachInternals);
}
}
})();
exports.forceCustomStateSetPolyfill = forceCustomStateSetPolyfill;
exports.forceElementInternalsPolyfill = forceElementInternalsPolyfill;
Object.defineProperty(exports, '__esModule', { value: true });
return exports;
})({});
{
"name": "element-internals-polyfill",
"version": "1.3.9",
"version": "1.3.10",
"description": "A polyfill for the element internals specification",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc