MCPcopy Create free account
hub / github.com/apitable/apitable / getElementDataset

Function getElementDataset

packages/datasheet/src/pc/utils/dom.ts:116–130  ·  view source on GitHub ↗
(element: HTMLElement | null | undefined, key: string)

Source from the content-addressed store, hash-verified

114}
115
116export function getElementDataset(element: HTMLElement | null | undefined, key: string) {
117 if (!element) {
118 return null;
119 }
120 if (!element.dataset) {
121 // If the browser is not compatible with HTMLElement.dataset, try to use getAttribute to get
122 const attrKey = 'data-' + key.replace(/([A-Z])/g, '-$1').toLowerCase();
123 const dataset = element.getAttribute(attrKey);
124 if (dataset) {
125 return dataset;
126 }
127 return null;
128 }
129 return element.dataset[key];
130}
131
132export function stopPropagation(e: React.SyntheticEvent) {
133 e.stopPropagation();

Callers 15

ToolbarFunction · 0.90
handleSelectFunction · 0.90
InsertPanelFunction · 0.90
SelectFunction · 0.90
moveHandleMouseDownFunction · 0.90
index.tsxFile · 0.90
dragMoveForFieldFunction · 0.90
dragMoveForRecordFunction · 0.90
_getIdMapByEventFunction · 0.90
changeColumnWidthFunction · 0.90
onHeaderClickFunction · 0.90
onGridClickFunction · 0.90

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected