Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
basic-element-base
Advanced tools
Readme
A sample general-purpose base class for defining custom elements that mixes in some common features: template stamping into a shadow root, shadow element references, marshalling attributes to properties, and retrieving the children distributed to a component.
This base class is not special in any way, and is defined only as a convenient shorthand for applying the mixins listed above. You can use this class as a base class for your own elements, or easily create your own base class by applying the same set of mixins.
The ElementBase base class does not register itself as a custom element with the browser, and hence cannot be independently instantiated.
Kind: global class
Mixes: AttributeMarshalling
, Composable
, DistributedChildren
, ShadowElementReferences
, ShadowTemplate
Array.<Node>
Array.<HTMLElement>
string
Apply a set of mixin functions or mixin objects to the present class and return the new class.
Instead of writing:
let MyClass = Mixin1(Mixin2(Mixin3(Mixin4(Mixin5(BaseClass)))));
You can write:
let MyClass = Composable(BaseClass).compose(
Mixin1,
Mixin2,
Mixin3,
Mixin4,
Mixin5
);
This function can also take mixin objects. A mixin object is just a shorthand for a mixin function that creates a new subclass with the given members. The mixin object's members are not copied directly onto the prototype of the base class, as with traditional mixins.
In addition to providing syntactic sugar, this mixin can be used to
define a class in ES5, which lacks ES6's class
keyword.
Kind: static method of ElementBase
. Defined by Composable
mixin.
Param | Type | Description |
---|---|---|
...mixins | mixins | A set of mixin functions or objects to apply. |
Array.<Node>
An in-order collection of child nodes, expanding any slot elements. Like the standard childNodes property, this includes text nodes.
Kind: instance property of ElementBase
. Defined by DistributedChildren
mixin.
Array.<HTMLElement>
An in-order collection of children, expanding any slot elements. Like the standard children property, this skips text nodes.
Kind: instance property of ElementBase
. Defined by DistributedChildren
mixin.
string
The concatenated text content of all child nodes, expanding any slot elements.
Kind: instance property of ElementBase
. Defined by DistributedChildren
mixin.
object
The collection of references to the elements with IDs in a component's Shadow DOM subtree.
Kind: global variable
FAQs
A sample general-purpose base class for defining custom elements that mixes in some common features: template stamping into a shadow root, automatic node finding, and marshalling between attributes and properties.
The npm package basic-element-base receives a total of 6 weekly downloads. As such, basic-element-base popularity was classified as not popular.
We found that basic-element-base demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.