This repository has been archived by the owner on Nov 28, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs: Integrate changes into the document
- Loading branch information
1 parent
bb8a511
commit 1bfcfc2
Showing
6 changed files
with
85 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Constructor `RElement` | ||
**The last updated version of this function**: *3.1.0* | ||
## Browser Support | ||
| <img src="https://cdn.jsdelivr.net/gh/TechPot-Studio/svg-gallery/chrome.svg" width="30" /> | <img src="https://cdn.jsdelivr.net/gh/TechPot-Studio/svg-gallery/firefox.svg" width="30" /> | <img src="https://cdn.jsdelivr.net/gh/TechPot-Studio/svg-gallery/safari.svg" width="30" /> | <img src="https://cdn.jsdelivr.net/gh/TechPot-Studio/svg-gallery/opera.svg" width="30" /> | <img src="https://cdn.jsdelivr.net/gh/TechPot-Studio/svg-gallery/edge.svg" width="30" /> | | ||
| :---: | :---: | :---: | :---: | :---: | | ||
| 45 | 39 | 10 | 32 | 12 | | ||
## Usage | ||
```javascript | ||
new peb.RElement(element) | ||
``` | ||
|
||
Referenced by [`peb.sel`]() | ||
## Properties | ||
### `.attr()` | ||
Get all attributes | ||
### `.attr(sequence: object)` | ||
Change all \[key\] attributes to \[key value\] | ||
### `.attr(name: string, value: string)` | ||
|
||
Change the attribute `name` to `value` when available, otherwise, return the attribute value corresponding to `name` | ||
### `.data(name: string, value: string)` | ||
|
||
Change the dataset `name` to `value` when available, otherwise, return the dataset value corresponding to `name` | ||
|
||
### `insert(...nodes: Node[] | HTMLElement[] | RElement[])` | ||
Add child elements to the object | ||
|
||
### `del()` | ||
Remove Element | ||
|
||
### `.html(value?: string)` | ||
Get it if no parameters are passed in, otherwise set value to `value` | ||
|
||
### `.text()` | ||
Get innerText | ||
|
||
### `.val(value?: string)` | ||
Get it if no parameters are passed in, otherwise set value to `value` | ||
|
||
### `.hide()` | ||
Hide element | ||
|
||
### `.show(type?: string) | ||
set value of `Element.style.display` if passed in parameter, otherwise set display type to value of lastest time hide | ||
|
||
### `.on(event: string, listener?: function)` | ||
Add event listener if `listener` is passed in, otherwise remove | ||
|
||
### `.class()` | ||
Returns HTMLSettableTokenList | ||
|
||
### `.style(sheet)` | ||
Set style by sheet. sheet is a object like `{width: .5em}` | ||
|
||
### `.next()` | ||
Get next element sibling | ||
### `.prev()` | ||
Get previous element sibling | ||
### `.parent()` | ||
Get parent | ||
### `.child()` | ||
Get **first** child element | ||
*Tip:* Better effect with `.next()` | ||
### `.domReady(fn)` | ||
Do `fn` When dom content are ready | ||
### `.animate(ms, sheet)` | ||
Animate style to `sheet` in `ms` milliseconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters