Most references to vnode were all lowercase so I standardized on this. Fixed some small typos and made a few editorial adjustments. Feel free to take any, all or none of these suggestions (Though I do recommend the typo fixes)
Attributes are added and updated using `setAttribute`. In case of an attribute
that has been previously added/set and is no longer present in the `attrs` object,
that had been previously added/set and is no longer present in the `attrs` object,
it is removed from the DOM element's attribute list using `removeAttribute`.
In the case of boolean attributes (e.g. `disabled`, `hidden`, `selected` ...),
@ -304,7 +304,7 @@ DOM element.
### The style module
The style module is for making your HTML look slick and animate smoothly. At
it's core it allows you to set CSS properties on elements.
its core it allows you to set CSS properties on elements.
```javascript
h('span', {
@ -339,7 +339,7 @@ This makes it easy to declaratively animate the entry of elements.
Styles set in the `remove` property will take effect once the element is about
to be removed from the DOM. The applied styles should be animated with CSS
transitions. Only once all the styles is done animating, will the element be
transitions. Only once all the styles are done animating will the element be
removed from the DOM.
```javascript
@ -365,7 +365,7 @@ h('span', {
The event listeners module gives powerful capabilities for attaching
event listeners.
You can attach a function to an event on a VNode by supplying an object at `on`
You can attach a function to an event on a vnode by supplying an object at `on`
with a property corresponding to the name of the event you want to listen to.
The function will be called when the event happens and will be passed the event
object that belongs to it.
@ -400,8 +400,8 @@ Snabbdom allows swapping event handlers between renders. This happens without
actually touching the event handlers attached to the DOM.
Note, however, that **you should be careful when sharing event handlers between
VNodes**, because of the technique this module uses to avoid re-binding
event handlers to the DOM. (And in general, sharing data between VNodes is
vnodes**, because of the technique this module uses to avoid re-binding
event handlers to the DOM. (And in general, sharing data between vnodes is
not guaranteed to work, because modules are allowed to mutate the given data).
In particular, you should **not** do something like this:
@ -463,7 +463,7 @@ render function will recieve the state parameters.
`thunk(uniqueName, renderFn, [stateAguments])`
Thunks is an optimization strategy that can be used when one is dealing with
Thunks are an optimization strategy that can be used when one is dealing with
immutable data.
Consider a simple function for creating a virtual node based on a number.
@ -491,8 +491,8 @@ it will simply reuse the old vnode. This avoids recreating the number view and
the diff process altogether.
The view function here is only an example. In practice thunks are only
relevant if you are rendering a complicated view that takes a significant
computation time to generate.
relevant if you are rendering a complicated view that takes significant
computational time to generate.
## Virtual Node
**Properties**
@ -522,7 +522,7 @@ For example `h('div', {props: {className: 'container'}}, [...])` will produce a
```
as its `.data` object.
#### children : Array<VNode>
#### children : Array<vnode>
The `.children` property of a virtual node is the third (optional) parameter to [`h()`](#snabbdomh) during creation.
`.children` is simply an Array of virtual nodes that should be added as children of the parent DOM node upon creation.
@ -552,7 +552,7 @@ The `.elm` property of a virtual node is a pointer to the real DOM node created
#### key : string | number
The `.key` property is created when a key is provided inside of your [`.data`](#data--object) object. The `.key` property is used to keep pointers to DOM nodes that existed previously to avoid recreating them if it is unnecessary. This is very useful for things like list reordering. A key must be either a string or a number to allow for proper lookup as it is stored internally as a keyvalue pair inside of an object, where `.key` is the key and the value is the [`.elm`](#elm--element) property created.
The `.key` property is created when a key is provided inside of your [`.data`](#data--object) object. The `.key` property is used to keep pointers to DOM nodes that existed previously to avoid recreating them if it is unnecessary. This is very useful for things like list reordering. A key must be either a string or a number to allow for proper lookup as it is stored internally as a key/value pair inside of an object, where `.key` is the key and the value is the [`.elm`](#elm--element) property created.
For example: `h('div', {key: 1}, [])` will create a virtual node object with a `.key` property with the value of `1`.