From 87e293e33f853393786454cdf58d3b03011f041d Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Mon, 27 Dec 2010 23:04:50 -0500 Subject: [PATCH] Property keyword parser now simply checks for spaces (to be flexible enough to support any keywords in the future) --- lib/prop_parser.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/prop_parser.js b/lib/prop_parser.js index d3776be..76903e9 100644 --- a/lib/prop_parser.js +++ b/lib/prop_parser.js @@ -38,20 +38,18 @@ exports.parse = function ( prop ) prop = ''+( prop ); - if ( prop.length > 8 ) + // only perform parsing if the string contains a space + if ( / /.test( prop ) ) { - if ( prop[ 8 ] === ' ' ) - { - // the keywords are all words, except for the last, which is the - // property name - keywords = prop.split( ' ' ); - name = keywords.pop(); + // the keywords are all words, except for the last, which is the + // property name + keywords = prop.split( ' ' ); + name = keywords.pop(); - var i = keywords.length; - while ( i-- ) - { - keyword_obj[ keywords[ i ] ] = true; - } + var i = keywords.length; + while ( i-- ) + { + keyword_obj[ keywords[ i ] ] = true; } }