MCPcopy Create free account
hub / github.com/pbakaus/impeccable / documentRefForElement

Function documentRefForElement

skill/scripts/live-browser.js:3475–3490  ·  view source on GitHub ↗
(el)

Source from the content-addressed store, hash-verified

3473 }
3474
3475 function documentRefForElement(el) {
3476 if (!el || el.nodeType !== 1) return null;
3477 const parts = [];
3478 let cur = el;
3479 while (cur && cur.nodeType === 1) {
3480 const tag = cur.tagName.toLowerCase();
3481 if (tag === 'html') break;
3482 if (tag === 'body') {
3483 parts.unshift('body');
3484 break;
3485 }
3486 parts.unshift(documentRefSegment(cur));
3487 cur = cur.parentElement;
3488 }
3489 return parts.join('>') || null;
3490 }
3491
3492 function documentRefSegment(el) {
3493 const tag = el.tagName.toLowerCase();

Callers 6

visitFunction · 0.70
copyEditLeafContextFunction · 0.70
copyEditContainerContextFunction · 0.70
applyEditingFunction · 0.70
mixedTextWrapRestoreHintFunction · 0.70

Calls 1

documentRefSegmentFunction · 0.70

Tested by

no test coverage detected