Last change
on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /*!
|
---|
2 | * Stylus - supports
|
---|
3 | * Copyright (c) Automattic <developer.wordpress.com>
|
---|
4 | * MIT Licensed
|
---|
5 | */
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * Module dependencies.
|
---|
9 | */
|
---|
10 |
|
---|
11 | var Atrule = require('./atrule');
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Initialize a new supports node.
|
---|
15 | *
|
---|
16 | * @param {Expression} condition
|
---|
17 | * @api public
|
---|
18 | */
|
---|
19 |
|
---|
20 | var Supports = module.exports = function Supports(condition){
|
---|
21 | Atrule.call(this, 'supports');
|
---|
22 | this.condition = condition;
|
---|
23 | };
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Inherit from `Atrule.prototype`.
|
---|
27 | */
|
---|
28 |
|
---|
29 | Supports.prototype.__proto__ = Atrule.prototype;
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * Return a clone of this node.
|
---|
33 | *
|
---|
34 | * @return {Node}
|
---|
35 | * @api public
|
---|
36 | */
|
---|
37 |
|
---|
38 | Supports.prototype.clone = function(parent){
|
---|
39 | var clone = new Supports;
|
---|
40 | clone.condition = this.condition.clone(parent, clone);
|
---|
41 | clone.block = this.block.clone(parent, clone);
|
---|
42 | clone.lineno = this.lineno;
|
---|
43 | clone.column = this.column;
|
---|
44 | clone.filename = this.filename;
|
---|
45 | return clone;
|
---|
46 | };
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * Return a JSON representation of this node.
|
---|
50 | *
|
---|
51 | * @return {Object}
|
---|
52 | * @api public
|
---|
53 | */
|
---|
54 |
|
---|
55 | Supports.prototype.toJSON = function(){
|
---|
56 | return {
|
---|
57 | __type: 'Supports',
|
---|
58 | condition: this.condition,
|
---|
59 | block: this.block,
|
---|
60 | lineno: this.lineno,
|
---|
61 | column: this.column,
|
---|
62 | filename: this.filename
|
---|
63 | };
|
---|
64 | };
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * Return @supports
|
---|
68 | *
|
---|
69 | * @return {String}
|
---|
70 | * @api public
|
---|
71 | */
|
---|
72 |
|
---|
73 | Supports.prototype.toString = function(){
|
---|
74 | return '@supports ' + this.condition;
|
---|
75 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.