jsdom, checker: add more methods for CanvasRenderingContext2D, fix interop check for JS methods (#12372)

This commit is contained in:
playX 2021-11-03 17:54:28 +03:00 committed by GitHub
parent c4e282a0c8
commit 2b4154910c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 235 additions and 80 deletions

View file

@ -1,7 +1,5 @@
module jsdom
import jsdom.ctx
pub struct HTMLCanvasElement {
HTMLElement
}
@ -31,10 +29,10 @@ pub fn (elem HTMLCanvasElement) add_event_listener(event string, cb EventCallbac
#});
}
pub fn (elem HTMLCanvasElement) get_context(ctx_ string) ctx.ContextResult {
mut res := ctx.NoneContext{}
pub fn (elem HTMLCanvasElement) get_context(ctx_ string) ContextResult {
mut res := NoneContext{}
#let ctx = elem.node.getContext(ctx_.str);
#if (ctx instanceof CanvasRenderingContext2D) { res = new jsdom__ctx__CanvasRenderingContext2D(ctx); res.ctx = ctx; }
#if (ctx instanceof CanvasRenderingContext2D) { res = new jsdom__CanvasRenderingContext2D(ctx); res.ctx = ctx; }
return res
}