Skip to content

Commit 641c52a

Browse files
committed
Make sure line numbers are correct for vendor-prefix rule (fixes #238)
1 parent 66c1baa commit 641c52a

File tree

13 files changed

+472
-314
lines changed

13 files changed

+472
-314
lines changed

CHANGELOG

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
February 3, 2012 - v0.9.5
23

34
* Ensure time values are properly checked (fixes #228) (Nicholas C. Zakas)
@@ -8,7 +9,6 @@ February 3, 2012 - v0.9.5
89
* Merge pull request #225 from Zearin/master (Nicholas C. Zakas)
910
* Added 2-space indentation for output of `--list-rules`. (Tony)
1011

11-
1212
January 5, 2012 - v0.9.2
1313

1414
* More validations fixes (fixes #219) (Nicholas C. Zakas)
@@ -237,6 +237,8 @@ June 15, 2011 - v0.1.0
237237

238238

239239

240+
241+
240242

241243

242244

build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<project name="csslint" default="build.all">
22

33
<!-- version number -->
4-
<property name="csslint.version" value="0.9.5" />
4+
<property name="csslint.version" value="0.9.6" />
55

66
<!-- the directories containing the source files -->
77
<property name="src.dir" value="./src" />

release/csslint-node.js

Lines changed: 75 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
2222
2323
*/
24-
/* Build time: 3-February-2012 11:27:02 */
24+
/* Build time: 10-February-2012 02:23:58 */
2525

2626
/*!
2727
Parser-Lib
@@ -46,7 +46,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4646
THE SOFTWARE.
4747
4848
*/
49-
/* Version v0.1.4, Build time: 31-January-2012 10:55:24 */
49+
/* Version v0.1.5, Build time: 10-February-2012 12:59:26 */
5050
var parserlib = {};
5151
(function(){
5252

@@ -956,7 +956,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
956956
THE SOFTWARE.
957957
958958
*/
959-
/* Version v0.1.4, Build time: 31-January-2012 10:55:24 */
959+
/* Version v0.1.5, Build time: 10-February-2012 12:59:26 */
960960
(function(){
961961
var EventTarget = parserlib.util.EventTarget,
962962
TokenStreamBase = parserlib.util.TokenStreamBase,
@@ -3624,6 +3624,7 @@ var Properties = {
36243624
"border-right-color" : "<color> | inherit",
36253625
"border-right-style" : "<border-style>",
36263626
"border-right-width" : "<border-width>",
3627+
"border-spacing" : { multi: "<length> | inherit", max: 2 },
36273628
"border-style" : { multi: "<border-style>", max: 4 },
36283629
"border-top" : "<border-width> || <border-style> || <color>",
36293630
"border-top-color" : "<color> | inherit",
@@ -5563,7 +5564,7 @@ var Tokens = [
55635564
//{ name: "ATKEYWORD"},
55645565

55655566
//CSS3 animations
5566-
{ name: "KEYFRAMES_SYM", text: [ "@keyframes", "@-webkit-keyframes", "@-moz-keyframes" ] },
5567+
{ name: "KEYFRAMES_SYM", text: [ "@keyframes", "@-webkit-keyframes", "@-moz-keyframes", "@-ms-keyframes" ] },
55675568

55685569
//important symbol
55695570
{ name: "IMPORTANT_SYM"},
@@ -6303,7 +6304,7 @@ var CSSLint = (function(){
63036304
formatters = [],
63046305
api = new parserlib.util.EventTarget();
63056306

6306-
api.version = "0.9.5";
6307+
api.version = "0.9.6";
63076308

63086309
//-------------------------------------------------------------------------
63096310
// Rule Management
@@ -6633,48 +6634,68 @@ Reporter.prototype = {
66336634

66346635
//expose for testing purposes
66356636
CSSLint._Reporter = Reporter;
6636-
/*
6637-
* Utility functions that make life easier.
6638-
*/
6637+
6638+
/*global CSSLint*/
66396639

66406640
/*
6641-
* Adds all properties from supplier onto receiver,
6642-
* overwriting if the same name already exists on
6643-
* reciever.
6644-
* @param {Object} The object to receive the properties.
6645-
* @param {Object} The object to provide the properties.
6646-
* @return {Object} The receiver
6641+
* Utility functions that make life easier.
66476642
*/
6648-
function mix(receiver, supplier){
6649-
var prop;
6643+
CSSLint.Util = {
6644+
/*
6645+
* Adds all properties from supplier onto receiver,
6646+
* overwriting if the same name already exists on
6647+
* reciever.
6648+
* @param {Object} The object to receive the properties.
6649+
* @param {Object} The object to provide the properties.
6650+
* @return {Object} The receiver
6651+
*/
6652+
mix: function(receiver, supplier){
6653+
var prop;
66506654

6651-
for (prop in supplier){
6652-
if (supplier.hasOwnProperty(prop)){
6653-
receiver[prop] = supplier[prop];
6655+
for (prop in supplier){
6656+
if (supplier.hasOwnProperty(prop)){
6657+
receiver[prop] = supplier[prop];
6658+
}
66546659
}
6655-
}
66566660

6657-
return prop;
6658-
}
6661+
return prop;
6662+
},
66596663

6660-
/*
6661-
* Polyfill for array indexOf() method.
6662-
* @param {Array} values The array to search.
6663-
* @param {Variant} value The value to search for.
6664-
* @return {int} The index of the value if found, -1 if not.
6665-
*/
6666-
function indexOf(values, value){
6667-
if (values.indexOf){
6668-
return values.indexOf(value);
6669-
} else {
6670-
for (var i=0, len=values.length; i < len; i++){
6671-
if (values[i] === value){
6672-
return i;
6664+
/*
6665+
* Polyfill for array indexOf() method.
6666+
* @param {Array} values The array to search.
6667+
* @param {Variant} value The value to search for.
6668+
* @return {int} The index of the value if found, -1 if not.
6669+
*/
6670+
indexOf: function(values, value){
6671+
if (values.indexOf){
6672+
return values.indexOf(value);
6673+
} else {
6674+
for (var i=0, len=values.length; i < len; i++){
6675+
if (values[i] === value){
6676+
return i;
6677+
}
6678+
}
6679+
return -1;
6680+
}
6681+
},
6682+
6683+
/*
6684+
* Polyfill for array forEach() method.
6685+
* @param {Array} values The array to operate on.
6686+
* @param {Function} func The function to call on each item.
6687+
* @return {void}
6688+
*/
6689+
forEach: function(values, func) {
6690+
if (values.forEach){
6691+
return values.forEach(func);
6692+
} else {
6693+
for (var i=0, len=values.length; i < len; i++){
6694+
func(values[i], i, values);
66736695
}
66746696
}
6675-
return -1;
66766697
}
6677-
}
6698+
};
66786699
/*global CSSLint*/
66796700
/*
66806701
* Rule: Don't use adjoining classes (.foo.bar).
@@ -6928,6 +6949,7 @@ CSSLint.addRule({
69286949
"writing-mode" : "epub ms"
69296950
};
69306951

6952+
69316953
for (prop in compatiblePrefixes) {
69326954
if (compatiblePrefixes.hasOwnProperty(prop)) {
69336955
variations = [];
@@ -6944,8 +6966,8 @@ CSSLint.addRule({
69446966
});
69456967

69466968
parser.addListener("property", function (event) {
6947-
var name = event.property.text;
6948-
if (applyTo.indexOf(name) > -1) {
6969+
var name = event.property;
6970+
if (CSSLint.Util.indexOf(applyTo, name.text) > -1) {
69496971
properties.push(name);
69506972
}
69516973
});
@@ -6973,15 +6995,17 @@ CSSLint.addRule({
69736995
for (prop in compatiblePrefixes) {
69746996
if (compatiblePrefixes.hasOwnProperty(prop)) {
69756997
variations = compatiblePrefixes[prop];
6976-
if (variations.indexOf(name) > -1) {
6977-
if (propertyGroups[prop] === undefined) {
6998+
if (CSSLint.Util.indexOf(variations, name.text) > -1) {
6999+
if (!propertyGroups[prop]) {
69787000
propertyGroups[prop] = {
69797001
full : variations.slice(0),
6980-
actual : []
7002+
actual : [],
7003+
actualNodes: []
69817004
};
69827005
}
6983-
if (propertyGroups[prop].actual.indexOf(name) === -1) {
6984-
propertyGroups[prop].actual.push(name);
7006+
if (CSSLint.Util.indexOf(propertyGroups[prop].actual, name.text) === -1) {
7007+
propertyGroups[prop].actual.push(name.text);
7008+
propertyGroups[prop].actualNodes.push(name);
69857009
}
69867010
}
69877011
}
@@ -6997,9 +7021,9 @@ CSSLint.addRule({
69977021
if (full.length > actual.length) {
69987022
for (i = 0, len = full.length; i < len; i++) {
69997023
item = full[i];
7000-
if (actual.indexOf(item) === -1) {
7024+
if (CSSLint.Util.indexOf(actual, item) === -1) {
70017025
propertiesSpecified = (actual.length === 1) ? actual[0] : (actual.length == 2) ? actual.join(" and ") : actual.join(", ");
7002-
reporter.report("The property " + item + " is compatible with " + propertiesSpecified + " and should be included as well.", event.selectors[0].line, event.selectors[0].col, rule);
7026+
reporter.report("The property " + item + " is compatible with " + propertiesSpecified + " and should be included as well.", value.actualNodes[0].line, value.actualNodes[0].col, rule);
70037027
}
70047028
}
70057029

@@ -8709,7 +8733,7 @@ CSSLint.addFormatter({
87098733

87108734
if (messages.length > 0) {
87118735
output.push("<file name=\""+filename+"\">");
8712-
messages.forEach(function (message, i) {
8736+
CSSLint.Util.forEach(messages, function (message, i) {
87138737
//ignore rollups for now
87148738
if (!message.rollup) {
87158739
output.push("<error line=\"" + message.line + "\" column=\"" + message.col + "\" severity=\"" + message.type + "\"" +
@@ -8769,7 +8793,7 @@ CSSLint.addFormatter({
87698793
return options.quiet ? "" : filename + ": Lint Free!";
87708794
}
87718795

8772-
messages.forEach(function(message, i) {
8796+
CSSLint.Util.forEach(messages, function(message, i) {
87738797
if (message.rollup) {
87748798
output += filename + ": " + capitalize(message.type) + " - " + message.message + "\n";
87758799
} else {
@@ -8834,7 +8858,7 @@ CSSLint.addFormatter({
88348858

88358859
if (messages.length > 0) {
88368860
output.push("<file name=\""+filename+"\">");
8837-
messages.forEach(function (message, i) {
8861+
CSSLint.Util.forEach(messages, function (message, i) {
88388862
if (message.rollup) {
88398863
output.push("<issue severity=\"" + message.type + "\" reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>");
88408864
} else {
@@ -8902,7 +8926,7 @@ CSSLint.addFormatter({
89028926
if (messages.length > 0) {
89038927

89048928
output.push("<file name=\""+filename+"\">");
8905-
messages.forEach(function (message, i) {
8929+
CSSLint.Util.forEach(messages, function (message, i) {
89068930
if (message.rollup) {
89078931
output.push("<issue severity=\"" + message.type + "\" reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>");
89088932
} else {
@@ -8965,7 +8989,7 @@ CSSLint.addFormatter({
89658989
shortFilename = filename.substring(pos+1);
89668990
}
89678991

8968-
messages.forEach(function (message, i) {
8992+
CSSLint.Util.forEach(messages, function (message, i) {
89698993
output = output + "\n\n" + shortFilename;
89708994
if (message.rollup) {
89718995
output += "\n" + (i+1) + ": " + message.type;

0 commit comments

Comments
 (0)