import deindent from '../../utils/deindent'; import { stringify, escapeHTML } from '../../utils/stringify'; import flattenReference from '../../utils/flattenReference'; import isVoidElementName from '../../utils/isVoidElementName'; import validCalleeObjects from '../../utils/validCalleeObjects'; import reservedNames from '../../utils/reservedNames'; import fixAttributeCasing from '../../utils/fixAttributeCasing'; import quoteIfNecessary from '../../utils/quoteIfNecessary'; import Node from './shared/Node'; import Block from '../dom/Block'; import Attribute from './Attribute'; import Binding from './Binding'; import EventHandler from './EventHandler'; import Ref from './Ref'; import Transition from './Transition'; import Action from './Action'; import Text from './Text'; import * as namespaces from '../../utils/namespaces'; import mapChildren from './shared/mapChildren'; export default class Element extends Node { type: 'Element'; name: string; scope: any; // TODO attributes: Attribute[]; actions: Action[]; bindings: Binding[]; handlers: EventHandler[]; intro: Transition; outro: Transition; children: Node[]; ref: string; namespace: string; constructor(compiler, parent, scope, info: any) { super(compiler, parent, scope, info); this.name = info.name; this.scope = scope; const parentElement = parent.findNearest(/^Element/); this.namespace = this.name === 'svg' ? namespaces.svg : parentElement ? parentElement.namespace : this.compiler.namespace; this.attributes = []; this.actions = []; this.bindings = []; this.handlers = []; this.intro = null; this.outro = null; if (this.name === 'textarea') { // this is an egregious hack, but it's the easiest way to get