fix(datetime): can participate in native <form> (#16106)

fixes #16075
This commit is contained in:
Manu MA
2018-10-26 19:01:39 +02:00
committed by GitHub
parent c982856dba
commit aad7711af2
5 changed files with 22 additions and 6 deletions

View File

@ -21,7 +21,7 @@ export function hasShadowDom(el: HTMLElement) {
return !!el.shadowRoot && !!(el as any).attachShadow;
}
export function renderHiddenInput(container: HTMLElement, name: string, value: string, disabled: boolean) {
export function renderHiddenInput(container: HTMLElement, name: string, value: string | undefined | null, disabled: boolean) {
if (hasShadowDom(container)) {
let input = container.querySelector('input.aux-input') as HTMLInputElement | null;
if (!input) {
@ -32,7 +32,7 @@ export function renderHiddenInput(container: HTMLElement, name: string, value: s
}
input.disabled = disabled;
input.name = name;
input.value = value;
input.value = value || '';
}
}