1 |
|
2 | var CSSOM = {};
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | CSSOM.MatcherList = function MatcherList(){
|
11 | this.length = 0;
|
12 | };
|
13 |
|
14 | CSSOM.MatcherList.prototype = {
|
15 |
|
16 | constructor: CSSOM.MatcherList,
|
17 |
|
18 | /**
|
19 | * @return {string}
|
20 | */
|
21 | get matcherText() {
|
22 | return Array.prototype.join.call(this, ", ");
|
23 | },
|
24 |
|
25 | |
26 |
|
27 |
|
28 | set matcherText(value) {
|
29 |
|
30 | var values = value.split(",");
|
31 | var length = this.length = values.length;
|
32 | for (var i=0; i<length; i++) {
|
33 | this[i] = values[i].trim();
|
34 | }
|
35 | },
|
36 |
|
37 | |
38 |
|
39 |
|
40 | appendMatcher: function(matcher) {
|
41 | if (Array.prototype.indexOf.call(this, matcher) === -1) {
|
42 | this[this.length] = matcher;
|
43 | this.length++;
|
44 | }
|
45 | },
|
46 |
|
47 | |
48 |
|
49 |
|
50 | deleteMatcher: function(matcher) {
|
51 | var index = Array.prototype.indexOf.call(this, matcher);
|
52 | if (index !== -1) {
|
53 | Array.prototype.splice.call(this, index, 1);
|
54 | }
|
55 | }
|
56 |
|
57 | };
|
58 |
|
59 |
|
60 |
|
61 | exports.MatcherList = CSSOM.MatcherList;
|
62 |
|