summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
da1c49e)
Since commit 6817108 (rss_converter_twitter.com.xsl: strip the style
attribute from HTML elements, 2017-06-08) the twitter.com stylesheet
removes the "style" attribute from elements when copying them.
This is in order to create a more visually neutral output, but also
because the style attribute may even contain dangerous content:
https://validator.w3.org/feed/docs/warning/DangerousStyleAttr.html
However someone who reads the code may not be familiar with (or have
forgotten) why this is done, so explain that in a comment to avoid them
the burden of digging in the project history.
<!-- Identity transform -->
<xsl:template match="@*|node()">
<xsl:copy>
<!-- Identity transform -->
<xsl:template match="@*|node()">
<xsl:copy>
+ <!--
+ Strip the style attribute while copying elements because it may be
+ dangerous, see:
+ https://validator.w3.org/feed/docs/warning/DangerousStyleAttr.html
+ -->
<xsl:apply-templates select="@*[not(name() = 'style')]|node()"/>
</xsl:copy>
</xsl:template>
<xsl:apply-templates select="@*[not(name() = 'style')]|node()"/>
</xsl:copy>
</xsl:template>