禁用所有Joomla 3.0内联样式

时间:2013-08-28 12:52:58

标签: css joomla joomla-extensions joomla3.0

我需要为所有内容禁用所有joomla内联样式。

我的查询与文本编辑器无关。 在大多数情况下,我根本没有使用内联样式。

它确实让我回到了当前带有自定义模板的项目。

任何解决方案?还是插件? (我已经搜查过)

2 个答案:

答案 0 :(得分:0)

请注意,这将从所有元素中删除内联“样式”属性:

<script type="text/javascript">
(function($){
    $(document).ready(function(){
       $(this).find("*").removeAttr("style");
    });
})(jQuery);
</script>

为了绝对有效,请将它放在</body>标记之前,以防万一你可能有任何其他jQuery脚本向元素中添加css(“something”)。

答案 1 :(得分:0)

这是一个简单的插件,您可以运行并使用它来查找哪些元素包含哪些属性,例如,类,样式,标题,宽度等。 在http://jsfiddle.net/SyFum/2/

处小提琴
<script type="text/javascript">
    (function ($) {
        $( document ).ready( function () {

            /**
             * Highlight all elements that contain an attribute
             * @param attributeToSearch string The attribute to be found
             * @returns {*} The elements, containing the attribute, bordered
             */
            $.fn.StyleHighlighter = function (attributeToSearch) {
                // set the defaults
                var defaults = {
                    attributeToSearch : "style"
                };

                $( this ).find( "*" ).each( function () {

                    if ($( this ).attr( attributeToSearch ))
                    {
                        $( this ).css( "border", "1px dashed #ff0000" );
                    }
                } );
                return this;
            };

            // Usage (style, class, title, whatever)
            $( this ).StyleHighlighter( "style" );
        } );
    })( jQuery );
    </script>
相关问题