onejs-core 0.3.34 → 0.3.35

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/dist/dom/dom.js CHANGED
@@ -2,7 +2,16 @@ import { DomStyleWrapper } from "./dom-style";
2
2
  export class DomWrapper {
3
3
  get _dom() { return this.#dom; }
4
4
  get ve() { return this.#dom.ve; }
5
- get childNodes() { return this.#dom.childNodes.map((child) => new DomWrapper(child)); }
5
+ get childNodes() {
6
+ if (!this.#dom.childNodes)
7
+ return [];
8
+ let arr = new Array(this.#dom.childNodes.Length);
9
+ var i = this.#dom.childNodes.Length;
10
+ while (i--) {
11
+ arr[i] = new DomWrapper(this.#dom.childNodes.get_Item(i));
12
+ }
13
+ return arr;
14
+ }
6
15
  get firstChild() {
7
16
  return this.#dom.firstChild ? new DomWrapper(this.#dom.firstChild) : null;
8
17
  }
package/dom/dom.ts CHANGED
@@ -4,7 +4,15 @@ import { DomStyleWrapper } from "./dom-style"
4
4
  export class DomWrapper {
5
5
  public get _dom(): CS.OneJS.Dom.Dom { return this.#dom }
6
6
  public get ve(): CS.UnityEngine.UIElements.VisualElement { return this.#dom.ve }
7
- public get childNodes(): DomWrapper[] { return (this.#dom.childNodes as any as CS.OneJS.Dom.Dom[]).map((child) => new DomWrapper(child)) }
7
+ public get childNodes(): DomWrapper[] {
8
+ if (!this.#dom.childNodes) return [];
9
+ let arr = new Array(this.#dom.childNodes.Length) as DomWrapper[];
10
+ var i = this.#dom.childNodes.Length;
11
+ while (i--) {
12
+ arr[i] = new DomWrapper(this.#dom.childNodes.get_Item(i));
13
+ }
14
+ return arr
15
+ }
8
16
  public get firstChild(): DomWrapper | null {
9
17
  return this.#dom.firstChild ? new DomWrapper(this.#dom.firstChild) : null;
10
18
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "onejs-core",
3
3
  "description": "The JS part of OneJS, a UI framework and Scripting Engine for Unity.",
4
- "version": "0.3.34",
4
+ "version": "0.3.35",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./typings.d.ts",
7
7
  "dependencies": {