mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] vdom: fix typing issues, small cleanup
This commit is contained in:
+1
-10
@@ -2,14 +2,7 @@ import { EventBus } from "./event_bus";
|
||||
import { Observer } from "./observer";
|
||||
import { QWeb } from "./qweb";
|
||||
import { idGenerator } from "./utils";
|
||||
import {
|
||||
attrsModule,
|
||||
eventListenersModule,
|
||||
h,
|
||||
init,
|
||||
propsModule,
|
||||
VNode
|
||||
} from "./vdom";
|
||||
import { h, patch, VNode } from "./vdom";
|
||||
|
||||
let getId = idGenerator();
|
||||
|
||||
@@ -40,8 +33,6 @@ export interface Meta<T extends Env, Props> {
|
||||
observer?: Observer;
|
||||
}
|
||||
|
||||
const patch = init([eventListenersModule, attrsModule, propsModule]);
|
||||
|
||||
export interface Type<T> extends Function {
|
||||
new (...args: any[]): T;
|
||||
}
|
||||
|
||||
+14
-4
@@ -1,3 +1,12 @@
|
||||
|
||||
// because those in TypeScript are too restrictive: https://github.com/Microsoft/TSJS-lib-generator/pull/237
|
||||
declare global {
|
||||
interface Element {
|
||||
setAttribute(name: string, value: string | number | boolean): void;
|
||||
setAttributeNS(namespaceURI: string, qualifiedName: string, value: string | number | boolean): void;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// vnode.ts
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -42,7 +51,6 @@ function vnode(
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// snabbdom.ts
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -721,7 +729,10 @@ function updateProps(oldVnode: VNode, vnode: VNode): void {
|
||||
}
|
||||
}
|
||||
|
||||
export const propsModule = { create: updateProps, update: updateProps } as Module;
|
||||
export const propsModule = {
|
||||
create: updateProps,
|
||||
update: updateProps
|
||||
} as Module;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module/module.ts
|
||||
@@ -847,7 +858,6 @@ export const eventListenersModule = {
|
||||
destroy: updateEventListeners
|
||||
} as Module;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// attributes.ts
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -908,4 +918,4 @@ export const attrsModule = {
|
||||
update: updateAttrs
|
||||
} as Module;
|
||||
|
||||
|
||||
export const patch = init([eventListenersModule, attrsModule, propsModule]);
|
||||
|
||||
+1
-5
@@ -1,6 +1,4 @@
|
||||
import sdAttributes from "../libs/snabbdom/src/modules/attributes";
|
||||
import sdListeners from "../libs/snabbdom/src/modules/eventlisteners";
|
||||
import { init } from "../libs/snabbdom/src/snabbdom";
|
||||
import { patch } from "../src/vdom";
|
||||
import { EvalContext, QWeb } from "../src/qweb";
|
||||
import { normalize } from "./helpers";
|
||||
|
||||
@@ -11,8 +9,6 @@ import { normalize } from "./helpers";
|
||||
// We create before each test:
|
||||
// - qweb: a new QWeb instance
|
||||
|
||||
const patch = init([sdAttributes, sdListeners]);
|
||||
|
||||
let qweb: QWeb;
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
Reference in New Issue
Block a user