diff --git a/std/assembly/bindings/dom.ts b/std/assembly/bindings/dom.ts index cd206110c4..85c59ffc46 100644 --- a/std/assembly/bindings/dom.ts +++ b/std/assembly/bindings/dom.ts @@ -115,6 +115,23 @@ export declare namespace String { export function fromCodePoints(codepoints: i32[]): externref; } +export declare namespace Object { + @external("env", "Object.is") + export function is(a: externref, b: externref): bool; + @external("env", "Object.hasOwn") + export function hasOwn(target: externref, propertyKey: string): bool; + @external("env", "Object.assign") + export function assign(target: externref, source: externref): externref; + @external("env", "Object.keys") + export function keys(target: externref): externref; + @external("env", "Object.values") + export function values(target: externref): externref; + @external("env", "Object.entries") + export function entries(target: externref): externref; + @external("env", "Object.getOwnPropertyNames") + export function getOwnPropertyNames(target: externref): externref; +} + export declare namespace Date { @external("env", "Date.now") export function now(): f64; @@ -142,8 +159,120 @@ export declare namespace console { } export declare namespace document { + /** Returns document's encoding. */ + @external("env", "document.characterSet") + export const characterSet: string; + /** Returns a value that indicates whether standards-compliant mode is switched on for the object. */ + @external("env", "document.compatMode") + export const compatMode: string; + /** Returns document's content type. */ + @external("env", "document.contentType") + export const contentType: string; + /** Returns a reference to the root node of the document. */ + @external("env", "document.documentElement") + export const documentElement: externref; + /** Returns document's URL. */ + @external("env", "document.documentURI") + export const documentURI: string; + /** Returns the URL of the location that referred the user to the current page. */ + @external("env", "document.referrer") + export const referrer: string; + /** Returns true if document has the ability of fullscreen mode, or false otherwise. */ + @external("env", "document.pictureInPictureEnabled") + export const fullscreenEnabled: bool; + /** Returns true if document has the ability of picture-in-picture mode, or false otherwise. */ + @external("env", "document.pictureInPictureEnabled") + export const pictureInPictureEnabled: bool; + + /** Returns the number of child elements. */ + @external("env", "document.childElementCount") + export const childElementCount: i32; + /** Returns the child elements. */ + @external("env", "document.children") + export const children: externref; + /** Returns the first child that is an element, and null otherwise. */ + @external("env", "document.firstElementChild") + export const firstElementChild: externref; + /** Returns the last child that is an element, and null otherwise. */ + @external("env", "document.lastElementChild") + export const lastElementChild: externref; + + /** + * Returns the HTTP cookies that apply to the Document. If there are no cookies or cookies can't be applied + * to this resource, the empty string will be returned. + * + * Can be set, to add a new cookie to the element's set of HTTP cookies. + * + * If the contents are sandboxed into a unique origin (e.g. in an iframe with the sandbox attribute), + * a "SecurityError" DOMException will be thrown on getting and setting. + */ + @external("env", "document.cookie") + export let cookie: string; + /** Represents the
or