Re: [WICG/webcomponents] Cleaning up (undefining) custom elements? (#754)

> > the current state of play is that i can do nothing about this.
> 
> I wouldn't say there's nothing you can do. Not that it is exactly desirable to do this, but:
> 
> ```
> <script>
>  // Block certain custom elements from being defined.
>  const defineCustomElement = CustomElementRegistry.prototype.define;
>  CustomElementRegistry.prototype.define = function define(name, constructor, options) {
>   if (name == 'element-you-do-not-want-defined') {
>    return;
>   }
>   return defineCustomElement.call(this, name, constructor, options);
>  };
> </script>
> 
> <script src="library-you-want-limit-custom-definitions-from.js"></script>
> 
> <script>
>  // Unblock
>  CustomElementRegistry.prototype.define = defineCustomElement;
> </script>
> 
> <script src="this-library-should-work-as-normal.js"></script>
> ```

This worked perfectly for me

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/754#issuecomment-2472793404
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/754/2472793404@github.com>

Received on Wednesday, 13 November 2024 08:20:53 UTC