Commit e2e0deab authored by Stephanus Volke's avatar Stephanus Volke

change documentation to markdown based version

parent 10d4ade0
Pipeline #693 passed with stages
in 14 seconds
......@@ -45,5 +45,4 @@ jspm_packages
# exclude build and doc
build
doc
public
# HTML custom elements
This module provides a collection of custom elements. Instead of
inheriting your own elements from the standard HTMLElement interface
you may use the classes provided by this module because they are
expanded by often used features and functionalities to reduce
redundant code.
For details please see the reference documentation.
This repository contains a collection of custom elements which may be
used as parent classes for other custom elements. In addation to the
bare bone HTMLElement interface they provide often used methods and
functionallity to reduce redundant code and simplify common tasks like
observing other elements attribute changes.
## Usage
Using the classes is simple as defining normal custom elements.
``` javascript
// import class via es6 module syntax
import {HTMLCustomElement} from 'path/to/this/class'
// instead of extending the `HTMLElement` interface
// use the `HTMLCustomElement` class
class MyElement extends HTMLCustomElement {
constructor() {
super(); //instantiate parent class
// your code
}
connectedCallback() {
// your code executed when elemend is attached to the dom
}
attributeChangedCallback(attrName, oldVal, newVal) {
// executed every time an attribute has changed
}
// other methods
}
// register your element
window.customElements.define('my-element', MyElement);
```
......@@ -42,17 +37,8 @@ Now you can use your element like any other html tag:
</bod>
```
## Features
This section summarizes the aviable methods for each class. For
details please see the API documentation.
## Details
### HTMLCustomElement
- *waitForElementById*: equivalent of native getElementById, but works
asynchroneous and returns a Promise which resolves when the
requested element is aviable.
- *addAttributeListener*: like an event listener but for
attributes. It observes an element attribute for changes and invokes
a pre defined callback function. For this js MutationObservers are
used.
For details see the documentation of each class
- [HTMLCustomElement](./src/html-custom-element.md)
# HTMLCustomElement
This interface class extends the
- *waitForElementById*: equivalent of native getElementById, but works
asynchroneous and returns a Promise which resolves when the
requested element is aviable.
- *addAttributeListener*: like an event listener but for
attributes. It observes an element attribute for changes and invokes
a pre defined callback function. For this js MutationObservers are
used.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment