https://github.com/hermanya/element
Create DOM in plain JS way
https://github.com/hermanya/element
Last synced: 11 months ago
JSON representation
Create DOM in plain JS way
- Host: GitHub
- URL: https://github.com/hermanya/element
- Owner: Hermanya
- Created: 2014-01-16T22:19:08.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-01-16T23:39:09.000Z (over 12 years ago)
- Last Synced: 2025-05-19T00:38:35.508Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 117 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
https://github.com/efunneko/jquery.createHtml - jQuery version
Element.js
=======
##Plain Javascript library for creating DOM elements.
###Features:
* Balance between readability and amount of code
* Object-oriented style ♥
* Speed and size
###Idea:
```
new Element({
attribute:value
},[
new AnotherElement({
attribute:value
}),
new YetAnotherElement([
new NewElement()
])
]);
```
###Example:
```
var ul = new Ul({
class: "example-list",
onclick: "alert(\"example\");"
}, [
new Li({
id: "first-feature"
}, ["Balance between readability and amount of code"]),
new Li({
id: "cool-feature"
}, ["Object-oriented style"]),
new Li({
id: "default-feature"
}, [
"Speed and size",
new Span({
style:"color:red"
},[String.fromCharCode(9829)]
]),
]);
```