2010-12-13 79 views
1

這裏有一個jQuery插件來驗證CSS?使用jquery格式化和驗證CSS

我的意思是,我喜歡讓用戶輸入自己的CSS在文本框中,並驗證是否是有效的CSS與jQuery?

例如:

@font-face { 
    font-family: 'NationalRegular'; 
    src: url('http://localced.com/national-regular-webfont.eot'); 
    src: local('National'), local('NationalRegular'), url('http://localced.com/national-regular-webfont.woff') format('woff'), url('http://localced.com/national-regular-webfont.ttf') format('truetype'), url('http://localced.com/national-regular-webfont.svg#webfontHGfqMJAZ') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
***notgoodCSS***:this is not good; 
} 

回答

1

在您自己的服務器上使用W3C驗證程序。

執行命令行並將結果返回給jquery(通過Ajax調用)。

http://jigsaw.w3.org/css-validator/DOWNLOAD.html

+1

然後你就可以用自己的SOAP API:http://jigsaw.w3.org/css-validator/api.html – 2010-12-13 22:15:58

0

我不知道關於jQuery的,但是你知道有關W3C CSS Validation Service?你可以輸入一個URL到一個CSS文件,它會驗證它是有效還是無效,並告訴你如何糾正它。