Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/renderless/src/grid/utils/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,15 @@ export const colToVisible = ($table, column, move) => {
}

export const hasDataTag = (el, value) => {
// el可能为shadow-root,shadow-root没有getAttribute方法
if (!el || !value || !el.getAttribute) {
if (!el || !value) {
return false
}

// 处理遇到 shadowRoot的情况
if (el.host) {
el = el.host
}

return (' ' + el.getAttribute('data-tag') + ' ').includes(' ' + value + ' ')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that el.getAttribute('data-tag') is not null before using it in the includes method to avoid potential runtime errors.

}

Expand Down
4 changes: 4 additions & 0 deletions packages/utils/src/popper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ const isFixed = (el: HTMLElement) => {
return true
}

// 处理遇到 shadowRoot的情况
if (el.host) {
el = el.host
}
return el.parentNode ? isFixed(el.parentNode as HTMLElement) : false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that el.parentNode is not null before passing it to isFixed to avoid potential runtime errors.

}

Expand Down
5 changes: 5 additions & 0 deletions packages/vue-hooks/src/vue-popper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ const getReferMaxZIndex = (reference) => {
do {
reference = reference.parentNode

// 处理遇到shadowRoot的情况
if (reference && reference instanceof ShadowRoot && reference.host) {
reference = reference.host
}

if (reference) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that getZIndex(reference) handles cases where reference might not have a valid z-index to avoid potential runtime errors.

z = getZIndex(reference)
} else {
Expand Down
Loading