vsn 0.1.96 → 0.1.97

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.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
4
+ * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
+ * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
+ * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
+ * Code distributed by Google as part of the polymer project is also
8
+ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vsn",
3
- "version": "0.1.96",
3
+ "version": "0.1.97",
4
4
  "description": "SEO Friendly Javascript/Typescript Framework",
5
5
  "keywords": [
6
6
  "framework",
package/src/Tag.ts CHANGED
@@ -489,7 +489,6 @@ export class Tag extends DOMObject {
489
489
  for (const attr of tag.getAttributesWithState(AttributeState.Instantiated)) {
490
490
  await attr.compile();
491
491
  }
492
-
493
492
  }
494
493
  this._state = TagState.AttributesCompiled;
495
494
  }
@@ -51,7 +51,7 @@ export class List extends Attribute {
51
51
  await this.addExistingItems(items);
52
52
 
53
53
  listScope.on(`change:${listKey}`, (e) => {
54
- if (e.oldValue) {
54
+ if (e?.oldValue) {
55
55
  if (e.oldValue instanceof WrappedArray) {
56
56
  e.oldValue.map((item) => {
57
57
  this.remove(item);
@@ -147,17 +147,17 @@ export class List extends Attribute {
147
147
 
148
148
  // Setup new tag
149
149
  const tag = await this.tag.dom.buildTag(element, true);
150
-
151
- await this.setupTag(tag, obj);
150
+ await this.setupTagScope(tag, obj);
152
151
 
153
152
  // Add to DOM & build
154
153
  this.tag.element.appendChild(element);
154
+ await this.tag.dom.setupTags([tag]);
155
155
  await this.tag.dom.buildFrom(this.tag.element);
156
156
  this.tags.push(tag);
157
157
  this.tag.dispatch('add', obj);
158
158
  }
159
159
 
160
- async setupTag(tag: Tag, obj: any) {
160
+ async setupTagScope(tag: Tag, obj: any) {
161
161
  tag.createScope(true);
162
162
 
163
163
  // Setup new scope & class, if defined
@@ -172,8 +172,11 @@ export class List extends Attribute {
172
172
  }
173
173
 
174
174
  // Check if the class is set up already
175
- if (!cls || (!(tag.scope.data instanceof cls) && !(tag.scope.wrapped instanceof cls)))
175
+ if (!cls || (!(tag.scope.data instanceof cls) && !(tag.scope.wrapped instanceof cls))) {
176
+ if (tag.scope.wrapped)
177
+ tag.scope.unwrap();
176
178
  tag.wrap(obj);
179
+ }
177
180
 
178
181
  tag.scope.set(this.listItemName, tag.scope);
179
182
  }
@@ -20,7 +20,7 @@ export class ListItem extends Attribute {
20
20
  throw Error(ListItem.ERROR_NO_PARENT);
21
21
 
22
22
  const listAttr = await this.getListAttribute();
23
- await listAttr.setupTag(this.tag, {});
23
+ await listAttr.setupTagScope(this.tag, {});
24
24
  await super.setup();
25
25
  }
26
26
 
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.1.96';
1
+ export const VERSION = '0.1.97';
2
2
 
@@ -107,7 +107,6 @@ describe('ListItem', () => {
107
107
  </ul>
108
108
  `;
109
109
 
110
- console.log('################# building dom');
111
110
  const dom = new DOM(document);
112
111
  dom.once('built', async () => {
113
112
  const listItem = await dom.getTagForElement(document.getElementById('test-item'));