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