source: trip-planner-front/node_modules/stylus/lib/nodes/media.js@ 6a3a178

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
RevLine 
[6a3a178]1
2/*!
3 * Stylus - Media
4 * Copyright (c) Automattic <developer.wordpress.com>
5 * MIT Licensed
6 */
7
8/**
9 * Module dependencies.
10 */
11
12var Atrule = require('./atrule');
13
14/**
15 * Initialize a new `Media` with the given `val`
16 *
17 * @param {String} val
18 * @api public
19 */
20
21var 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
30Media.prototype.__proto__ = Atrule.prototype;
31
32/**
33 * Clone this node.
34 *
35 * @return {Media}
36 * @api public
37 */
38
39Media.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
56Media.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
74Media.prototype.toString = function(){
75 return '@media ' + this.val;
76};
Note: See TracBrowser for help on using the repository browser.