MCPcopy Index your code
hub / github.com/SortableJS/Sortable / getContentRect

Function getContentRect

src/utils.js:261–275  ·  view source on GitHub ↗

* Returns the content rect of the element (bounding rect minus border and padding) * @param {HTMLElement} el

(el)

Source from the content-addressed store, hash-verified

259 * @param {HTMLElement} el
260 */
261function getContentRect(el) {
262 let rect = getRect(el);
263 const paddingLeft = parseInt(css(el, 'padding-left')),
264 paddingTop = parseInt(css(el, 'padding-top')),
265 paddingRight = parseInt(css(el, 'padding-right')),
266 paddingBottom = parseInt(css(el, 'padding-bottom'));
267 rect.top += paddingTop + parseInt(css(el, 'border-top-width'));
268 rect.left += paddingLeft + parseInt(css(el, 'border-left-width'));
269 // Client Width/Height includes padding only
270 rect.width = el.clientWidth - paddingLeft - paddingRight;
271 rect.height = el.clientHeight - paddingTop - paddingBottom;
272 rect.bottom = rect.top + rect.height;
273 rect.right = rect.left + rect.width;
274 return rect;
275}
276
277/**
278 * Checks if a side of an element is scrolled past a side of its parents

Callers

nothing calls this directly

Calls 2

getRectFunction · 0.70
cssFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…