Extracts and prepares an icon element (SVG or IMG) from a container
Searches for SVG or IMG elements within a container and applies custom color if specified. Returns null if no icon is found.
The container element to search
The icon element (SVG or IMG) or null if not found
const container = document.createElement('div');const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');svg.setAttribute('color', '#ff0000');container.appendChild(svg);const icon = extractIconElement({ element: container });// Returns the SVG element with color applied Copy
const container = document.createElement('div');const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');svg.setAttribute('color', '#ff0000');container.appendChild(svg);const icon = extractIconElement({ element: container });// Returns the SVG element with color applied
Extracts and prepares an icon element (SVG or IMG) from a container
Searches for SVG or IMG elements within a container and applies custom color if specified. Returns null if no icon is found.