Comparing version 1.3.0 to 1.3.1
# Changelog | ||
## 1.3.1- 2021-04-28 | ||
- update docs with bind | ||
- schedule reactivity better | ||
## 1.3.0- 2021-04-14 | ||
@@ -4,0 +9,0 @@ |
@@ -191,10 +191,10 @@ // Safari Polyfills | ||
DOM.querySelectorAll("template[id^=lbInsertNodes]").forEach((template) => template.replaceWith(insertNodes.shift())); | ||
if (shouldSetReactivity) | ||
setReactivity(DOM, eventFunctions); | ||
// Set reactive Behavior if only a Text Node is present | ||
if (DOM.childElementCount === 0 && DOM.firstChild) { | ||
if (shouldSetReactivity) | ||
setReactivitySingle(DOM.firstChild); | ||
// Return Text Node | ||
return DOM.firstChild; | ||
if (shouldSetReactivity) { | ||
/* c8 ignore next 5 */ | ||
if (globalSchedule) | ||
DOM.childNodes.forEach((child) => { | ||
setTimeout(schedule, 0, setReactivity, [child, eventFunctions]); | ||
}); | ||
else | ||
setReactivity(DOM, eventFunctions); | ||
} | ||
@@ -201,0 +201,0 @@ // Return DocumentFragment |
@@ -191,10 +191,10 @@ // Safari Polyfills | ||
DOM.querySelectorAll("template[id^=lbInsertNodes]").forEach((template) => template.replaceWith(insertNodes.shift())); | ||
if (shouldSetReactivity) | ||
setReactivity(DOM, eventFunctions); | ||
// Set reactive Behavior if only a Text Node is present | ||
if (DOM.childElementCount === 0 && DOM.firstChild) { | ||
if (shouldSetReactivity) | ||
setReactivitySingle(DOM.firstChild); | ||
// Return Text Node | ||
return DOM.firstChild; | ||
if (shouldSetReactivity) { | ||
/* c8 ignore next 5 */ | ||
if (globalSchedule) | ||
DOM.childNodes.forEach((child) => { | ||
setTimeout(schedule, 0, setReactivity, [child, eventFunctions]); | ||
}); | ||
else | ||
setReactivity(DOM, eventFunctions); | ||
} | ||
@@ -201,0 +201,0 @@ // Return DocumentFragment |
{ | ||
"name": "hydro-js", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "A lightweight reactive library", | ||
@@ -33,4 +33,4 @@ "type": "module", | ||
"@types/concurrently": "^6.0.1", | ||
"@web/test-runner": "^0.12.19", | ||
"@web/test-runner-playwright": "^0.8.4", | ||
"@web/test-runner": "^0.13.2", | ||
"@web/test-runner-playwright": "^0.8.5", | ||
"concurrently": "^6.0.2", | ||
@@ -37,0 +37,0 @@ "serve": "^11.3.2", |
@@ -355,2 +355,14 @@ <img align="right" alt="100% Coverage" src="coverage.svg"> | ||
### Attributes | ||
- bind: binds a piece of data to an element. This is only useful, when an element should be removed from the DOM, when the data is being set to null. | ||
#### Example | ||
```js | ||
const data = reactive({ name: "Pet" }); | ||
render(html`<p bind=${data}>${data.name}</p>`); | ||
setTimeout(() => unset(data), 1000); // will remove the element | ||
``` | ||
## Further | ||
@@ -357,0 +369,0 @@ |
@@ -310,9 +310,9 @@ declare const window: any; | ||
if (shouldSetReactivity) setReactivity(DOM, eventFunctions); | ||
// Set reactive Behavior if only a Text Node is present | ||
if (DOM.childElementCount === 0 && DOM.firstChild) { | ||
if (shouldSetReactivity) setReactivitySingle(DOM.firstChild as Text); | ||
// Return Text Node | ||
return DOM.firstChild as Text; | ||
if (shouldSetReactivity) { | ||
/* c8 ignore next 5 */ | ||
if (globalSchedule) | ||
DOM.childNodes.forEach((child) => { | ||
setTimeout(schedule, 0, setReactivity, [child, eventFunctions]); | ||
}); | ||
else setReactivity(DOM, eventFunctions); | ||
} | ||
@@ -319,0 +319,0 @@ |
Sorry, the diff of this file is too big to display
310484
6014
374