summaryrefslogtreecommitdiff
path: root/node_modules/css-tree/cjs/syntax/function
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/css-tree/cjs/syntax/function')
-rw-r--r--node_modules/css-tree/cjs/syntax/function/expression.cjs11
-rw-r--r--node_modules/css-tree/cjs/syntax/function/var.cjs43
2 files changed, 54 insertions, 0 deletions
diff --git a/node_modules/css-tree/cjs/syntax/function/expression.cjs b/node_modules/css-tree/cjs/syntax/function/expression.cjs
new file mode 100644
index 00000000..43d81374
--- /dev/null
+++ b/node_modules/css-tree/cjs/syntax/function/expression.cjs
@@ -0,0 +1,11 @@
+'use strict';
+
+// legacy IE function
+// expression( <any-value> )
+function expressionFn() {
+ return this.createSingleNodeList(
+ this.Raw(this.tokenIndex, null, false)
+ );
+}
+
+module.exports = expressionFn;
diff --git a/node_modules/css-tree/cjs/syntax/function/var.cjs b/node_modules/css-tree/cjs/syntax/function/var.cjs
new file mode 100644
index 00000000..96729706
--- /dev/null
+++ b/node_modules/css-tree/cjs/syntax/function/var.cjs
@@ -0,0 +1,43 @@
+'use strict';
+
+const types = require('../../tokenizer/types.cjs');
+
+// var( <ident> , <value>? )
+function varFn() {
+ const children = this.createList();
+
+ this.skipSC();
+
+ // NOTE: Don't check more than a first argument is an ident, rest checks are for lexer
+ children.push(this.Identifier());
+
+ this.skipSC();
+
+ if (this.tokenType === types.Comma) {
+ children.push(this.Operator());
+
+ const startIndex = this.tokenIndex;
+ const value = this.parseCustomProperty
+ ? this.Value(null)
+ : this.Raw(this.tokenIndex, this.consumeUntilExclamationMarkOrSemicolon, false);
+
+ if (value.type === 'Value' && value.children.isEmpty) {
+ for (let offset = startIndex - this.tokenIndex; offset <= 0; offset++) {
+ if (this.lookupType(offset) === types.WhiteSpace) {
+ value.children.appendData({
+ type: 'WhiteSpace',
+ loc: null,
+ value: ' '
+ });
+ break;
+ }
+ }
+ }
+
+ children.push(value);
+ }
+
+ return children;
+}
+
+module.exports = varFn;