UNPKG

@opra/common

Version:
32 lines (31 loc) 814 B
import { asMutable } from 'ts-gems'; import { uid } from 'uid'; import { DocumentNode } from './document-node.js'; /** * * @constructor DocumentElement */ export const DocumentElement = function (owner) { if (!this) throw new TypeError('"this" should be passed to call class constructor'); const _this = asMutable(this); _this.id = uid(16); Object.defineProperty(_this, 'node', { value: new DocumentNode(this, owner?.node), enumerable: false, writable: true, }); if (owner) { Object.defineProperty(_this, 'owner', { value: owner, enumerable: false, writable: true, }); } }; /** * @class DocumentElement */ class DocumentElementClass { } DocumentElement.prototype = DocumentElementClass.prototype;