base-element
Advanced tools
Comparing version 1.0.1 to 1.2.0
@@ -12,3 +12,3 @@ module.exports = BaseElement | ||
this.element = null | ||
this.__appendTo__ = el || document.body | ||
this.__appendTo__ = (typeof el === 'undefined' || el === null) ? document.body : el | ||
this.__events__ = Object.create(null) | ||
@@ -31,3 +31,5 @@ // Decorate _name to methods for super() | ||
this.element = createElement(this.vtree) | ||
this.__appendTo__.appendChild(this.element) | ||
if (this.__appendTo__ !== false) { | ||
this.__appendTo__.appendChild(this.element) | ||
} | ||
} else { | ||
@@ -38,3 +40,3 @@ var patches = diff(this.vtree, vtree) | ||
} | ||
return this | ||
return this.vtree | ||
} | ||
@@ -41,0 +43,0 @@ |
{ | ||
"name": "base-element", | ||
"version": "1.0.1", | ||
"version": "1.2.0", | ||
"description": "An element authoring library for creating standalone and performant elements.", | ||
@@ -8,3 +8,5 @@ "main": "index.js", | ||
"test": "standard", | ||
"start": "budo examples/standalone.js" | ||
"ci": "zuul --local 9966 -- test/index.js", | ||
"start": "budo examples/standalone.js", | ||
"build": "browserify index.js --standalone BaseElement -o dist/base-element.js" | ||
}, | ||
@@ -17,5 +19,25 @@ "author": "Kyle Robinson Young <kyle@dontkry.com> (http://dontkry.com)", | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"standard": { | ||
"ignore": [ | ||
"**/dist/**" | ||
] | ||
}, | ||
"keywords": [ | ||
"virtual", | ||
"dom", | ||
"element", | ||
"diff", | ||
"browser" | ||
], | ||
"devDependencies": { | ||
"browser-test-helpers": "^1.0.0", | ||
"browserify": "^10.0.0", | ||
"budo": "^4.0.0", | ||
"standard": "^3.7.2" | ||
"standard": "^3.7.2", | ||
"tap-spec": "^3.0.0", | ||
"tape": "^4.0.0", | ||
"zuul": "^3.0.0" | ||
}, | ||
@@ -22,0 +44,0 @@ "dependencies": { |
@@ -8,2 +8,3 @@ # base-element | ||
* [Web Component](https://github.com/shama/base-element/blob/master/examples/webcomponent.js) | ||
* [virtual-dom](https://github.com/shama/base-element/blob/master/examples/virtual-dom.js) | ||
* [or just standalone](https://github.com/shama/base-element/blob/master/examples/standalone.js) | ||
@@ -22,2 +23,3 @@ | ||
// Or inherits(Bear, BaseElement) | ||
// Or class Bear extends BaseElement | ||
``` | ||
@@ -53,2 +55,3 @@ | ||
// Or inherits(Button, BaseElement) | ||
// Or class Button extends BaseElement | ||
@@ -77,2 +80,15 @@ Button.prototype.render = function (label) { | ||
## install | ||
### npm with browserify, webpack, etc | ||
* `npm install base-element` | ||
* `var BaseElement = require('base-element')` | ||
### standalone | ||
* copy/download/etc [dist/base-element.js](https://github.com/shama/base-element/blob/master/dist/base-element.js) | ||
* `<script src="base-element.js"></script>` | ||
* `<script>var element = new BaseElement()</script>` | ||
## api | ||
@@ -83,4 +99,8 @@ | ||
If you pass in `false` then the element will not automatically append itself to | ||
a parent node. This is useful if you plan on handling the rendering of the | ||
virtual tree on your own. | ||
### `element.render(vtree)` | ||
Renders your virtual DOM tree to the DOM element. | ||
Renders your virtual DOM tree to the DOM element and returns the updated `vtree`. | ||
@@ -87,0 +107,0 @@ ### `element.send(name[, params])` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143
7079
7
3
66