gonzales-pe
Advanced tools
Comparing version 3.0.0-13 to 3.0.0-14
@@ -1005,3 +1005,3 @@ var Node = require('../node'); | ||
column = token.col, | ||
content = ''; | ||
content = ';'; | ||
@@ -1031,3 +1031,3 @@ pos++; | ||
column = token.col, | ||
content = ''; | ||
content = ','; | ||
@@ -1495,3 +1495,3 @@ pos++; | ||
column = token.col, | ||
content = ''; | ||
content = '|'; | ||
@@ -1979,3 +1979,3 @@ return new Node(type, content, line, column); | ||
column = token.col, | ||
content = ''; | ||
content = ':'; | ||
@@ -1982,0 +1982,0 @@ return new Node(type, content, line, column); |
@@ -5,4 +5,5 @@ module.exports = function stringify(tree) { | ||
var simple = ['ident', 'attrselector', 'combinator', 'nth', 'number', | ||
'operator', 'raw', 's', 'string', 'unary']; | ||
var simple = ['attrselector', 'combinator', 'declDelim', 'delim', 'ident', | ||
'namespace', 'nth', 'number', 'operator', 'propertyDelim', 'raw', | ||
's', 'string', 'unary']; | ||
var composite = ['atruleb', 'atrulerq', 'atrulers', 'atrules', | ||
@@ -54,8 +55,2 @@ 'declaration', 'dimension', 'filterv', 'function', 'selector', | ||
}, | ||
'declDelim': function() { | ||
return ';'; | ||
}, | ||
'delim': function() { | ||
return ','; | ||
}, | ||
'filter': function(t) { | ||
@@ -70,5 +65,2 @@ return _t(t.content[0]) + ':' + _t(t.content[1]); | ||
}, | ||
'namespace': function() { | ||
return '|'; | ||
}, | ||
'nthselector': function(t) { | ||
@@ -80,5 +72,2 @@ return ':' + _t(t.content[0]) + '(' + _composite(t.content.slice(1)) + ')'; | ||
}, | ||
'propertyDelim': function() { | ||
return ':'; | ||
}, | ||
'pseudoc': function(t) { | ||
@@ -85,0 +74,0 @@ return ':' + _composite(t.content); |
@@ -5,4 +5,5 @@ module.exports = function stringify(tree) { | ||
var simple = ['attrselector', 'combinator', 'ident', 'nth', 'number', | ||
'operator', 'raw', 's', 'string', 'unary']; | ||
var simple = ['attrselector', 'declDelim', 'delim', 'combinator', 'ident', | ||
'namespace', 'nth', 'number', 'operator', 'parentselector', | ||
'propertyDelim', 'raw', 's', 'string', 'unary']; | ||
var composite = ['atruleb', 'atrulerq', 'atrulers', 'atrules', 'condition', | ||
@@ -58,8 +59,2 @@ 'declaration', 'dimension', 'filterv', 'function', | ||
}, | ||
'declDelim': function() { | ||
return ';'; | ||
}, | ||
'delim': function() { | ||
return ','; | ||
}, | ||
'escapedString': function(t) { | ||
@@ -80,17 +75,8 @@ return '~' + t.content; | ||
}, | ||
'namespace': function() { | ||
return '|'; | ||
}, | ||
'nthselector': function(t) { | ||
return ':' + _t(t.content[0]) + '(' + _composite(t.content.slice(1)) + ')'; | ||
}, | ||
'parentselector': function() { | ||
return '&'; | ||
}, | ||
'percentage': function(t) { | ||
return _t(t.content) + '%'; | ||
}, | ||
'propertyDelim': function() { | ||
return ':'; | ||
}, | ||
'pseudoc': function(t) { | ||
@@ -97,0 +83,0 @@ return ':' + _composite(t.content); |
@@ -10,3 +10,3 @@ /** | ||
this.type = type; | ||
this.content = content || null; | ||
this.content = content; | ||
this.start = { | ||
@@ -39,2 +39,38 @@ line: line, | ||
/** | ||
* @param {String} type Node type | ||
* @param {Function} callback Function to call for every found node | ||
*/ | ||
forEach: function(type, callback) { | ||
var i = 0; | ||
var l = this.content.length; | ||
for (; i < l; i++) { | ||
if (this.content[i].type === type) callback(this.content[i]); | ||
} | ||
}, | ||
/** | ||
* @param {String} type Node type | ||
* @return {Node} First found child node of given type | ||
*/ | ||
find: function(type) { | ||
var i = 0; | ||
var l = this.content.length; | ||
for (; i < l; i++) { | ||
if (this.content[i].type === type) return this.content[i]; | ||
} | ||
}, | ||
/** | ||
* @param {String} type Node type | ||
* @return {Boolean} Whether there is a child node of given type | ||
*/ | ||
contains: function(type) { | ||
return this.content.some(function(node) { | ||
return node.type === type; | ||
}); | ||
}, | ||
toString: function() { | ||
@@ -41,0 +77,0 @@ return JSON.stringify(this, false, 2); |
@@ -5,4 +5,5 @@ module.exports = function stringify(tree) { | ||
var simple = ['attrselector', 'combinator', 'nth', 'number', | ||
'ident', 'operator', 'raw', 's', 'string', 'unary']; | ||
var simple = ['attrselector', 'combinator', 'declDelim', 'delim', 'ident', | ||
'namespace', 'nth', 'number', 'operator', 'parentselector', | ||
'propertyDelim', 'raw', 's', 'string', 'unary']; | ||
var composite = ['atruleb', 'atrulerq', 'atrulers', 'atrules','condition', | ||
@@ -58,11 +59,5 @@ 'conditionalStatement', 'declaration', 'dimension', 'filterv', | ||
}, | ||
'declDelim': function() { | ||
return '\n'; | ||
}, | ||
'default': function(t) { | ||
return '!' + _composite(t.content) + 'default'; | ||
}, | ||
'delim': function() { | ||
return ','; | ||
}, | ||
'filter': function(t) { | ||
@@ -80,11 +75,5 @@ return _t(t.content[0]) + ':' + _t(t.content[1]); | ||
}, | ||
'namespace': function() { | ||
return '|'; | ||
}, | ||
'nthselector': function(t) { | ||
return ':' + _t(t.content[0]) + '(' + _composite(t.content.slice(1)) + ')'; | ||
}, | ||
'parentselector': function() { | ||
return '&'; | ||
}, | ||
'percentage': function(t) { | ||
@@ -96,5 +85,2 @@ return _composite(t.content) + '%'; | ||
}, | ||
'propertyDelim': function() { | ||
return ':'; | ||
}, | ||
'pseudoc': function(t) { | ||
@@ -101,0 +87,0 @@ return ':' + _composite(t.content); |
@@ -5,4 +5,5 @@ module.exports = function stringify(tree) { | ||
var simple = ['attrselector', 'combinator', 'nth', 'number', 'ident', | ||
'operator', 'raw', 's', 'string', 'unary']; | ||
var simple = ['attrselector', 'combinator', 'declDelim', 'delim', 'ident', | ||
'namespace', 'nth', 'number', 'operator', 'parentselector', | ||
'propertyDelim', 'raw', 's', 'string', 'unary']; | ||
var composite = ['atruleb', 'atrulerq', 'atrulers', 'atrules', 'condition', | ||
@@ -59,11 +60,5 @@ 'conditionalStatement', | ||
}, | ||
'declDelim': function() { | ||
return ';'; | ||
}, | ||
'default': function(t) { | ||
return '!' + _composite(t.content) + 'default'; | ||
}, | ||
'delim': function() { | ||
return ','; | ||
}, | ||
'filter': function(t) { | ||
@@ -81,11 +76,5 @@ return _t(t.content[0]) + ':' + _t(t.content[1]); | ||
}, | ||
'namespace': function() { | ||
return '|'; | ||
}, | ||
'nthselector': function(t) { | ||
return ':' + _t(t.content[0]) + '(' + _composite(t.content.slice(1)) + ')'; | ||
}, | ||
'parentselector': function() { | ||
return '&'; | ||
}, | ||
'percentage': function(t) { | ||
@@ -97,5 +86,2 @@ return _composite(t.content) + '%'; | ||
}, | ||
'propertyDelim': function() { | ||
return ':'; | ||
}, | ||
'pseudoc': function(t) { | ||
@@ -102,0 +88,0 @@ return ':' + _composite(t.content); |
{ | ||
"name": "gonzales-pe", | ||
"description": "Gonzales Preprocessor Edition (fast CSS parser)", | ||
"version": "3.0.0-13", | ||
"version": "3.0.0-14", | ||
"homepage": "http://github.com/tonyganch/gonzales-pe", | ||
@@ -6,0 +6,0 @@ "bugs": "http://github.com/tonyganch/gonzales-pe/issues", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
459281
35
12901