Skip to content

Commit

Permalink
Release v0.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas C. Zakas committed Nov 15, 2011
1 parent 8e1a35d commit 0394212
Show file tree
Hide file tree
Showing 10 changed files with 433 additions and 289 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
November 15, 2011 - v0.8.5

* Updated parser (fixes #206 and fixes #209) (Nicholas C. Zakas)
* Removed extra file (Nicholas C. Zakas)

October 25, 2011 - v0.8.1

* Updated parser and fixed CLI errors (fixes #203 and fixes #205) (Nicholas C. Zakas)
Expand Down
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<project name="csslint" default="build.all">

<!-- version number -->
<property name="csslint.version" value="0.8.1" />
<property name="csslint.version" value="0.8.5" />

<!-- the directories containing the source files -->
<property name="src.dir" value="./src" />
Expand Down
135 changes: 85 additions & 50 deletions release/csslint-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/* Build time: 25-October-2011 09:25:06 */

/* Build time: 15-November-2011 07:33:18 */
/*!
Parser-Lib
Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
Expand All @@ -46,11 +45,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/* Build time: 25-October-2011 09:11:57 */
/* Build time: 1-November-2011 12:11:55 */
var parserlib = {};
(function(){


/**
* A generic base to inherit from for any object
* that needs event handling.
Expand Down Expand Up @@ -920,8 +918,6 @@ TokenStreamBase.prototype = {
};




parserlib.util = {
StringReader: StringReader,
SyntaxError : SyntaxError,
Expand All @@ -930,8 +926,6 @@ EventTarget : EventTarget,
TokenStreamBase : TokenStreamBase
};
})();


/*
Parser-Lib
Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
Expand All @@ -955,15 +949,14 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/* Build time: 25-October-2011 09:11:57 */
/* Build time: 1-November-2011 12:11:55 */
(function(){
var EventTarget = parserlib.util.EventTarget,
TokenStreamBase = parserlib.util.TokenStreamBase,
StringReader = parserlib.util.StringReader,
SyntaxError = parserlib.util.SyntaxError,
SyntaxUnit = parserlib.util.SyntaxUnit;


var Colors = {
aliceblue :"#f0f8ff",
antiquewhite :"#faebd7",
Expand Down Expand Up @@ -1143,7 +1136,6 @@ function Combinator(text, line, col){
Combinator.prototype = new SyntaxUnit();
Combinator.prototype.constructor = Combinator;


/**
* Represents a media feature, such as max-width:500.
* @namespace parserlib.css
Expand Down Expand Up @@ -1175,7 +1167,6 @@ function MediaFeature(name, value){
MediaFeature.prototype = new SyntaxUnit();
MediaFeature.prototype.constructor = MediaFeature;


/**
* Represents an individual media query.
* @namespace parserlib.css
Expand Down Expand Up @@ -1218,7 +1209,6 @@ function MediaQuery(modifier, mediaType, features, line, col){
MediaQuery.prototype = new SyntaxUnit();
MediaQuery.prototype.constructor = MediaQuery;


/**
* A CSS3 parser.
* @namespace parserlib.css
Expand Down Expand Up @@ -3396,12 +3386,22 @@ nth
['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S*
;
*/
//This file will likely change a lot! Very experimental!

var ValidationType = {

"absolute-size": function(part){
return this.identifier(part, "xx-small | x-small | small | medium | large | x-large | xx-large");
},

"attachment": function(part){
return this.identifier(part, "scroll | fixed | local");
},

"box": function(part){
return this.identifier(part, "padding-box | border-box | content-box");
},

"relative-size": function(part){
return this.identifier(part, "smaller | larger");
},
Expand Down Expand Up @@ -3449,6 +3449,10 @@ var ValidationType = {
return this.uri(part);
},

"bg-image": function(part){
return this.image(part) || part == "none";
},

"percentage": function(part){
return part.type == "percentage" || part == "0";
},
Expand Down Expand Up @@ -3483,25 +3487,25 @@ var Properties = {
"alignment-baseline": 1,
"animation": 1,
"animation-delay": 1,
"animation-direction": 1,
"animation-direction": { multi: [ "normal | alternate" ], separator: "," },
"animation-duration": 1,
"animation-fill-mode": 1,
"animation-iteration-count": 1,
"animation-iteration-count": { multi: [ "number", "infinite"], separator: "," },
"animation-name": 1,
"animation-play-state": 1,
"animation-play-state": { multi: [ "running | paused" ], separator: "," },
"animation-timing-function": 1,
"appearance": 1,
"azimuth": 1,

//B
"backface-visibility": 1,
"background": 1,
"background-attachment": [ "scroll | fixed | inherit" ],
"background-attachment": { multi: [ "attachment" ], separator: "," },
"background-break": 1,
"background-clip": 1,
"background-clip": { multi: [ "box" ], separator: "," },
"background-color": [ "color", "inherit" ],
"background-image": 1,
"background-origin": 1,
"background-image": { multi: [ "bg-image" ], separator: "," },
"background-origin": { multi: [ "box" ], separator: "," },
"background-position": 1,
"background-repeat": [ "repeat | repeat-x | repeat-y | no-repeat | inherit" ],
"background-size": 1,
Expand Down Expand Up @@ -3659,7 +3663,7 @@ var Properties = {
"line-stacking-strategy": 1,
"list-style": 1,
"list-style-image": [ "uri", "none | inherit" ],
"list-style-position": [ "inside | outsider | inherit" ],
"list-style-position": [ "inside | outside | inherit" ],
"list-style-type": [ "disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha | upper-alpha | none | inherit" ],

//M
Expand Down Expand Up @@ -3769,6 +3773,7 @@ var Properties = {
"text-indent": [ "length", "percentage", "inherit" ],
"text-justify": [ "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida" ],
"text-outline": 1,
"text-overflow": 1,
"text-shadow": 1,
"text-transform": [ "capitalize | uppercase | lowercase | none | inherit" ],
"text-wrap": [ "normal | none | avoid" ],
Expand Down Expand Up @@ -3852,8 +3857,10 @@ var Properties = {
i, len, j, count,
msg,
values,
last,
parts = value.parts;

//if there's a maximum set, use it (max can't be 0)
if (spec.max) {
if (parts.length > spec.max){
throw new ValidationError("Expected a max of " + spec.max + " property values but found " + parts.length + ".", value.line, value.col);
Expand All @@ -3867,25 +3874,45 @@ var Properties = {
for (i=0, len=parts.length; i < len; i++){
msg = [];
valid = false;
for (j=0, count=values.length; j < count; j++){
if (typeof ValidationType[values[j]] == "undefined"){
if(ValidationType.identifier(parts[i], values[j])){
valid = true;
break;
}
msg.push("one of (" + values[j] + ")");

if (spec.separator && parts[i].type == "operator"){

//two operators in a row - not allowed?
if ((last && last.type == "operator")){
msg = msg.concat(values);
} else if (i == len-1){
msg = msg.concat("end of line");
} else if (parts[i] != spec.separator){
msg.push("'" + spec.separator + "'");
} else {
if (ValidationType[values[j]](parts[i])){
valid = true;
break;
}
msg.push(values[j]);
}
valid = true;
}
} else {

for (j=0, count=values.length; j < count; j++){
if (typeof ValidationType[values[j]] == "undefined"){
if(ValidationType.identifier(parts[i], values[j])){
valid = true;
break;
}
msg.push("one of (" + values[j] + ")");
} else {
if (ValidationType[values[j]](parts[i])){
valid = true;
break;
}
msg.push(values[j]);
}
}
}


if (!valid) {
throw new ValidationError("Expected " + msg.join(" or ") + " but found '" + parts[i] + "'.", value.line, value.col);
}


last = parts[i];
}

};
Expand Down Expand Up @@ -3923,7 +3950,6 @@ PropertyName.prototype.constructor = PropertyName;
PropertyName.prototype.toString = function(){
return (this.hack ? this.hack : "") + this.text;
};

/**
* Represents a single part of a CSS property value, meaning that it represents
* just everything single part between ":" and ";". If there are multiple values
Expand Down Expand Up @@ -3952,7 +3978,6 @@ function PropertyValue(parts, line, col){
PropertyValue.prototype = new SyntaxUnit();
PropertyValue.prototype.constructor = PropertyValue;


/**
* Represents a single part of a CSS property value, meaning that it represents
* just one part of the data between ":" and ";".
Expand Down Expand Up @@ -4060,6 +4085,29 @@ function PropertyValuePart(text, line, col){
this.red = +RegExp.$1 * 255 / 100;
this.green = +RegExp.$2 * 255 / 100;
this.blue = +RegExp.$3 * 255 / 100;
} else if (/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\s*\)/i.test(text)){ //rgba() color with absolute numbers
this.type = "color";
this.red = +RegExp.$1;
this.green = +RegExp.$2;
this.blue = +RegExp.$3;
this.alpha = +RegExp.$4;
} else if (/^rgba\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)){ //rgba() color with percentages
this.type = "color";
this.red = +RegExp.$1 * 255 / 100;
this.green = +RegExp.$2 * 255 / 100;
this.blue = +RegExp.$3 * 255 / 100;
this.alpha = +RegExp.$4;
} else if (/^hsl\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)){ //hsl()
this.type = "color";
this.hue = +RegExp.$1;
this.saturation = +RegExp.$2 / 100;
this.lightness = +RegExp.$3 / 100;
} else if (/^hsla\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)){ //hsla() color with percentages
this.type = "color";
this.hue = +RegExp.$1;
this.saturation = +RegExp.$2 / 100;
this.lightness = +RegExp.$3 / 100;
this.alpha = +RegExp.$4;
} else if (/^url\(["']?([^\)"']+)["']?\)/i.test(text)){ //URI
this.type = "uri";
this.uri = RegExp.$1;
Expand Down Expand Up @@ -4144,7 +4192,6 @@ function Selector(parts, line, col){
Selector.prototype = new SyntaxUnit();
Selector.prototype.constructor = Selector;


/**
* Represents a single part of a selector string, meaning a single set of
* element name and modifiers. This does not include combinators such as
Expand Down Expand Up @@ -4186,7 +4233,6 @@ function SelectorPart(elementName, modifiers, text, line, col){
SelectorPart.prototype = new SyntaxUnit();
SelectorPart.prototype.constructor = SelectorPart;


/**
* Represents a selector modifier string, meaning a class name, element name,
* element ID, pseudo rule, etc.
Expand Down Expand Up @@ -4222,7 +4268,6 @@ function SelectorSubPart(text, type, line, col){
SelectorSubPart.prototype = new SyntaxUnit();
SelectorSubPart.prototype.constructor = SelectorSubPart;


/**
* Represents a selector's specificity.
* @namespace parserlib.css
Expand Down Expand Up @@ -4345,7 +4390,6 @@ Specificity.calculate = function(selector){
};



var h = /^[0-9a-fA-F]$/,
nonascii = /^[\u0080-\uFFFF]$/,
nl = /\n|\r\n|\r|\f/;
Expand Down Expand Up @@ -5343,7 +5387,6 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
}
});


var Tokens = [

/*
Expand Down Expand Up @@ -5550,7 +5593,6 @@ var Tokens = [




/**
* Type to use when a validation error occurs.
* @class ValidationError
Expand Down Expand Up @@ -5588,7 +5630,6 @@ function ValidationError(message, line, col){
//inherit from Error
ValidationError.prototype = new Error();


parserlib.css = {
Colors :Colors,
Combinator :Combinator,
Expand All @@ -5607,9 +5648,6 @@ Tokens :Tokens,
ValidationError :ValidationError
};
})();



/**
* Main CSSLint object.
* @class CSSLint
Expand All @@ -5623,7 +5661,7 @@ var CSSLint = (function(){
formatters = [],
api = new parserlib.util.EventTarget();

api.version = "0.8.1";
api.version = "0.8.5";

//-------------------------------------------------------------------------
// Rule Management
Expand Down Expand Up @@ -5791,7 +5829,6 @@ var CSSLint = (function(){
return api;

})();

/*global CSSLint*/
/**
* An instance of Report is used to report results of the
Expand Down Expand Up @@ -8148,6 +8185,4 @@ CSSLint.addFormatter({
}
});


exports.CSSLint = CSSLint;

Loading

0 comments on commit 0394212

Please sign in to comment.