@tanstack/table-core 8.21.2 → 8.21.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/table-core",
3
- "version": "8.21.2",
3
+ "version": "8.21.3",
4
4
  "description": "Headless UI for building powerful tables & datagrids for TS/JS.",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -10,6 +10,7 @@ import {
10
10
  } from '../types'
11
11
  import { getMemoOptions, makeStateUpdater, memo } from '../utils'
12
12
  import { ColumnPinningPosition } from './ColumnPinning'
13
+ import { safelyAccessDocument } from '../utils/document'
13
14
 
14
15
  //
15
16
 
@@ -428,8 +429,7 @@ export const ColumnSizing: TableFeature = {
428
429
  }))
429
430
  }
430
431
 
431
- const contextDocument =
432
- _contextDocument || typeof document !== 'undefined' ? document : null
432
+ const contextDocument = safelyAccessDocument(_contextDocument)
433
433
 
434
434
  const mouseEvents = {
435
435
  moveHandler: (e: MouseEvent) => onMove(e.clientX),
@@ -0,0 +1,12 @@
1
+ export function safelyAccessDocument(_document?: Document): Document | null {
2
+ return _document || (typeof document !== 'undefined' ? document : null)
3
+ }
4
+
5
+ export function safelyAccessDocumentEvent(event: Event): Document | null {
6
+ return !!event &&
7
+ !!event.target &&
8
+ typeof event.target === 'object' &&
9
+ 'ownerDocument' in event.target
10
+ ? (event.target.ownerDocument as Document | null)
11
+ : null
12
+ }