The parent element containing the slot
Cloned image element or null if invalid
const container = document.createElement('div');
const img = document.createElement('img');
img.src = 'image.jpg';
img.alt = 'Description';
img.setAttribute('slot', 'image');
container.appendChild(img);
const validImage = getValidatedSlotImage({ element: container, slotName: 'image' });
// Returns cloned image element
Retrieves and validates an image from a slot element
Checks if the slot contains a valid image with alt text, and returns a clone of the image if valid.