Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
81143 views
1
//.CommonJS
2
var CSSOM = {};
3
///CommonJS
4
5
6
/**
7
* @constructor
8
* @see http://dev.w3.org/csswg/cssom/#the-medialist-interface
9
*/
10
CSSOM.MediaList = function MediaList(){
11
this.length = 0;
12
};
13
14
CSSOM.MediaList.prototype = {
15
16
constructor: CSSOM.MediaList,
17
18
/**
19
* @return {string}
20
*/
21
get mediaText() {
22
return Array.prototype.join.call(this, ", ");
23
},
24
25
/**
26
* @param {string} value
27
*/
28
set mediaText(value) {
29
var values = value.split(",");
30
var length = this.length = values.length;
31
for (var i=0; i<length; i++) {
32
this[i] = values[i].trim();
33
}
34
},
35
36
/**
37
* @param {string} medium
38
*/
39
appendMedium: function(medium) {
40
if (Array.prototype.indexOf.call(this, medium) === -1) {
41
this[this.length] = medium;
42
this.length++;
43
}
44
},
45
46
/**
47
* @param {string} medium
48
*/
49
deleteMedium: function(medium) {
50
var index = Array.prototype.indexOf.call(this, medium);
51
if (index !== -1) {
52
Array.prototype.splice.call(this, index, 1);
53
}
54
}
55
56
};
57
58
59
//.CommonJS
60
exports.MediaList = CSSOM.MediaList;
61
///CommonJS
62
63