MCPcopy
hub / github.com/tinymce/tinymce / getSize

Function getSize

modules/tinymce/src/core/main/ts/api/dom/DOMUtils.ts:495–519  ·  view source on GitHub ↗
(elm: HTMLElement | string | null)

Source from the content-addressed store, hash-verified

493 };
494
495 const getSize = (elm: HTMLElement | string | null): { w: number; h: number } => {
496 const $elm = get(elm);
497
498 if (!$elm) {
499 return { w: 0, h: 0 };
500 }
501
502 let w = getStyle($elm, 'width');
503 let h = getStyle($elm, 'height');
504
505 // Non pixel value, then force offset/clientWidth
506 if (!w || w.indexOf('px') === -1) {
507 w = '0';
508 }
509
510 // Non pixel value, then force offset/clientWidth
511 if (!h || h.indexOf('px') === -1) {
512 h = '0';
513 }
514
515 return {
516 w: parseInt(w, 10) || $elm.offsetWidth || $elm.clientWidth,
517 h: parseInt(h, 10) || $elm.offsetHeight || $elm.clientHeight
518 };
519 };
520
521 const getRect = (elm: string | HTMLElement): GeomRect => {
522 const $elm = get(elm);

Callers 2

getRectFunction · 0.70
measureTableFunction · 0.50

Calls 2

getFunction · 0.70
getStyleFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…