nbhi 0.6.13 → 0.6.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -99,11 +99,6 @@ export default selector => {
99
99
 
100
100
  function updateList(records) {
101
101
  const parent = getParent();
102
-
103
- if (!templateChild) {
104
- throw new Error(`Cannot update ${ selector }, cannot find child element`);
105
- }
106
-
107
102
  const newChildren = new Map();
108
103
 
109
104
  records.forEach((record, index) => {
@@ -158,7 +153,6 @@ export default selector => {
158
153
  if (templateParent) {
159
154
  return templateParent;
160
155
  }
161
-
162
156
  const topLevel = getTopLevel();
163
157
  if (topLevel.localName === 'table') {
164
158
  return process('tbody', 'tr');
@@ -170,6 +164,7 @@ export default selector => {
170
164
  return process('select', 'option');
171
165
  } else if (topLevel.querySelector('[child]')) {
172
166
  const parent = getParent(topLevel.querySelector('[child]')).parentElement;
167
+ templateParent = parent;
173
168
  setTemplateChild('[child]', parent);
174
169
  if (parent.localName === 'slot' && parent.hasAttribute('name')) {
175
170
  templateChild.slot = parent.getAttribute('name');
@@ -183,6 +178,7 @@ export default selector => {
183
178
  function process(parentName, childName) {
184
179
  const parent = getParent(parentName);
185
180
  setTemplateChild(childName, parent);
181
+ templateParent = parent;
186
182
  return parent;
187
183
  }
188
184
 
@@ -203,7 +199,6 @@ export default selector => {
203
199
  console.log({ topLevel, parentName });
204
200
  throw new Error('Cannot find parent');
205
201
  }
206
- templateParent = parent;
207
202
  return parent;
208
203
  }
209
204
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nbhi",
3
- "version": "0.6.13",
3
+ "version": "0.6.14",
4
4
  "description": "No-Build HTML Includes (NBHI) is a simple library that allows you to include html files into other html files and turns them into [web components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components). Lazy initialization of content (when entering the viewport) and a one line call to update/hydrate content in your html pages. No build tools required, no `package.json` needed.",
5
5
  "keywords": [
6
6
  "web-components",