Browse files

Release 0.1.6

  • Loading branch information...
1 parent 9ccbed7 commit c5540524f1ecaae25cf127fffd1308c4143f64b5 @nzakas nzakas committed Mar 2, 2012
View
8 CHANGELOG
@@ -1,3 +1,9 @@
+March 2, 2012 - v0.1.6
+
+* Allow leading semicolon in front of properties (Nicholas C. Zakas)
+* Ensure 'ch' is identifier as a length (Nicholas C. Zakas)
+
+
February 10, 2012 - v0.1.5
* Cleanup failing test (Nicholas C. Zakas)
@@ -213,3 +219,5 @@ November 28, 2011 - v0.1.0
+
+
View
2 build.xml
@@ -1,7 +1,7 @@
<project name="parserlib" default="build.all">
<!-- version number -->
- <property name="parserlib.version" value="0.1.5" />
+ <property name="parserlib.version" value="0.1.6" />
<!-- the directories containing the source files -->
<property name="src.dir" value="./src" />
View
27 build/node-parserlib.js
@@ -21,10 +21,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v@VERSION@, Build time: 2-March-2012 02:42:45 */
+/* Version v@VERSION@, Build time: 2-March-2012 02:44:32 */
var parserlib = {};
(function(){
+
/**
* A generic base to inherit from for any object
* that needs event handling.
@@ -895,6 +896,8 @@ TokenStreamBase.prototype = {
};
+
+
parserlib.util = {
StringReader: StringReader,
SyntaxError : SyntaxError,
@@ -903,6 +906,8 @@ EventTarget : EventTarget,
TokenStreamBase : TokenStreamBase
};
})();
+
+
/*
Parser-Lib
Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
@@ -926,14 +931,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v@VERSION@, Build time: 2-March-2012 02:42:45 */
+/* Version v@VERSION@, Build time: 2-March-2012 02:44:32 */
(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",
@@ -1114,6 +1120,7 @@ function Combinator(text, line, col){
Combinator.prototype = new SyntaxUnit();
Combinator.prototype.constructor = Combinator;
+
/*global SyntaxUnit, Parser*/
/**
* Represents a media feature, such as max-width:500.
@@ -1146,6 +1153,7 @@ function MediaFeature(name, value){
MediaFeature.prototype = new SyntaxUnit();
MediaFeature.prototype.constructor = MediaFeature;
+
/*global SyntaxUnit, Parser*/
/**
* Represents an individual media query.
@@ -1189,6 +1197,7 @@ function MediaQuery(modifier, mediaType, features, line, col){
MediaQuery.prototype = new SyntaxUnit();
MediaQuery.prototype.constructor = MediaQuery;
+
/*global Tokens, TokenStream, SyntaxError, Properties, Validation, ValidationError, SyntaxUnit,
PropertyValue, PropertyValuePart, SelectorPart, SelectorSubPart, Selector,
PropertyName, Combinator, MediaFeature, MediaQuery, EventTarget */
@@ -3910,6 +3919,7 @@ PropertyName.prototype.constructor = PropertyName;
PropertyName.prototype.toString = function(){
return (this.hack ? this.hack : "") + this.text;
};
+
/*global SyntaxUnit, Parser*/
/**
* Represents a single part of a CSS property value, meaning that it represents
@@ -3939,6 +3949,7 @@ function PropertyValue(parts, line, col){
PropertyValue.prototype = new SyntaxUnit();
PropertyValue.prototype.constructor = PropertyValue;
+
/*global SyntaxUnit, Parser*/
/**
* A utility class that allows for easy iteration over the various parts of a
@@ -4064,6 +4075,7 @@ PropertyValueIterator.prototype.restore = function(){
}
};
+
/*global SyntaxUnit, Parser, Colors*/
/**
* Represents a single part of a CSS property value, meaning that it represents
@@ -4285,6 +4297,7 @@ function Selector(parts, line, col){
Selector.prototype = new SyntaxUnit();
Selector.prototype.constructor = Selector;
+
/*global SyntaxUnit, Parser*/
/**
* Represents a single part of a selector string, meaning a single set of
@@ -4327,6 +4340,7 @@ function SelectorPart(elementName, modifiers, text, line, col){
SelectorPart.prototype = new SyntaxUnit();
SelectorPart.prototype.constructor = SelectorPart;
+
/*global SyntaxUnit, Parser*/
/**
* Represents a selector modifier string, meaning a class name, element name,
@@ -4363,6 +4377,7 @@ function SelectorSubPart(text, type, line, col){
SelectorSubPart.prototype = new SyntaxUnit();
SelectorSubPart.prototype.constructor = SelectorSubPart;
+
/*global Pseudos, SelectorPart*/
/**
* Represents a selector's specificity.
@@ -4486,6 +4501,7 @@ Specificity.calculate = function(selector){
return new Specificity(0, b, c, d);
};
+
/*global Tokens, TokenStreamBase*/
var h = /^[0-9a-fA-F]$/,
@@ -5486,6 +5502,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
}
});
+
var Tokens = [
/*
@@ -5693,6 +5710,7 @@ var Tokens = [
+
//This file will likely change a lot! Very experimental!
/*global Properties, ValidationTypes, ValidationError, PropertyValueIterator */
var Validation = {
@@ -6227,6 +6245,7 @@ var ValidationTypes = {
}
};
+
parserlib.css = {
Colors :Colors,
Combinator :Combinator,
@@ -6246,8 +6265,12 @@ ValidationError :ValidationError
};
})();
+
+
+
(function(){
for(var prop in parserlib){
exports[prop] = parserlib[prop];
}
})();
+
View
27 build/npm/lib/node-parserlib.js
@@ -21,10 +21,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v@VERSION@, Build time: 2-March-2012 02:42:45 */
+/* Version v@VERSION@, Build time: 2-March-2012 02:44:32 */
var parserlib = {};
(function(){
+
/**
* A generic base to inherit from for any object
* that needs event handling.
@@ -895,6 +896,8 @@ TokenStreamBase.prototype = {
};
+
+
parserlib.util = {
StringReader: StringReader,
SyntaxError : SyntaxError,
@@ -903,6 +906,8 @@ EventTarget : EventTarget,
TokenStreamBase : TokenStreamBase
};
})();
+
+
/*
Parser-Lib
Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
@@ -926,14 +931,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v@VERSION@, Build time: 2-March-2012 02:42:45 */
+/* Version v@VERSION@, Build time: 2-March-2012 02:44:32 */
(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",
@@ -1114,6 +1120,7 @@ function Combinator(text, line, col){
Combinator.prototype = new SyntaxUnit();
Combinator.prototype.constructor = Combinator;
+
/*global SyntaxUnit, Parser*/
/**
* Represents a media feature, such as max-width:500.
@@ -1146,6 +1153,7 @@ function MediaFeature(name, value){
MediaFeature.prototype = new SyntaxUnit();
MediaFeature.prototype.constructor = MediaFeature;
+
/*global SyntaxUnit, Parser*/
/**
* Represents an individual media query.
@@ -1189,6 +1197,7 @@ function MediaQuery(modifier, mediaType, features, line, col){
MediaQuery.prototype = new SyntaxUnit();
MediaQuery.prototype.constructor = MediaQuery;
+
/*global Tokens, TokenStream, SyntaxError, Properties, Validation, ValidationError, SyntaxUnit,
PropertyValue, PropertyValuePart, SelectorPart, SelectorSubPart, Selector,
PropertyName, Combinator, MediaFeature, MediaQuery, EventTarget */
@@ -3910,6 +3919,7 @@ PropertyName.prototype.constructor = PropertyName;
PropertyName.prototype.toString = function(){
return (this.hack ? this.hack : "") + this.text;
};
+
/*global SyntaxUnit, Parser*/
/**
* Represents a single part of a CSS property value, meaning that it represents
@@ -3939,6 +3949,7 @@ function PropertyValue(parts, line, col){
PropertyValue.prototype = new SyntaxUnit();
PropertyValue.prototype.constructor = PropertyValue;
+
/*global SyntaxUnit, Parser*/
/**
* A utility class that allows for easy iteration over the various parts of a
@@ -4064,6 +4075,7 @@ PropertyValueIterator.prototype.restore = function(){
}
};
+
/*global SyntaxUnit, Parser, Colors*/
/**
* Represents a single part of a CSS property value, meaning that it represents
@@ -4285,6 +4297,7 @@ function Selector(parts, line, col){
Selector.prototype = new SyntaxUnit();
Selector.prototype.constructor = Selector;
+
/*global SyntaxUnit, Parser*/
/**
* Represents a single part of a selector string, meaning a single set of
@@ -4327,6 +4340,7 @@ function SelectorPart(elementName, modifiers, text, line, col){
SelectorPart.prototype = new SyntaxUnit();
SelectorPart.prototype.constructor = SelectorPart;
+
/*global SyntaxUnit, Parser*/
/**
* Represents a selector modifier string, meaning a class name, element name,
@@ -4363,6 +4377,7 @@ function SelectorSubPart(text, type, line, col){
SelectorSubPart.prototype = new SyntaxUnit();
SelectorSubPart.prototype.constructor = SelectorSubPart;
+
/*global Pseudos, SelectorPart*/
/**
* Represents a selector's specificity.
@@ -4486,6 +4501,7 @@ Specificity.calculate = function(selector){
return new Specificity(0, b, c, d);
};
+
/*global Tokens, TokenStreamBase*/
var h = /^[0-9a-fA-F]$/,
@@ -5486,6 +5502,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
}
});
+
var Tokens = [
/*
@@ -5693,6 +5710,7 @@ var Tokens = [
+
//This file will likely change a lot! Very experimental!
/*global Properties, ValidationTypes, ValidationError, PropertyValueIterator */
var Validation = {
@@ -6227,6 +6245,7 @@ var ValidationTypes = {
}
};
+
parserlib.css = {
Colors :Colors,
Combinator :Combinator,
@@ -6246,8 +6265,12 @@ ValidationError :ValidationError
};
})();
+
+
+
(function(){
for(var prop in parserlib){
exports[prop] = parserlib[prop];
}
})();
+
View
6 build/parserlib-core.js
@@ -21,10 +21,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v@VERSION@, Build time: 2-March-2012 02:42:45 */
+/* Version v@VERSION@, Build time: 2-March-2012 02:44:32 */
var parserlib = {};
(function(){
+
/**
* A generic base to inherit from for any object
* that needs event handling.
@@ -895,6 +896,8 @@ TokenStreamBase.prototype = {
};
+
+
parserlib.util = {
StringReader: StringReader,
SyntaxError : SyntaxError,
@@ -903,3 +906,4 @@ EventTarget : EventTarget,
TokenStreamBase : TokenStreamBase
};
})();
+
View
17 build/parserlib-css.js
@@ -21,14 +21,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v@VERSION@, Build time: 2-March-2012 02:42:45 */
+/* Version v@VERSION@, Build time: 2-March-2012 02:44:32 */
(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",
@@ -209,6 +210,7 @@ function Combinator(text, line, col){
Combinator.prototype = new SyntaxUnit();
Combinator.prototype.constructor = Combinator;
+
/*global SyntaxUnit, Parser*/
/**
* Represents a media feature, such as max-width:500.
@@ -241,6 +243,7 @@ function MediaFeature(name, value){
MediaFeature.prototype = new SyntaxUnit();
MediaFeature.prototype.constructor = MediaFeature;
+
/*global SyntaxUnit, Parser*/
/**
* Represents an individual media query.
@@ -284,6 +287,7 @@ function MediaQuery(modifier, mediaType, features, line, col){
MediaQuery.prototype = new SyntaxUnit();
MediaQuery.prototype.constructor = MediaQuery;
+
/*global Tokens, TokenStream, SyntaxError, Properties, Validation, ValidationError, SyntaxUnit,
PropertyValue, PropertyValuePart, SelectorPart, SelectorSubPart, Selector,
PropertyName, Combinator, MediaFeature, MediaQuery, EventTarget */
@@ -3005,6 +3009,7 @@ PropertyName.prototype.constructor = PropertyName;
PropertyName.prototype.toString = function(){
return (this.hack ? this.hack : "") + this.text;
};
+
/*global SyntaxUnit, Parser*/
/**
* Represents a single part of a CSS property value, meaning that it represents
@@ -3034,6 +3039,7 @@ function PropertyValue(parts, line, col){
PropertyValue.prototype = new SyntaxUnit();
PropertyValue.prototype.constructor = PropertyValue;
+
/*global SyntaxUnit, Parser*/
/**
* A utility class that allows for easy iteration over the various parts of a
@@ -3159,6 +3165,7 @@ PropertyValueIterator.prototype.restore = function(){
}
};
+
/*global SyntaxUnit, Parser, Colors*/
/**
* Represents a single part of a CSS property value, meaning that it represents
@@ -3380,6 +3387,7 @@ function Selector(parts, line, col){
Selector.prototype = new SyntaxUnit();
Selector.prototype.constructor = Selector;
+
/*global SyntaxUnit, Parser*/
/**
* Represents a single part of a selector string, meaning a single set of
@@ -3422,6 +3430,7 @@ function SelectorPart(elementName, modifiers, text, line, col){
SelectorPart.prototype = new SyntaxUnit();
SelectorPart.prototype.constructor = SelectorPart;
+
/*global SyntaxUnit, Parser*/
/**
* Represents a selector modifier string, meaning a class name, element name,
@@ -3458,6 +3467,7 @@ function SelectorSubPart(text, type, line, col){
SelectorSubPart.prototype = new SyntaxUnit();
SelectorSubPart.prototype.constructor = SelectorSubPart;
+
/*global Pseudos, SelectorPart*/
/**
* Represents a selector's specificity.
@@ -3581,6 +3591,7 @@ Specificity.calculate = function(selector){
return new Specificity(0, b, c, d);
};
+
/*global Tokens, TokenStreamBase*/
var h = /^[0-9a-fA-F]$/,
@@ -4581,6 +4592,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
}
});
+
var Tokens = [
/*
@@ -4788,6 +4800,7 @@ var Tokens = [
+
//This file will likely change a lot! Very experimental!
/*global Properties, ValidationTypes, ValidationError, PropertyValueIterator */
var Validation = {
@@ -5322,6 +5335,7 @@ var ValidationTypes = {
}
};
+
parserlib.css = {
Colors :Colors,
Combinator :Combinator,
@@ -5340,3 +5354,4 @@ Tokens :Tokens,
ValidationError :ValidationError
};
})();
+
View
4 build/parserlib-tests.js
@@ -1528,6 +1528,7 @@
YUITest.TestRunner.add(suite);
})();
+
(function(){
var Assert = YUITest.Assert,
@@ -2229,6 +2230,7 @@
YUITest.TestRunner.add(newSuite);
})();
+
(function(){
var Assert = YUITest.Assert,
@@ -2753,6 +2755,7 @@
YUITest.TestRunner.add(suite);
})();
+
(function(){
var Assert = YUITest.Assert
@@ -3062,3 +3065,4 @@
YUITest.TestRunner.add(suite);
})();
+
View
25 build/parserlib.js
@@ -21,10 +21,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v@VERSION@, Build time: 2-March-2012 02:42:45 */
+/* Version v@VERSION@, Build time: 2-March-2012 02:44:32 */
var parserlib = {};
(function(){
+
/**
* A generic base to inherit from for any object
* that needs event handling.
@@ -895,6 +896,8 @@ TokenStreamBase.prototype = {
};
+
+
parserlib.util = {
StringReader: StringReader,
SyntaxError : SyntaxError,
@@ -903,6 +906,8 @@ EventTarget : EventTarget,
TokenStreamBase : TokenStreamBase
};
})();
+
+
/*
Parser-Lib
Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
@@ -926,14 +931,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v@VERSION@, Build time: 2-March-2012 02:42:45 */
+/* Version v@VERSION@, Build time: 2-March-2012 02:44:32 */
(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",
@@ -1114,6 +1120,7 @@ function Combinator(text, line, col){
Combinator.prototype = new SyntaxUnit();
Combinator.prototype.constructor = Combinator;
+
/*global SyntaxUnit, Parser*/
/**
* Represents a media feature, such as max-width:500.
@@ -1146,6 +1153,7 @@ function MediaFeature(name, value){
MediaFeature.prototype = new SyntaxUnit();
MediaFeature.prototype.constructor = MediaFeature;
+
/*global SyntaxUnit, Parser*/
/**
* Represents an individual media query.
@@ -1189,6 +1197,7 @@ function MediaQuery(modifier, mediaType, features, line, col){
MediaQuery.prototype = new SyntaxUnit();
MediaQuery.prototype.constructor = MediaQuery;
+
/*global Tokens, TokenStream, SyntaxError, Properties, Validation, ValidationError, SyntaxUnit,
PropertyValue, PropertyValuePart, SelectorPart, SelectorSubPart, Selector,
PropertyName, Combinator, MediaFeature, MediaQuery, EventTarget */
@@ -3910,6 +3919,7 @@ PropertyName.prototype.constructor = PropertyName;
PropertyName.prototype.toString = function(){
return (this.hack ? this.hack : "") + this.text;
};
+
/*global SyntaxUnit, Parser*/
/**
* Represents a single part of a CSS property value, meaning that it represents
@@ -3939,6 +3949,7 @@ function PropertyValue(parts, line, col){
PropertyValue.prototype = new SyntaxUnit();
PropertyValue.prototype.constructor = PropertyValue;
+
/*global SyntaxUnit, Parser*/
/**
* A utility class that allows for easy iteration over the various parts of a
@@ -4064,6 +4075,7 @@ PropertyValueIterator.prototype.restore = function(){
}
};
+
/*global SyntaxUnit, Parser, Colors*/
/**
* Represents a single part of a CSS property value, meaning that it represents
@@ -4285,6 +4297,7 @@ function Selector(parts, line, col){
Selector.prototype = new SyntaxUnit();
Selector.prototype.constructor = Selector;
+
/*global SyntaxUnit, Parser*/
/**
* Represents a single part of a selector string, meaning a single set of
@@ -4327,6 +4340,7 @@ function SelectorPart(elementName, modifiers, text, line, col){
SelectorPart.prototype = new SyntaxUnit();
SelectorPart.prototype.constructor = SelectorPart;
+
/*global SyntaxUnit, Parser*/
/**
* Represents a selector modifier string, meaning a class name, element name,
@@ -4363,6 +4377,7 @@ function SelectorSubPart(text, type, line, col){
SelectorSubPart.prototype = new SyntaxUnit();
SelectorSubPart.prototype.constructor = SelectorSubPart;
+
/*global Pseudos, SelectorPart*/
/**
* Represents a selector's specificity.
@@ -4486,6 +4501,7 @@ Specificity.calculate = function(selector){
return new Specificity(0, b, c, d);
};
+
/*global Tokens, TokenStreamBase*/
var h = /^[0-9a-fA-F]$/,
@@ -5486,6 +5502,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
}
});
+
var Tokens = [
/*
@@ -5693,6 +5710,7 @@ var Tokens = [
+
//This file will likely change a lot! Very experimental!
/*global Properties, ValidationTypes, ValidationError, PropertyValueIterator */
var Validation = {
@@ -6227,6 +6245,7 @@ var ValidationTypes = {
}
};
+
parserlib.css = {
Colors :Colors,
Combinator :Combinator,
@@ -6245,3 +6264,5 @@ Tokens :Tokens,
ValidationError :ValidationError
};
})();
+
+
View
7 release/node-parserlib.js
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v0.1.5, Build time: 10-February-2012 12:59:26 */
+/* Version v0.1.6, Build time: 2-March-2012 02:44:32 */
var parserlib = {};
(function(){
@@ -931,7 +931,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v0.1.5, Build time: 10-February-2012 12:59:26 */
+/* Version v0.1.6, Build time: 2-March-2012 02:44:32 */
(function(){
var EventTarget = parserlib.util.EventTarget,
TokenStreamBase = parserlib.util.TokenStreamBase,
@@ -3179,7 +3179,7 @@ Parser.prototype = function(){
while(true){
- if (readMargins && this._margin()){
+ if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){
//noop
} else if (this._declaration()){
if (!tokenStream.match(Tokens.SEMICOLON)){
@@ -4121,6 +4121,7 @@ function PropertyValuePart(text, line, col){
case "in":
case "pt":
case "pc":
+ case "ch":
this.type = "length";
break;
View
7 release/npm/lib/node-parserlib.js
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v0.1.5, Build time: 10-February-2012 12:59:26 */
+/* Version v0.1.6, Build time: 2-March-2012 02:44:32 */
var parserlib = {};
(function(){
@@ -931,7 +931,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v0.1.5, Build time: 10-February-2012 12:59:26 */
+/* Version v0.1.6, Build time: 2-March-2012 02:44:32 */
(function(){
var EventTarget = parserlib.util.EventTarget,
TokenStreamBase = parserlib.util.TokenStreamBase,
@@ -3179,7 +3179,7 @@ Parser.prototype = function(){
while(true){
- if (readMargins && this._margin()){
+ if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){
//noop
} else if (this._declaration()){
if (!tokenStream.match(Tokens.SEMICOLON)){
@@ -4121,6 +4121,7 @@ function PropertyValuePart(text, line, col){
case "in":
case "pt":
case "pc":
+ case "ch":
this.type = "length";
break;
View
2 release/npm/package.json
@@ -1,6 +1,6 @@
{
"name": "parserlib",
- "version": "0.1.5",
+ "version": "0.1.6",
"description": "CSSLint",
"author": "Nicholas C. Zakas",
"os": ["darwin", "linux"],
View
2 release/parserlib-core.js
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v0.1.5, Build time: 10-February-2012 12:59:26 */
+/* Version v0.1.6, Build time: 2-March-2012 02:44:32 */
var parserlib = {};
(function(){
View
5 release/parserlib-css.js
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v0.1.5, Build time: 10-February-2012 12:59:26 */
+/* Version v0.1.6, Build time: 2-March-2012 02:44:32 */
(function(){
var EventTarget = parserlib.util.EventTarget,
TokenStreamBase = parserlib.util.TokenStreamBase,
@@ -2269,7 +2269,7 @@ Parser.prototype = function(){
while(true){
- if (readMargins && this._margin()){
+ if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){
//noop
} else if (this._declaration()){
if (!tokenStream.match(Tokens.SEMICOLON)){
@@ -3211,6 +3211,7 @@ function PropertyValuePart(text, line, col){
case "in":
case "pt":
case "pc":
+ case "ch":
this.type = "length";
break;
View
28 release/parserlib-tests.js
@@ -971,6 +971,17 @@
Assert.areEqual("px", result.parts[0].units);
},
+ testDimensionValue: function(){
+ var parser = new Parser();
+ var result = parser.parsePropertyValue("1ch");
+
+ Assert.isInstanceOf(parserlib.css.PropertyValue, result);
+ Assert.areEqual(1, result.parts.length);
+ Assert.areEqual("length", result.parts[0].type);
+ Assert.areEqual(1, result.parts[0].value);
+ Assert.areEqual("ch", result.parts[0].units);
+ },
+
testPercentageValue: function(){
var parser = new Parser();
var result = parser.parsePropertyValue("25.4%");
@@ -1495,7 +1506,22 @@
Assert.isTrue(event.important, "Important should be true.");
});
var result = parser.parse(".foo {\n color: #fff !important;\n}");
- }
+ },
+
+ "Test rule with leading semicolon": function(){
+ var parser = new Parser({ strict: true});
+ parser.addListener("property", function(event){
+ Assert.areEqual("color", event.property.toString());
+ Assert.areEqual("#fff", event.value.toString());
+ Assert.areEqual(5, event.property.col, "Property column should be 5.");
+ Assert.areEqual(2, event.property.line, "Property line should be 2.");
+ Assert.areEqual(5, event.col, "Event column should be 5.");
+ Assert.areEqual(2, event.line, "Event line should be 2.");
+ Assert.areEqual(12, event.value.parts[0].col, "First part column should be 12.");
+ Assert.areEqual(2, event.value.parts[0].line, "First part line should be 2.");
+ });
+ var result = parser.parse(".foo {\n; color: #fff;\n}");
+ }
}));
View
7 release/parserlib.js
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v0.1.5, Build time: 10-February-2012 12:59:26 */
+/* Version v0.1.6, Build time: 2-March-2012 02:44:32 */
var parserlib = {};
(function(){
@@ -931,7 +931,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v0.1.5, Build time: 10-February-2012 12:59:26 */
+/* Version v0.1.6, Build time: 2-March-2012 02:44:32 */
(function(){
var EventTarget = parserlib.util.EventTarget,
TokenStreamBase = parserlib.util.TokenStreamBase,
@@ -3179,7 +3179,7 @@ Parser.prototype = function(){
while(true){
- if (readMargins && this._margin()){
+ if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){
//noop
} else if (this._declaration()){
if (!tokenStream.match(Tokens.SEMICOLON)){
@@ -4121,6 +4121,7 @@ function PropertyValuePart(text, line, col){
case "in":
case "pt":
case "pc":
+ case "ch":
this.type = "length";
break;

0 comments on commit c554052

Please sign in to comment.