vsn 0.1.133 → 0.1.135
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.
- package/demo/examples/cascading-function-sheets.html +2 -11
- package/demo/memory-leak-test.html +10 -2
- package/demo/resources/xhr-memory-leak-test.html +1 -1
- package/demo/vsn.js +2 -2
- package/dist/AST/ClassNode.js +23 -36
- package/dist/AST/ClassNode.js.map +1 -1
- package/dist/AST.js +1 -1
- package/dist/AST.js.map +1 -1
- package/dist/Attribute.d.ts +1 -0
- package/dist/Attribute.js +5 -0
- package/dist/Attribute.js.map +1 -1
- package/dist/DOM/AbstractDOM.d.ts +1 -0
- package/dist/DOM/AbstractDOM.js +7 -0
- package/dist/DOM/AbstractDOM.js.map +1 -1
- package/dist/DOM/DOMObject.d.ts +3 -0
- package/dist/DOM/DOMObject.js +8 -0
- package/dist/DOM/DOMObject.js.map +1 -1
- package/dist/EventDispatcher.d.ts +1 -0
- package/dist/EventDispatcher.js +81 -31
- package/dist/EventDispatcher.js.map +1 -1
- package/dist/Scope/ScopeDataAbstract.d.ts +2 -0
- package/dist/Scope/ScopeDataAbstract.js +55 -26
- package/dist/Scope/ScopeDataAbstract.js.map +1 -1
- package/dist/Scope/properties/Property.d.ts +1 -0
- package/dist/Scope/properties/Property.js +6 -0
- package/dist/Scope/properties/Property.js.map +1 -1
- package/dist/Scope.d.ts +2 -1
- package/dist/Scope.js +23 -4
- package/dist/Scope.js.map +1 -1
- package/dist/Tag.d.ts +1 -0
- package/dist/Tag.js +30 -34
- package/dist/Tag.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/AST/ClassNode.ts +7 -9
- package/src/AST.ts +1 -1
- package/src/Attribute.ts +6 -0
- package/src/DOM/AbstractDOM.ts +7 -0
- package/src/DOM/DOMObject.ts +10 -0
- package/src/EventDispatcher.ts +23 -1
- package/src/Scope/ScopeDataAbstract.ts +21 -0
- package/src/Scope/properties/Property.ts +7 -0
- package/src/Scope.ts +20 -5
- package/src/Tag.ts +18 -9
- package/src/version.ts +1 -1
package/src/Scope.ts
CHANGED
|
@@ -26,6 +26,17 @@ export class Scope extends ScopeAbstract {
|
|
|
26
26
|
this._data.addRelay(this);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
deconstruct() {
|
|
30
|
+
super.deconstruct();
|
|
31
|
+
this.collectGarbage(true);
|
|
32
|
+
this.wrapped = null;
|
|
33
|
+
if (this._data)
|
|
34
|
+
this._data.deconstruct();
|
|
35
|
+
this._data = null;
|
|
36
|
+
this.children.length = 0;
|
|
37
|
+
this._parentScope = null;
|
|
38
|
+
}
|
|
39
|
+
|
|
29
40
|
public get data(): ScopeData {
|
|
30
41
|
return this._data;
|
|
31
42
|
}
|
|
@@ -105,6 +116,7 @@ export class Scope extends ScopeAbstract {
|
|
|
105
116
|
}
|
|
106
117
|
|
|
107
118
|
get(key: string, searchParents: boolean = true): any {
|
|
119
|
+
if (this._data === null) return null;
|
|
108
120
|
const value: any = this._data[key];
|
|
109
121
|
if (value === undefined) {
|
|
110
122
|
if (searchParents && this.parentScope)
|
|
@@ -117,6 +129,7 @@ export class Scope extends ScopeAbstract {
|
|
|
117
129
|
}
|
|
118
130
|
|
|
119
131
|
set(key: string, value: any, detectType: boolean = false): void {
|
|
132
|
+
if (this._data === null) return;
|
|
120
133
|
if (detectType) {
|
|
121
134
|
const type = typeof value;
|
|
122
135
|
if (type === 'number') {
|
|
@@ -135,11 +148,18 @@ export class Scope extends ScopeAbstract {
|
|
|
135
148
|
this._data[key] = value;
|
|
136
149
|
}
|
|
137
150
|
|
|
151
|
+
remove(key: string) {
|
|
152
|
+
if (this._data === null) return;
|
|
153
|
+
this._data.removeProperty(key);
|
|
154
|
+
}
|
|
155
|
+
|
|
138
156
|
get keys(): string[] {
|
|
157
|
+
if (this._data === null) return [];
|
|
139
158
|
return this._data.keys;
|
|
140
159
|
}
|
|
141
160
|
|
|
142
161
|
has(key: string): boolean {
|
|
162
|
+
if (this._data === null) return false;
|
|
143
163
|
return this._data.hasProperty(key);
|
|
144
164
|
}
|
|
145
165
|
|
|
@@ -186,11 +206,6 @@ export class Scope extends ScopeAbstract {
|
|
|
186
206
|
this.cleanup();
|
|
187
207
|
}
|
|
188
208
|
|
|
189
|
-
deconstruct() {
|
|
190
|
-
super.deconstruct();
|
|
191
|
-
this.collectGarbage(true);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
209
|
public wrap(toWrap: any, triggerUpdates: boolean = false, updateFromWrapped: boolean = true) {
|
|
195
210
|
if (toWrap instanceof ScopeData) {
|
|
196
211
|
if (this._data instanceof EventDispatcher) {
|
package/src/Tag.ts
CHANGED
|
@@ -79,6 +79,7 @@ export class Tag extends DOMObject {
|
|
|
79
79
|
this.rawAttributes = {};
|
|
80
80
|
this.parsedAttributes = {};
|
|
81
81
|
this.onEventHandlers = {};
|
|
82
|
+
this.onEventBindings = {};
|
|
82
83
|
this.analyzeElementAttributes();
|
|
83
84
|
this._state = TagState.Instantiated;
|
|
84
85
|
}
|
|
@@ -703,7 +704,8 @@ export class Tag extends DOMObject {
|
|
|
703
704
|
if (eventType.indexOf('touch') > -1 || passiveValue !== null)
|
|
704
705
|
eventListenerOpts['passive'] = passiveValue === null && true || passiveValue;
|
|
705
706
|
|
|
706
|
-
|
|
707
|
+
|
|
708
|
+
element.addEventListener(eventType, this.getEventBinding(eventType), eventListenerOpts);
|
|
707
709
|
}
|
|
708
710
|
|
|
709
711
|
this.onEventHandlers[eventType].push({
|
|
@@ -715,6 +717,13 @@ export class Tag extends DOMObject {
|
|
|
715
717
|
});
|
|
716
718
|
}
|
|
717
719
|
|
|
720
|
+
public getEventBinding(eventType: string) {
|
|
721
|
+
if (this.onEventBindings[eventType] === undefined)
|
|
722
|
+
this.onEventBindings[eventType] = this.handleEvent.bind(this, eventType);
|
|
723
|
+
|
|
724
|
+
return this.onEventBindings[eventType];
|
|
725
|
+
}
|
|
726
|
+
|
|
718
727
|
public removeEventHandler(eventType: string, handler, context: any = null) {
|
|
719
728
|
if (!this.onEventHandlers[eventType])
|
|
720
729
|
return;
|
|
@@ -723,17 +732,16 @@ export class Tag extends DOMObject {
|
|
|
723
732
|
if (_handler) {
|
|
724
733
|
this.onEventHandlers[eventType].splice(this.onEventHandlers[eventType].indexOf(_handler), 1);
|
|
725
734
|
if (this.onEventHandlers[eventType].length === 0) {
|
|
726
|
-
this.element.removeEventListener(eventType, this.
|
|
735
|
+
this.element.removeEventListener(eventType, this.getEventBinding(eventType));
|
|
727
736
|
}
|
|
728
737
|
}
|
|
729
738
|
}
|
|
730
739
|
|
|
731
740
|
public removeAllEventHandlers() {
|
|
732
741
|
for (const eventType of Object.keys(this.onEventHandlers)) {
|
|
733
|
-
|
|
734
|
-
this.removeEventHandler(eventType, handler.handler, handler.context);
|
|
735
|
-
}
|
|
742
|
+
this.element.removeEventListener(eventType, this.getEventBinding(eventType));
|
|
736
743
|
}
|
|
744
|
+
this.onEventHandlers = {};
|
|
737
745
|
}
|
|
738
746
|
|
|
739
747
|
public removeContextEventHandlers(context: any) {
|
|
@@ -801,20 +809,21 @@ export class Tag extends DOMObject {
|
|
|
801
809
|
}
|
|
802
810
|
|
|
803
811
|
deconstruct() {
|
|
812
|
+
const dom = this.dom || DOM.instance;
|
|
813
|
+
if (dom)
|
|
814
|
+
dom.deregisterElementInRoot(this);
|
|
804
815
|
this.removeAllEventHandlers();
|
|
805
816
|
this.attributes.forEach(attr => attr.deconstruct());
|
|
806
817
|
this.attributes.clear();
|
|
818
|
+
this.deferredAttributes.length = 0;
|
|
807
819
|
this._children.forEach(child => child.deconstruct());
|
|
808
820
|
this._children.length = 0;
|
|
809
821
|
if (this._controller) {
|
|
810
822
|
this._controller.deconstruct();
|
|
811
823
|
this._controller = null;
|
|
812
824
|
}
|
|
813
|
-
if (this.element) {
|
|
814
|
-
this.element[Tag.TaggedVariable] = null;
|
|
815
|
-
(this as any).element = null;
|
|
816
|
-
}
|
|
817
825
|
this._parentTag = null;
|
|
826
|
+
(this as any).dom = null;
|
|
818
827
|
super.deconstruct();
|
|
819
828
|
}
|
|
820
829
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.1.
|
|
1
|
+
export const VERSION = '0.1.135';
|
|
2
2
|
|