diff --git a/src/svg/graphic.ts b/src/svg/graphic.ts index 8f9c08b3..09601496 100644 --- a/src/svg/graphic.ts +++ b/src/svg/graphic.ts @@ -79,8 +79,7 @@ function setMetaData(attrs: SVGVNodeAttrs, el: Path | TSpan | ZRImage) { const metaData = getElementSSRData(el); if (metaData) { metaData.each((val, key) => { - attrs[(META_DATA_PREFIX + key).toLowerCase()] - = val + ''; + val != null && (attrs[(META_DATA_PREFIX + key).toLowerCase()] = val + ''); }); if (el.isSilent()) { attrs[META_DATA_PREFIX + 'silent'] = 'true'; diff --git a/src/zrender.ts b/src/zrender.ts index 225ca75c..acafbbff 100644 --- a/src/zrender.ts +++ b/src/zrender.ts @@ -541,9 +541,7 @@ export function registerPainter(name: string, Ctor: PainterBaseCtor) { export type ElementSSRData = zrUtil.HashMap; export type ElementSSRDataGetter = (el: Element) => zrUtil.HashMap; -let ssrDataGetter = function (el: Element): ElementSSRData { - return null; -} +let ssrDataGetter: ElementSSRDataGetter; export function getElementSSRData(el: Element): ElementSSRData { if (typeof ssrDataGetter === 'function') {