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