UNPKG

happy-dom

Version:

Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. It includes many web standards from WHATWG DOM and HTML.

35 lines (32 loc) 811 B
import DOMRect from './DOMRect.js'; import * as PropertySymbol from '../PropertySymbol.js'; /** * DOM Rect List. * * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMRectList */ export default class DOMRectList extends Array<DOMRect> { /** * Constructor. * * @param illegalConstructorSymbol Illegal constructor symbol. */ constructor(illegalConstructorSymbol: symbol) { super(); // "illegalConstructorSymbol" can be "1" when calling the "splice()" method if ( <number>(<unknown>illegalConstructorSymbol) !== 1 && illegalConstructorSymbol !== PropertySymbol.illegalConstructor ) { throw new TypeError('Illegal constructor'); } } /** * Returns item by index. * * @param index Index. */ public item(index: number): DOMRect { return this[index] ?? null; } }