-
问题描述
今天用CSS模块分析一个css文件时发生错误:Invalid or unexpected property ' /** background: url("img.png") ' in style '#qtd' at /opt/ActivePerl-5.12/site/lib/CSS.pm line 76
perl代码如下#!/usr/local/bin/perl -w use 5.010; use strict; use warnings; use CSS; my $css = CSS->new(); $css->read_file( 'myStylesheet.css' );
myStylesheet.css内容如下
#qtd{ /** background: url("img.png") ; height: 34px; width: 271px; */ font:bold 18px Arial; color:#666666; padding:3px 0 4px; }
结合CSS.pm代码及错误信息分析发现CSS模块删除css注释的代码存在bug,无法跨行注释,导致后续解析.CSS文件时出错
-
bug修改
将
s!/\*.*?\*\/!!g;
改为
s!/\*.*?\*\/!!sg;
即可
修改CPAN中CSS模块的一处bug
最新推荐文章于 2023-04-19 19:59:38 发布