import { BoundItemAttribute } from "../BoundItemAttribute" ; import { UkuleleUtil } from "../../util/UkuleleUtil" ; export class BoundItemAttrSrc extends BoundItemAttribute { constructor ( attrName , ukuTag , element , uku ) { if ( ukuTag !== "src" ) { throw new TypeError ( "it doesn't use uku-src" ) ; } super ( attrName , ukuTag , element , uku ) ; } render ( controllers ) { let attr = this . attributeName ; let elementName = this . element . tagName ; let finalValue = UkuleleUtil . getFinalValue ( controllers , attr ) ; if ( elementName === "IMG" || elementName === "VIDEO" || elementName === "AUDIO" ) { if ( finalValue ) { this . element . setAttribute ( this . ukuTag , finalValue ) ; } } else { throw new Error ( "uku-src doesn't work with current dom" ) ; } } }