We use this polyfill as part of our Jest-based component tests which render Lit components.
Some compontents extend ValidityState of the attached internals with custom properties. This may be debatable if good practice at all but it works in modern browsers without restrictions.
However, our Jest tests fail with this TypeError: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cant_define_property_object_not_extensible
TypeError: can't define property "x": "obj" is not extensible
The reason is because ValidityState gets sealed in its constructor: https://github.com/calebdwilliams/element-internals-polyfill/blob/main/src/ValidityState.ts#L18
Was there any reason to implement it this way? Could you consider not sealing the object to allow for extension?
We use this polyfill as part of our Jest-based component tests which render Lit components.
Some compontents extend
ValidityStateof the attached internals with custom properties. This may be debatable if good practice at all but it works in modern browsers without restrictions.However, our Jest tests fail with this
TypeError: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cant_define_property_object_not_extensibleThe reason is because
ValidityStategets sealed in its constructor: https://github.com/calebdwilliams/element-internals-polyfill/blob/main/src/ValidityState.ts#L18Was there any reason to implement it this way? Could you consider not sealing the object to allow for extension?