import { Option } from "@siteimprove/alfa-option" ; import * as dom from "@siteimprove/alfa-dom" ; import { Name } from "../name" ; import { Node } from "../node" ; public export class Text extends Node { public static of ( owner , name ) { return new Text ( owner , name ) ; } private readonly _name : Option < Name > ; private constructor ( owner , name ) { super ( owner , [ ] ) ; this . _name = name ; } public get name ( ) : Option < Name > { return this . _name ; } public clone ( ) { return new Text ( this . _node , this . _name ) ; } public isIgnored ( ) { return false ; } public toJSON ( ) { return { type : "text" , node : this . _node . path ( ) , name : this . _name . map ( ( name ) => name . value ) . getOr ( null ) , children : this . _children . map ( ( child ) => child . toJSON ( ) ) , } ; } public toString ( ) { return `text "${ this . _name . map ( ( name ) => `${ name }` ) . getOr ( "" ) }"` ; } } public export namespace Text { export interface JSON extends Node . JSON { type : "text" ; name : string | null ; } }