[Webkit-unassigned] [Bug 159401] When copying embedded SVG, CSS is not retained.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jul 4 04:18:27 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=159401

--- Comment #6 from Samuel Williams <samuel at oriontransfer.org> ---
Managed to work around the issue by traversing the SVG DOM and using getComputedStyle to apply fill and other related CSS properties as inline styles. Then, copying works.

Here is a simple example of the code I used:

function embedSVGStyle(element) {
    Array.prototype.forEach.call(element.children, function(child) {
        embedSVGStyle(child);
    });

    var computedStyle = getComputedStyle(element);
    element.style.fill = computedStyle.fill;
}

Attached is a picture showing it working.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160704/3f054bea/attachment.html>


More information about the webkit-unassigned mailing list