MCPcopy
hub / github.com/tinymce/tinymce / getAttrib

Function getAttrib

modules/tinymce/src/core/main/ts/api/dom/DOMUtils.ts:382–398  ·  view source on GitHub ↗
(elm: string | Element | null, name: string, defaultVal: string = '')

Source from the content-addressed store, hash-verified

380 };
381
382 const getAttrib = (elm: string | Element | null, name: string, defaultVal: string = ''): string => {
383 let value: string | undefined;
384
385 const $elm = _get(elm);
386
387 if (Type.isNonNullable($elm) && SugarNode.isElement($elm)) {
388 const hook = attrHooks[name];
389
390 if (hook && hook.get) {
391 value = hook.get($elm.dom, name);
392 } else {
393 value = Attribute.get($elm, name);
394 }
395 }
396
397 return Type.isNonNullable(value) ? value : defaultVal;
398 };
399
400 const getAttribs = (elm: string | Element): NamedNodeMap | Attr[] => {
401 const node = get(elm);

Callers 1

renameFunction · 0.70

Calls 2

_getFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…