From 4d143a03dcdd2f5fcccf77115b6426435aaf4a31 Mon Sep 17 00:00:00 2001 From: tophf Date: Thu, 6 Apr 2017 16:02:38 +0300 Subject: [PATCH] Apply styles to XML documents --- apply.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apply.js b/apply.js index d0302891..73a4e3a9 100644 --- a/apply.js +++ b/apply.js @@ -246,6 +246,8 @@ function applySections(styleId, sections) { if (document.documentElement instanceof SVGSVGElement) { // SVG document, make an SVG style element. el = document.createElementNS('http://www.w3.org/2000/svg', 'style'); + } else if (document instanceof XMLDocument) { + el = document.createElementNS('http://www.w3.org/1999/xhtml', 'style'); } else { // This will make an HTML style element. If there's SVG embedded in an HTML document, this works on the SVG too. el = document.createElement('style');