【问题标题】:Updating policy file with html5 and css3使用 html5 和 css3 更新策略文件
【发布时间】:2014-01-04 14:46:33
【问题描述】:

我们一直在为我们的产品使用 antisamy,但现在有了新的 HTML5 标签和 css3 样式,它成为了一个痛点,允许使用具有定义值的特定样式。

有没有完全支持新标签和样式的开源反反义政策文件。所有在线提供的开放式反叛政策文件都不支持 HTML5 和 CSS3。

另一种选择

如果我必须去更改策略文件以调整所有 HTML5 标记和 CSS3 样式,有没有一种方法可以调整样式,这样我至少不必调整浏览器前缀。对于下面的例子,如果我们有办法让浏览器半径为“-moz-border-radius”或“-webkit-border-radius”或“border-radius”

例如。

<common-attributes>
    <attribute name="border-radius" description="The 'id' of any HTML attribute should not contain anything besides letters and numbers">
    <regexp-list>
    <regexp value="<regular-expression>"/>
    </regexp-list>
    </attribute>
</common-attributes>

【问题讨论】:

    标签: antisamy


    【解决方案1】:

    作为这个 css 属性,您可以在 css-rules 部分中定义。此外,根据 w3schools,border-radius 属性接受长度或百分比,因此您可以使用已经可用的正则表达式长度和百分比。

    <property name="border-radius" description="This property allows you to add rounded borders to elements">
        <regexp-list>
                                    <regexp name="percentage"/>
                                    <regexp name="length"/>
        </regexp-list>
    </property>
    

    【讨论】:

    • 我的问题不是关于添加正则表达式,而是关于如何处理具有不同浏览器前缀的属性,例如。 “-moz”、“-webkit”、“-o”等我想避免做类似“ " etc 对于所有 css 属性。
    猜你喜欢
    • 1970-01-01
    • 2013-02-17
    • 1970-01-01
    • 2023-03-16
    • 2011-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-07
    相关资源
    最近更新 更多