@@ -37,13 +37,13 @@ CSSLint.addRule({
3737 }
3838
3939 function endRule ( ) {
40- var prop ;
40+ var prop , value ;
4141 if ( properties . height ) {
4242 for ( prop in heightProperties ) {
4343 if ( heightProperties . hasOwnProperty ( prop ) && properties [ prop ] ) {
44-
44+ value = properties [ prop ] . value ;
4545 //special case for padding
46- if ( ! ( prop == "padding" && properties [ prop ] . value . parts . length === 2 && properties [ prop ] . value . parts [ 0 ] . value === 0 ) ) {
46+ if ( ! ( prop == "padding" && value . parts . length === 2 && value . parts [ 0 ] . value === 0 ) ) {
4747 reporter . report ( "Using height with " + prop + " can sometimes make elements larger than you expect." , properties [ prop ] . line , properties [ prop ] . col , rule ) ;
4848 }
4949 }
@@ -53,8 +53,9 @@ CSSLint.addRule({
5353 if ( properties . width ) {
5454 for ( prop in widthProperties ) {
5555 if ( widthProperties . hasOwnProperty ( prop ) && properties [ prop ] ) {
56-
57- if ( ! ( prop == "padding" && properties [ prop ] . value . parts . length === 2 && properties [ prop ] . value . parts [ 1 ] . value === 0 ) ) {
56+ value = properties [ prop ] . value ;
57+
58+ if ( ! ( prop == "padding" && value . parts . length === 2 && value . parts [ 1 ] . value === 0 ) ) {
5859 reporter . report ( "Using width with " + prop + " can sometimes make elements larger than you expect." , properties [ prop ] . line , properties [ prop ] . col , rule ) ;
5960 }
6061 }
@@ -76,7 +77,7 @@ CSSLint.addRule({
7677 properties [ name ] = { line : event . property . line , col : event . property . col , value : event . value } ;
7778 }
7879 } else {
79- if ( name == " width" || name == "height" ) {
80+ if ( / ^ ( w i d t h | h e i g h t ) / i . test ( name ) && / ^ ( l e n g t h | p e r c e n t a g e ) / . test ( event . value . parts [ 0 ] . type ) ) {
8081 properties [ name ] = 1 ;
8182 }
8283 }
0 commit comments