webcomponents/shadycss

Error scoping <template> in <svg> context

Closed this issue · 0 comments

When a <template> element is parsed in <svg> context, it is not actually an HTMLTemplateElement with a .content property, and this code called from the context of prepareTemplate on such a template throws trying to dereference it: https://github.com/webcomponents/shadycss/blob/master/src/style-transformer.js#L59

Since downstream code may want to "prollyfill" a <template> in svg context to turn it into an actual template with content, shadycss should be defensive to <template> elements that are not HTMLTemplateElements.

Repro:

http://jsbin.com/himoceb/edit?html,console,output