Skip to content

jsxtools/element-internals-type

Repository files navigation

ElementInternals.type

NPM Version Build Status Coverage

This is a ponyfill for the type property on ElementInternals.

class CustomButton extends HTMLElement {
  static formAssociated = true;

  #internals = this.attachInternals();

  constructor() {
    super();

    this.#internals.type = 'button';
  }
}

customElements.define('custom-button', CustomButton);

When elementInternals.type = 'button' is set in a custom element's constructor, the custom element will gain support for the attributes listed below.

Features

  • 🚀 Fully Typed: Full type safety and autocompletion
  • 🧠 Fully Tested: Full 100% test coverage
  • 📦 Tree-shakeable: Only import what you need
  • Performance Optimized: Efficient updates and rendering

Installation

npm install element-internals-type

Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create your feature branch (git checkout -b your/amazing-feature)
  3. Commit your changes (git commit -m "Add some amazing feature")
  4. Push to the branch (git push origin your/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT No Attribution License.

About

Ponyfill of ElementInternals.type

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published