import { BoundItemAttribute } from "../BoundItemAttribute" ; import { UkuleleUtil } from "../../util/UkuleleUtil" ; export class BoundItemAttrDataItem extends BoundItemAttribute { constructor ( attrName , ukuTag , element , uku ) { if ( ukuTag !== "data-item" ) { throw new TypeError ( "it doesn't use uku-item" ) ; } super ( attrName , ukuTag , element , uku ) ; } render ( controllers ) { let attr = this . attributeName ; let elementName = this . element . tagName ; let finalValue = UkuleleUtil . getFinalValue ( controllers , attr ) ; if ( elementName === "OPTION" ) { finalValue = JSON . stringify ( finalValue ) ; this . element . setAttribute ( 'data-item' , finalValue ) ; } } }