Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomkp/create.js
Shortcut for document.createElement
https://github.com/tomkp/create.js
Last synced: about 1 month ago
JSON representation
Shortcut for document.createElement
- Host: GitHub
- URL: https://github.com/tomkp/create.js
- Owner: tomkp
- Created: 2013-01-11T15:51:22.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2017-11-13T13:17:40.000Z (almost 7 years ago)
- Last Synced: 2024-04-09T11:22:55.101Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 40 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# create.js
A shortcut for document.createElement in only 739 bytes.
[![Build Status](https://travis-ci.org/tomkp/create.js.png)](https://travis-ci.org/tomkp/create.js)
## examples:
```javascript
var span = Create.element({tag: 'span', contents: 'Some text', attributes: {id: 'abc', class: 'xyz'}, events: {click: function() {} }});
// is just a shortcut for:
var element = document.createElement('span');
element.appendChild(document.createTextNode('Some text'));
element.setAttribute('id', 'abc');
element.setAttribute('class', 'xyz');
element.addEventListener('click', function() {});```