From 0bd0d8b9e02a66d3698dee7d1690993835f9fb29 Mon Sep 17 00:00:00 2001 From: gimmyhehe <975402925@qq.com> Date: Fri, 26 Apr 2024 16:03:58 +0800 Subject: [PATCH] fix(grid): [grid] fix shadow-root does not have getAttribute function (#1593) --- packages/renderless/src/grid/utils/dom.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/renderless/src/grid/utils/dom.ts b/packages/renderless/src/grid/utils/dom.ts index 920536b62..80ca272e9 100644 --- a/packages/renderless/src/grid/utils/dom.ts +++ b/packages/renderless/src/grid/utils/dom.ts @@ -179,7 +179,10 @@ export const colToVisible = ($table, column, move) => { } export const hasDataTag = (el, value) => { - if (!el || !value) return false + // el可能为shadow-root,shadow-root没有getAttribute方法 + if (!el || !value || !el.getAttribute) { + return false + } return (' ' + el.getAttribute('data-tag') + ' ').includes(' ' + value + ' ') }