Skip to content

Fix IE8 errors. Closes #45 #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 27, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ module.exports = function(css, options){
var rules = [];
whitespace();
comments(rules);
while (css[0] != '}' && (node = atrule() || rule())) {
while (css.charAt(0) != '}' && (node = atrule() || rule())) {
rules.push(node);
comments(rules);
}
Expand Down Expand Up @@ -143,10 +143,10 @@ module.exports = function(css, options){

function comment() {
var pos = position();
if ('/' != css[0] || '*' != css[1]) return;
if ('/' != css.charAt(0) || '*' != css.charAt(1)) return;

var i = 2;
while (null != css[i] && ('*' != css[i] || '/' != css[i + 1])) ++i;
while (null != css.charAt(i) && ('*' != css.charAt(i) || '/' != css.charAt(i + 1))) ++i;
i += 2;

var str = css.slice(2, i - 2);
Expand All @@ -168,7 +168,7 @@ module.exports = function(css, options){
function selector() {
var m = match(/^([^{]+)/);
if (!m) return;
return m[0].trim().split(/\s*,\s*/);
return m[0].replace(/^\s+|\s+$/g, '').split(/\s*,\s*/);
}

/**
Expand All @@ -193,7 +193,7 @@ module.exports = function(css, options){
var ret = pos({
type: 'declaration',
property: prop,
value: val[0].trim()
value: val[0].replace(/^\s+|\s+$/g, '')
});

// ;
Expand Down Expand Up @@ -290,7 +290,7 @@ module.exports = function(css, options){
var m = match(/^@supports *([^{]+)/);

if (!m) return;
var supports = m[1].trim();
var supports = m[1].replace(/^\s+|\s+$/g, '');

if (!open()) return error("@supports missing '{'");

Expand All @@ -314,7 +314,7 @@ module.exports = function(css, options){
var m = match(/^@media *([^{]+)/);

if (!m) return;
var media = m[1].trim();
var media = m[1].replace(/^\s+|\s+$/g, '');

if (!open()) return error("@media missing '{'");

Expand Down Expand Up @@ -368,8 +368,8 @@ module.exports = function(css, options){
var m = match(/^@([-\w]+)?document *([^{]+)/);
if (!m) return;

var vendor = (m[1] || '').trim();
var doc = m[2].trim();
var vendor = (m[1] || '').replace(/^\s+|\s+$/g, '');
var doc = m[2].replace(/^\s+|\s+$/g, '');

if (!open()) return error("@document missing '{'");

Expand Down Expand Up @@ -418,7 +418,7 @@ module.exports = function(css, options){
var m = match(new RegExp('^@' + name + ' *([^;\\n]+);'));
if (!m) return;
var ret = { type: name };
ret[name] = m[1].trim();
ret[name] = m[1].replace(/^\s+|\s+$/g, '');
return pos(ret);
}

Expand Down