@angular/platform-server 16.0.0-next.5 → 16.0.0-next.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/src/bundled-domino.mjs +257 -3780
- package/esm2022/src/http.mjs +3 -3
- package/esm2022/src/location.mjs +3 -3
- package/esm2022/src/platform_state.mjs +3 -3
- package/esm2022/src/server.mjs +4 -4
- package/esm2022/src/server_events.mjs +4 -12
- package/esm2022/src/server_renderer.mjs +4 -7
- package/esm2022/src/transfer_state.mjs +4 -4
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/testing/src/server.mjs +4 -4
- package/fesm2022/init.mjs +1 -1
- package/fesm2022/platform-server.mjs +271 -3812
- package/fesm2022/platform-server.mjs.map +1 -1
- package/fesm2022/testing.mjs +5 -5
- package/index.d.ts +1 -1
- package/init/index.d.ts +1 -1
- package/package.json +7 -7
- package/testing/index.d.ts +1 -1
|
@@ -876,6 +876,13 @@ var require_Node = __commonJS({
|
|
|
876
876
|
set: function(v) {
|
|
877
877
|
}
|
|
878
878
|
},
|
|
879
|
+
innerText: {
|
|
880
|
+
get: function() {
|
|
881
|
+
return null;
|
|
882
|
+
},
|
|
883
|
+
set: function(v) {
|
|
884
|
+
}
|
|
885
|
+
},
|
|
879
886
|
_countChildrenOfType: { value: function(type) {
|
|
880
887
|
var sum = 0;
|
|
881
888
|
for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {
|
|
@@ -2903,6 +2910,19 @@ var require_Element = __commonJS({
|
|
|
2903
2910
|
}
|
|
2904
2911
|
}
|
|
2905
2912
|
},
|
|
2913
|
+
innerText: {
|
|
2914
|
+
get: function() {
|
|
2915
|
+
var strings = [];
|
|
2916
|
+
recursiveGetText(this, strings);
|
|
2917
|
+
return strings.join("").replace(/[ \t\n\f\r]+/g, " ").trim();
|
|
2918
|
+
},
|
|
2919
|
+
set: function(newtext) {
|
|
2920
|
+
this.removeChildren();
|
|
2921
|
+
if (newtext !== null && newtext !== void 0 && newtext !== "") {
|
|
2922
|
+
this._appendChild(this.ownerDocument.createTextNode(newtext));
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
},
|
|
2906
2926
|
innerHTML: {
|
|
2907
2927
|
get: function() {
|
|
2908
2928
|
return this.serialize();
|
|
@@ -3606,6 +3626,17 @@ var require_Element = __commonJS({
|
|
|
3606
3626
|
}
|
|
3607
3627
|
this.value = v;
|
|
3608
3628
|
}
|
|
3629
|
+
},
|
|
3630
|
+
innerText: {
|
|
3631
|
+
get: function() {
|
|
3632
|
+
return this.value;
|
|
3633
|
+
},
|
|
3634
|
+
set: function(v) {
|
|
3635
|
+
if (v === null || v === void 0) {
|
|
3636
|
+
v = "";
|
|
3637
|
+
}
|
|
3638
|
+
this.value = v;
|
|
3639
|
+
}
|
|
3609
3640
|
}
|
|
3610
3641
|
});
|
|
3611
3642
|
Element._Attr = Attr;
|
|
@@ -3873,6 +3904,7 @@ var require_Text = __commonJS({
|
|
|
3873
3904
|
nodeName: { value: "#text" },
|
|
3874
3905
|
nodeValue,
|
|
3875
3906
|
textContent: nodeValue,
|
|
3907
|
+
innerText: nodeValue,
|
|
3876
3908
|
data: {
|
|
3877
3909
|
get: nodeValue.get,
|
|
3878
3910
|
set: function(v) {
|
|
@@ -3939,6 +3971,7 @@ var require_Comment = __commonJS({
|
|
|
3939
3971
|
nodeName: { value: "#comment" },
|
|
3940
3972
|
nodeValue,
|
|
3941
3973
|
textContent: nodeValue,
|
|
3974
|
+
innerText: nodeValue,
|
|
3942
3975
|
data: {
|
|
3943
3976
|
get: nodeValue.get,
|
|
3944
3977
|
set: function(v) {
|
|
@@ -3978,6 +4011,7 @@ var require_DocumentFragment = __commonJS({
|
|
|
3978
4011
|
}
|
|
3979
4012
|
},
|
|
3980
4013
|
textContent: Object.getOwnPropertyDescriptor(Element.prototype, "textContent"),
|
|
4014
|
+
innerText: Object.getOwnPropertyDescriptor(Element.prototype, "innerText"),
|
|
3981
4015
|
querySelector: { value: function(selector) {
|
|
3982
4016
|
var nodes = this.querySelectorAll(selector);
|
|
3983
4017
|
return nodes.length ? nodes[0] : null;
|
|
@@ -4047,6 +4081,7 @@ var require_ProcessingInstruction = __commonJS({
|
|
|
4047
4081
|
} },
|
|
4048
4082
|
nodeValue,
|
|
4049
4083
|
textContent: nodeValue,
|
|
4084
|
+
innerText: nodeValue,
|
|
4050
4085
|
data: {
|
|
4051
4086
|
get: nodeValue.get,
|
|
4052
4087
|
set: function(v) {
|
|
@@ -4594,3770 +4629,217 @@ var require_URL = __commonJS({
|
|
|
4594
4629
|
return URL.hierarchyPattern.test(this.url);
|
|
4595
4630
|
},
|
|
4596
4631
|
toString: function() {
|
|
4597
|
-
var s = "";
|
|
4598
|
-
if (this.scheme !== void 0)
|
|
4599
|
-
s += this.scheme + ":";
|
|
4600
|
-
if (this.isAbsolute()) {
|
|
4601
|
-
s += "//";
|
|
4602
|
-
if (this.username || this.password) {
|
|
4603
|
-
s += this.username || "";
|
|
4604
|
-
if (this.password) {
|
|
4605
|
-
s += ":" + this.password;
|
|
4606
|
-
}
|
|
4607
|
-
s += "@";
|
|
4608
|
-
}
|
|
4609
|
-
if (this.host) {
|
|
4610
|
-
s += this.host;
|
|
4611
|
-
}
|
|
4612
|
-
}
|
|
4613
|
-
if (this.port !== void 0)
|
|
4614
|
-
s += ":" + this.port;
|
|
4615
|
-
if (this.path !== void 0)
|
|
4616
|
-
s += this.path;
|
|
4617
|
-
if (this.query !== void 0)
|
|
4618
|
-
s += "?" + this.query;
|
|
4619
|
-
if (this.fragment !== void 0)
|
|
4620
|
-
s += "#" + this.fragment;
|
|
4621
|
-
return s;
|
|
4622
|
-
},
|
|
4623
|
-
resolve: function(relative) {
|
|
4624
|
-
var base = this;
|
|
4625
|
-
var r = new URL(relative);
|
|
4626
|
-
var t = new URL();
|
|
4627
|
-
if (r.scheme !== void 0) {
|
|
4628
|
-
t.scheme = r.scheme;
|
|
4629
|
-
t.username = r.username;
|
|
4630
|
-
t.password = r.password;
|
|
4631
|
-
t.host = r.host;
|
|
4632
|
-
t.port = r.port;
|
|
4633
|
-
t.path = remove_dot_segments(r.path);
|
|
4634
|
-
t.query = r.query;
|
|
4635
|
-
} else {
|
|
4636
|
-
t.scheme = base.scheme;
|
|
4637
|
-
if (r.host !== void 0) {
|
|
4638
|
-
t.username = r.username;
|
|
4639
|
-
t.password = r.password;
|
|
4640
|
-
t.host = r.host;
|
|
4641
|
-
t.port = r.port;
|
|
4642
|
-
t.path = remove_dot_segments(r.path);
|
|
4643
|
-
t.query = r.query;
|
|
4644
|
-
} else {
|
|
4645
|
-
t.username = base.username;
|
|
4646
|
-
t.password = base.password;
|
|
4647
|
-
t.host = base.host;
|
|
4648
|
-
t.port = base.port;
|
|
4649
|
-
if (!r.path) {
|
|
4650
|
-
t.path = base.path;
|
|
4651
|
-
if (r.query !== void 0)
|
|
4652
|
-
t.query = r.query;
|
|
4653
|
-
else
|
|
4654
|
-
t.query = base.query;
|
|
4655
|
-
} else {
|
|
4656
|
-
if (r.path.charAt(0) === "/") {
|
|
4657
|
-
t.path = remove_dot_segments(r.path);
|
|
4658
|
-
} else {
|
|
4659
|
-
t.path = merge(base.path, r.path);
|
|
4660
|
-
t.path = remove_dot_segments(t.path);
|
|
4661
|
-
}
|
|
4662
|
-
t.query = r.query;
|
|
4663
|
-
}
|
|
4664
|
-
}
|
|
4665
|
-
}
|
|
4666
|
-
t.fragment = r.fragment;
|
|
4667
|
-
return t.toString();
|
|
4668
|
-
function merge(basepath, refpath) {
|
|
4669
|
-
if (base.host !== void 0 && !base.path)
|
|
4670
|
-
return "/" + refpath;
|
|
4671
|
-
var lastslash = basepath.lastIndexOf("/");
|
|
4672
|
-
if (lastslash === -1)
|
|
4673
|
-
return refpath;
|
|
4674
|
-
else
|
|
4675
|
-
return basepath.substring(0, lastslash + 1) + refpath;
|
|
4676
|
-
}
|
|
4677
|
-
function remove_dot_segments(path) {
|
|
4678
|
-
if (!path)
|
|
4679
|
-
return path;
|
|
4680
|
-
var output = "";
|
|
4681
|
-
while (path.length > 0) {
|
|
4682
|
-
if (path === "." || path === "..") {
|
|
4683
|
-
path = "";
|
|
4684
|
-
break;
|
|
4685
|
-
}
|
|
4686
|
-
var twochars = path.substring(0, 2);
|
|
4687
|
-
var threechars = path.substring(0, 3);
|
|
4688
|
-
var fourchars = path.substring(0, 4);
|
|
4689
|
-
if (threechars === "../") {
|
|
4690
|
-
path = path.substring(3);
|
|
4691
|
-
} else if (twochars === "./") {
|
|
4692
|
-
path = path.substring(2);
|
|
4693
|
-
} else if (threechars === "/./") {
|
|
4694
|
-
path = "/" + path.substring(3);
|
|
4695
|
-
} else if (twochars === "/." && path.length === 2) {
|
|
4696
|
-
path = "/";
|
|
4697
|
-
} else if (fourchars === "/../" || threechars === "/.." && path.length === 3) {
|
|
4698
|
-
path = "/" + path.substring(4);
|
|
4699
|
-
output = output.replace(/\/?[^\/]*$/, "");
|
|
4700
|
-
} else {
|
|
4701
|
-
var segment = path.match(/(\/?([^\/]*))/)[0];
|
|
4702
|
-
output += segment;
|
|
4703
|
-
path = path.substring(segment.length);
|
|
4704
|
-
}
|
|
4705
|
-
}
|
|
4706
|
-
return output;
|
|
4707
|
-
}
|
|
4708
|
-
}
|
|
4709
|
-
};
|
|
4710
|
-
}
|
|
4711
|
-
});
|
|
4712
|
-
|
|
4713
|
-
// external/npm/node_modules/domino/lib/CustomEvent.js
|
|
4714
|
-
var require_CustomEvent = __commonJS({
|
|
4715
|
-
"external/npm/node_modules/domino/lib/CustomEvent.js"(exports, module) {
|
|
4716
|
-
"use strict";
|
|
4717
|
-
module.exports = CustomEvent;
|
|
4718
|
-
var Event = require_Event();
|
|
4719
|
-
function CustomEvent(type, dictionary) {
|
|
4720
|
-
Event.call(this, type, dictionary);
|
|
4721
|
-
}
|
|
4722
|
-
CustomEvent.prototype = Object.create(Event.prototype, {
|
|
4723
|
-
constructor: { value: CustomEvent }
|
|
4724
|
-
});
|
|
4725
|
-
}
|
|
4726
|
-
});
|
|
4727
|
-
|
|
4728
|
-
// external/npm/node_modules/domino/lib/events.js
|
|
4729
|
-
var require_events = __commonJS({
|
|
4730
|
-
"external/npm/node_modules/domino/lib/events.js"(exports, module) {
|
|
4731
|
-
"use strict";
|
|
4732
|
-
module.exports = {
|
|
4733
|
-
Event: require_Event(),
|
|
4734
|
-
UIEvent: require_UIEvent(),
|
|
4735
|
-
MouseEvent: require_MouseEvent(),
|
|
4736
|
-
CustomEvent: require_CustomEvent()
|
|
4737
|
-
};
|
|
4738
|
-
}
|
|
4739
|
-
});
|
|
4740
|
-
|
|
4741
|
-
// external/npm/node_modules/domino/lib/cssparser.js
|
|
4742
|
-
var require_cssparser = __commonJS({
|
|
4743
|
-
"external/npm/node_modules/domino/lib/cssparser.js"(exports) {
|
|
4744
|
-
"use strict";
|
|
4745
|
-
var parserlib = /* @__PURE__ */ Object.create(null);
|
|
4746
|
-
(function() {
|
|
4747
|
-
function EventTarget() {
|
|
4748
|
-
this._listeners = /* @__PURE__ */ Object.create(null);
|
|
4749
|
-
}
|
|
4750
|
-
EventTarget.prototype = {
|
|
4751
|
-
constructor: EventTarget,
|
|
4752
|
-
addListener: function(type, listener) {
|
|
4753
|
-
if (!this._listeners[type]) {
|
|
4754
|
-
this._listeners[type] = [];
|
|
4755
|
-
}
|
|
4756
|
-
this._listeners[type].push(listener);
|
|
4757
|
-
},
|
|
4758
|
-
fire: function(event) {
|
|
4759
|
-
if (typeof event === "string") {
|
|
4760
|
-
event = { type: event };
|
|
4761
|
-
}
|
|
4762
|
-
if (typeof event.target !== "undefined") {
|
|
4763
|
-
event.target = this;
|
|
4764
|
-
}
|
|
4765
|
-
if (typeof event.type === "undefined") {
|
|
4766
|
-
throw new Error("Event object missing 'type' property.");
|
|
4767
|
-
}
|
|
4768
|
-
if (this._listeners[event.type]) {
|
|
4769
|
-
var listeners = this._listeners[event.type].concat();
|
|
4770
|
-
for (var i = 0, len = listeners.length; i < len; i++) {
|
|
4771
|
-
listeners[i].call(this, event);
|
|
4772
|
-
}
|
|
4773
|
-
}
|
|
4774
|
-
},
|
|
4775
|
-
removeListener: function(type, listener) {
|
|
4776
|
-
if (this._listeners[type]) {
|
|
4777
|
-
var listeners = this._listeners[type];
|
|
4778
|
-
for (var i = 0, len = listeners.length; i < len; i++) {
|
|
4779
|
-
if (listeners[i] === listener) {
|
|
4780
|
-
listeners.splice(i, 1);
|
|
4781
|
-
break;
|
|
4782
|
-
}
|
|
4783
|
-
}
|
|
4784
|
-
}
|
|
4785
|
-
}
|
|
4786
|
-
};
|
|
4787
|
-
function StringReader(text) {
|
|
4788
|
-
this._input = text.replace(/(\r|\n){1,2}/g, "\n");
|
|
4789
|
-
this._line = 1;
|
|
4790
|
-
this._col = 1;
|
|
4791
|
-
this._cursor = 0;
|
|
4792
|
-
}
|
|
4793
|
-
StringReader.prototype = {
|
|
4794
|
-
constructor: StringReader,
|
|
4795
|
-
getCol: function() {
|
|
4796
|
-
return this._col;
|
|
4797
|
-
},
|
|
4798
|
-
getLine: function() {
|
|
4799
|
-
return this._line;
|
|
4800
|
-
},
|
|
4801
|
-
eof: function() {
|
|
4802
|
-
return this._cursor === this._input.length;
|
|
4803
|
-
},
|
|
4804
|
-
peek: function(count) {
|
|
4805
|
-
var c = null;
|
|
4806
|
-
count = typeof count === "undefined" ? 1 : count;
|
|
4807
|
-
if (this._cursor < this._input.length) {
|
|
4808
|
-
c = this._input.charAt(this._cursor + count - 1);
|
|
4809
|
-
}
|
|
4810
|
-
return c;
|
|
4811
|
-
},
|
|
4812
|
-
read: function() {
|
|
4813
|
-
var c = null;
|
|
4814
|
-
if (this._cursor < this._input.length) {
|
|
4815
|
-
if (this._input.charAt(this._cursor) === "\n") {
|
|
4816
|
-
this._line++;
|
|
4817
|
-
this._col = 1;
|
|
4818
|
-
} else {
|
|
4819
|
-
this._col++;
|
|
4820
|
-
}
|
|
4821
|
-
c = this._input.charAt(this._cursor++);
|
|
4822
|
-
}
|
|
4823
|
-
return c;
|
|
4824
|
-
},
|
|
4825
|
-
mark: function() {
|
|
4826
|
-
this._bookmark = {
|
|
4827
|
-
cursor: this._cursor,
|
|
4828
|
-
line: this._line,
|
|
4829
|
-
col: this._col
|
|
4830
|
-
};
|
|
4831
|
-
},
|
|
4832
|
-
reset: function() {
|
|
4833
|
-
if (this._bookmark) {
|
|
4834
|
-
this._cursor = this._bookmark.cursor;
|
|
4835
|
-
this._line = this._bookmark.line;
|
|
4836
|
-
this._col = this._bookmark.col;
|
|
4837
|
-
delete this._bookmark;
|
|
4838
|
-
}
|
|
4839
|
-
},
|
|
4840
|
-
readTo: function(pattern) {
|
|
4841
|
-
var buffer = "", c;
|
|
4842
|
-
while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) !== buffer.length - pattern.length) {
|
|
4843
|
-
c = this.read();
|
|
4844
|
-
if (c) {
|
|
4845
|
-
buffer += c;
|
|
4846
|
-
} else {
|
|
4847
|
-
throw new Error('Expected "' + pattern + '" at line ' + this._line + ", col " + this._col + ".");
|
|
4848
|
-
}
|
|
4849
|
-
}
|
|
4850
|
-
return buffer;
|
|
4851
|
-
},
|
|
4852
|
-
readWhile: function(filter) {
|
|
4853
|
-
var buffer = "", c = this.read();
|
|
4854
|
-
while (c !== null && filter(c)) {
|
|
4855
|
-
buffer += c;
|
|
4856
|
-
c = this.read();
|
|
4857
|
-
}
|
|
4858
|
-
return buffer;
|
|
4859
|
-
},
|
|
4860
|
-
readMatch: function(matcher) {
|
|
4861
|
-
var source = this._input.substring(this._cursor), value = null;
|
|
4862
|
-
if (typeof matcher === "string") {
|
|
4863
|
-
if (source.indexOf(matcher) === 0) {
|
|
4864
|
-
value = this.readCount(matcher.length);
|
|
4865
|
-
}
|
|
4866
|
-
} else if (matcher instanceof RegExp) {
|
|
4867
|
-
if (matcher.test(source)) {
|
|
4868
|
-
value = this.readCount(RegExp.lastMatch.length);
|
|
4869
|
-
}
|
|
4870
|
-
}
|
|
4871
|
-
return value;
|
|
4872
|
-
},
|
|
4873
|
-
readCount: function(count) {
|
|
4874
|
-
var buffer = "";
|
|
4875
|
-
while (count--) {
|
|
4876
|
-
buffer += this.read();
|
|
4877
|
-
}
|
|
4878
|
-
return buffer;
|
|
4879
|
-
}
|
|
4880
|
-
};
|
|
4881
|
-
function SyntaxError2(message, line, col) {
|
|
4882
|
-
Error.call(this);
|
|
4883
|
-
this.name = this.constructor.name;
|
|
4884
|
-
this.col = col;
|
|
4885
|
-
this.line = line;
|
|
4886
|
-
this.message = message;
|
|
4887
|
-
}
|
|
4888
|
-
SyntaxError2.prototype = Object.create(Error.prototype);
|
|
4889
|
-
SyntaxError2.prototype.constructor = SyntaxError2;
|
|
4890
|
-
function SyntaxUnit(text, line, col, type) {
|
|
4891
|
-
this.col = col;
|
|
4892
|
-
this.line = line;
|
|
4893
|
-
this.text = text;
|
|
4894
|
-
this.type = type;
|
|
4895
|
-
}
|
|
4896
|
-
SyntaxUnit.fromToken = function(token) {
|
|
4897
|
-
return new SyntaxUnit(token.value, token.startLine, token.startCol);
|
|
4898
|
-
};
|
|
4899
|
-
SyntaxUnit.prototype = {
|
|
4900
|
-
constructor: SyntaxUnit,
|
|
4901
|
-
valueOf: function() {
|
|
4902
|
-
return this.toString();
|
|
4903
|
-
},
|
|
4904
|
-
toString: function() {
|
|
4905
|
-
return this.text;
|
|
4906
|
-
}
|
|
4907
|
-
};
|
|
4908
|
-
function TokenStreamBase(input, tokenData) {
|
|
4909
|
-
this._reader = input ? new StringReader(input.toString()) : null;
|
|
4910
|
-
this._token = null;
|
|
4911
|
-
this._tokenData = tokenData;
|
|
4912
|
-
this._lt = [];
|
|
4913
|
-
this._ltIndex = 0;
|
|
4914
|
-
this._ltIndexCache = [];
|
|
4915
|
-
}
|
|
4916
|
-
TokenStreamBase.createTokenData = function(tokens) {
|
|
4917
|
-
var nameMap = [], typeMap = /* @__PURE__ */ Object.create(null), tokenData = tokens.concat([]), i = 0, len = tokenData.length + 1;
|
|
4918
|
-
tokenData.UNKNOWN = -1;
|
|
4919
|
-
tokenData.unshift({ name: "EOF" });
|
|
4920
|
-
for (; i < len; i++) {
|
|
4921
|
-
nameMap.push(tokenData[i].name);
|
|
4922
|
-
tokenData[tokenData[i].name] = i;
|
|
4923
|
-
if (tokenData[i].text) {
|
|
4924
|
-
typeMap[tokenData[i].text] = i;
|
|
4925
|
-
}
|
|
4926
|
-
}
|
|
4927
|
-
tokenData.name = function(tt) {
|
|
4928
|
-
return nameMap[tt];
|
|
4929
|
-
};
|
|
4930
|
-
tokenData.type = function(c) {
|
|
4931
|
-
return typeMap[c];
|
|
4932
|
-
};
|
|
4933
|
-
return tokenData;
|
|
4934
|
-
};
|
|
4935
|
-
TokenStreamBase.prototype = {
|
|
4936
|
-
constructor: TokenStreamBase,
|
|
4937
|
-
match: function(tokenTypes, channel) {
|
|
4938
|
-
if (!(tokenTypes instanceof Array)) {
|
|
4939
|
-
tokenTypes = [tokenTypes];
|
|
4940
|
-
}
|
|
4941
|
-
var tt = this.get(channel), i = 0, len = tokenTypes.length;
|
|
4942
|
-
while (i < len) {
|
|
4943
|
-
if (tt === tokenTypes[i++]) {
|
|
4944
|
-
return true;
|
|
4945
|
-
}
|
|
4946
|
-
}
|
|
4947
|
-
this.unget();
|
|
4948
|
-
return false;
|
|
4949
|
-
},
|
|
4950
|
-
mustMatch: function(tokenTypes, channel) {
|
|
4951
|
-
var token;
|
|
4952
|
-
if (!(tokenTypes instanceof Array)) {
|
|
4953
|
-
tokenTypes = [tokenTypes];
|
|
4954
|
-
}
|
|
4955
|
-
if (!this.match.apply(this, arguments)) {
|
|
4956
|
-
token = this.LT(1);
|
|
4957
|
-
throw new SyntaxError2("Expected " + this._tokenData[tokenTypes[0]].name + " at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
|
|
4958
|
-
}
|
|
4959
|
-
},
|
|
4960
|
-
advance: function(tokenTypes, channel) {
|
|
4961
|
-
while (this.LA(0) !== 0 && !this.match(tokenTypes, channel)) {
|
|
4962
|
-
this.get();
|
|
4963
|
-
}
|
|
4964
|
-
return this.LA(0);
|
|
4965
|
-
},
|
|
4966
|
-
get: function(channel) {
|
|
4967
|
-
var tokenInfo = this._tokenData, i = 0, token, info;
|
|
4968
|
-
if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length) {
|
|
4969
|
-
i++;
|
|
4970
|
-
this._token = this._lt[this._ltIndex++];
|
|
4971
|
-
info = tokenInfo[this._token.type];
|
|
4972
|
-
while (info.channel !== void 0 && channel !== info.channel && this._ltIndex < this._lt.length) {
|
|
4973
|
-
this._token = this._lt[this._ltIndex++];
|
|
4974
|
-
info = tokenInfo[this._token.type];
|
|
4975
|
-
i++;
|
|
4976
|
-
}
|
|
4977
|
-
if ((info.channel === void 0 || channel === info.channel) && this._ltIndex <= this._lt.length) {
|
|
4978
|
-
this._ltIndexCache.push(i);
|
|
4979
|
-
return this._token.type;
|
|
4980
|
-
}
|
|
4981
|
-
}
|
|
4982
|
-
token = this._getToken();
|
|
4983
|
-
if (token.type > -1 && !tokenInfo[token.type].hide) {
|
|
4984
|
-
token.channel = tokenInfo[token.type].channel;
|
|
4985
|
-
this._token = token;
|
|
4986
|
-
this._lt.push(token);
|
|
4987
|
-
this._ltIndexCache.push(this._lt.length - this._ltIndex + i);
|
|
4988
|
-
if (this._lt.length > 5) {
|
|
4989
|
-
this._lt.shift();
|
|
4990
|
-
}
|
|
4991
|
-
if (this._ltIndexCache.length > 5) {
|
|
4992
|
-
this._ltIndexCache.shift();
|
|
4993
|
-
}
|
|
4994
|
-
this._ltIndex = this._lt.length;
|
|
4995
|
-
}
|
|
4996
|
-
info = tokenInfo[token.type];
|
|
4997
|
-
if (info && (info.hide || info.channel !== void 0 && channel !== info.channel)) {
|
|
4998
|
-
return this.get(channel);
|
|
4999
|
-
} else {
|
|
5000
|
-
return token.type;
|
|
5001
|
-
}
|
|
5002
|
-
},
|
|
5003
|
-
LA: function(index) {
|
|
5004
|
-
var total = index, tt;
|
|
5005
|
-
if (index > 0) {
|
|
5006
|
-
if (index > 5) {
|
|
5007
|
-
throw new Error("Too much lookahead.");
|
|
5008
|
-
}
|
|
5009
|
-
while (total) {
|
|
5010
|
-
tt = this.get();
|
|
5011
|
-
total--;
|
|
5012
|
-
}
|
|
5013
|
-
while (total < index) {
|
|
5014
|
-
this.unget();
|
|
5015
|
-
total++;
|
|
5016
|
-
}
|
|
5017
|
-
} else if (index < 0) {
|
|
5018
|
-
if (this._lt[this._ltIndex + index]) {
|
|
5019
|
-
tt = this._lt[this._ltIndex + index].type;
|
|
5020
|
-
} else {
|
|
5021
|
-
throw new Error("Too much lookbehind.");
|
|
5022
|
-
}
|
|
5023
|
-
} else {
|
|
5024
|
-
tt = this._token.type;
|
|
5025
|
-
}
|
|
5026
|
-
return tt;
|
|
5027
|
-
},
|
|
5028
|
-
LT: function(index) {
|
|
5029
|
-
this.LA(index);
|
|
5030
|
-
return this._lt[this._ltIndex + index - 1];
|
|
5031
|
-
},
|
|
5032
|
-
peek: function() {
|
|
5033
|
-
return this.LA(1);
|
|
5034
|
-
},
|
|
5035
|
-
token: function() {
|
|
5036
|
-
return this._token;
|
|
5037
|
-
},
|
|
5038
|
-
tokenName: function(tokenType) {
|
|
5039
|
-
if (tokenType < 0 || tokenType > this._tokenData.length) {
|
|
5040
|
-
return "UNKNOWN_TOKEN";
|
|
5041
|
-
} else {
|
|
5042
|
-
return this._tokenData[tokenType].name;
|
|
5043
|
-
}
|
|
5044
|
-
},
|
|
5045
|
-
tokenType: function(tokenName) {
|
|
5046
|
-
return this._tokenData[tokenName] || -1;
|
|
5047
|
-
},
|
|
5048
|
-
unget: function() {
|
|
5049
|
-
if (this._ltIndexCache.length) {
|
|
5050
|
-
this._ltIndex -= this._ltIndexCache.pop();
|
|
5051
|
-
this._token = this._lt[this._ltIndex - 1];
|
|
5052
|
-
} else {
|
|
5053
|
-
throw new Error("Too much lookahead.");
|
|
5054
|
-
}
|
|
5055
|
-
}
|
|
5056
|
-
};
|
|
5057
|
-
parserlib.util = {
|
|
5058
|
-
__proto__: null,
|
|
5059
|
-
StringReader,
|
|
5060
|
-
SyntaxError: SyntaxError2,
|
|
5061
|
-
SyntaxUnit,
|
|
5062
|
-
EventTarget,
|
|
5063
|
-
TokenStreamBase
|
|
5064
|
-
};
|
|
5065
|
-
})();
|
|
5066
|
-
(function() {
|
|
5067
|
-
var EventTarget = parserlib.util.EventTarget, TokenStreamBase = parserlib.util.TokenStreamBase, StringReader = parserlib.util.StringReader, SyntaxError2 = parserlib.util.SyntaxError, SyntaxUnit = parserlib.util.SyntaxUnit;
|
|
5068
|
-
var Colors = {
|
|
5069
|
-
__proto__: null,
|
|
5070
|
-
aliceblue: "#f0f8ff",
|
|
5071
|
-
antiquewhite: "#faebd7",
|
|
5072
|
-
aqua: "#00ffff",
|
|
5073
|
-
aquamarine: "#7fffd4",
|
|
5074
|
-
azure: "#f0ffff",
|
|
5075
|
-
beige: "#f5f5dc",
|
|
5076
|
-
bisque: "#ffe4c4",
|
|
5077
|
-
black: "#000000",
|
|
5078
|
-
blanchedalmond: "#ffebcd",
|
|
5079
|
-
blue: "#0000ff",
|
|
5080
|
-
blueviolet: "#8a2be2",
|
|
5081
|
-
brown: "#a52a2a",
|
|
5082
|
-
burlywood: "#deb887",
|
|
5083
|
-
cadetblue: "#5f9ea0",
|
|
5084
|
-
chartreuse: "#7fff00",
|
|
5085
|
-
chocolate: "#d2691e",
|
|
5086
|
-
coral: "#ff7f50",
|
|
5087
|
-
cornflowerblue: "#6495ed",
|
|
5088
|
-
cornsilk: "#fff8dc",
|
|
5089
|
-
crimson: "#dc143c",
|
|
5090
|
-
cyan: "#00ffff",
|
|
5091
|
-
darkblue: "#00008b",
|
|
5092
|
-
darkcyan: "#008b8b",
|
|
5093
|
-
darkgoldenrod: "#b8860b",
|
|
5094
|
-
darkgray: "#a9a9a9",
|
|
5095
|
-
darkgrey: "#a9a9a9",
|
|
5096
|
-
darkgreen: "#006400",
|
|
5097
|
-
darkkhaki: "#bdb76b",
|
|
5098
|
-
darkmagenta: "#8b008b",
|
|
5099
|
-
darkolivegreen: "#556b2f",
|
|
5100
|
-
darkorange: "#ff8c00",
|
|
5101
|
-
darkorchid: "#9932cc",
|
|
5102
|
-
darkred: "#8b0000",
|
|
5103
|
-
darksalmon: "#e9967a",
|
|
5104
|
-
darkseagreen: "#8fbc8f",
|
|
5105
|
-
darkslateblue: "#483d8b",
|
|
5106
|
-
darkslategray: "#2f4f4f",
|
|
5107
|
-
darkslategrey: "#2f4f4f",
|
|
5108
|
-
darkturquoise: "#00ced1",
|
|
5109
|
-
darkviolet: "#9400d3",
|
|
5110
|
-
deeppink: "#ff1493",
|
|
5111
|
-
deepskyblue: "#00bfff",
|
|
5112
|
-
dimgray: "#696969",
|
|
5113
|
-
dimgrey: "#696969",
|
|
5114
|
-
dodgerblue: "#1e90ff",
|
|
5115
|
-
firebrick: "#b22222",
|
|
5116
|
-
floralwhite: "#fffaf0",
|
|
5117
|
-
forestgreen: "#228b22",
|
|
5118
|
-
fuchsia: "#ff00ff",
|
|
5119
|
-
gainsboro: "#dcdcdc",
|
|
5120
|
-
ghostwhite: "#f8f8ff",
|
|
5121
|
-
gold: "#ffd700",
|
|
5122
|
-
goldenrod: "#daa520",
|
|
5123
|
-
gray: "#808080",
|
|
5124
|
-
grey: "#808080",
|
|
5125
|
-
green: "#008000",
|
|
5126
|
-
greenyellow: "#adff2f",
|
|
5127
|
-
honeydew: "#f0fff0",
|
|
5128
|
-
hotpink: "#ff69b4",
|
|
5129
|
-
indianred: "#cd5c5c",
|
|
5130
|
-
indigo: "#4b0082",
|
|
5131
|
-
ivory: "#fffff0",
|
|
5132
|
-
khaki: "#f0e68c",
|
|
5133
|
-
lavender: "#e6e6fa",
|
|
5134
|
-
lavenderblush: "#fff0f5",
|
|
5135
|
-
lawngreen: "#7cfc00",
|
|
5136
|
-
lemonchiffon: "#fffacd",
|
|
5137
|
-
lightblue: "#add8e6",
|
|
5138
|
-
lightcoral: "#f08080",
|
|
5139
|
-
lightcyan: "#e0ffff",
|
|
5140
|
-
lightgoldenrodyellow: "#fafad2",
|
|
5141
|
-
lightgray: "#d3d3d3",
|
|
5142
|
-
lightgrey: "#d3d3d3",
|
|
5143
|
-
lightgreen: "#90ee90",
|
|
5144
|
-
lightpink: "#ffb6c1",
|
|
5145
|
-
lightsalmon: "#ffa07a",
|
|
5146
|
-
lightseagreen: "#20b2aa",
|
|
5147
|
-
lightskyblue: "#87cefa",
|
|
5148
|
-
lightslategray: "#778899",
|
|
5149
|
-
lightslategrey: "#778899",
|
|
5150
|
-
lightsteelblue: "#b0c4de",
|
|
5151
|
-
lightyellow: "#ffffe0",
|
|
5152
|
-
lime: "#00ff00",
|
|
5153
|
-
limegreen: "#32cd32",
|
|
5154
|
-
linen: "#faf0e6",
|
|
5155
|
-
magenta: "#ff00ff",
|
|
5156
|
-
maroon: "#800000",
|
|
5157
|
-
mediumaquamarine: "#66cdaa",
|
|
5158
|
-
mediumblue: "#0000cd",
|
|
5159
|
-
mediumorchid: "#ba55d3",
|
|
5160
|
-
mediumpurple: "#9370d8",
|
|
5161
|
-
mediumseagreen: "#3cb371",
|
|
5162
|
-
mediumslateblue: "#7b68ee",
|
|
5163
|
-
mediumspringgreen: "#00fa9a",
|
|
5164
|
-
mediumturquoise: "#48d1cc",
|
|
5165
|
-
mediumvioletred: "#c71585",
|
|
5166
|
-
midnightblue: "#191970",
|
|
5167
|
-
mintcream: "#f5fffa",
|
|
5168
|
-
mistyrose: "#ffe4e1",
|
|
5169
|
-
moccasin: "#ffe4b5",
|
|
5170
|
-
navajowhite: "#ffdead",
|
|
5171
|
-
navy: "#000080",
|
|
5172
|
-
oldlace: "#fdf5e6",
|
|
5173
|
-
olive: "#808000",
|
|
5174
|
-
olivedrab: "#6b8e23",
|
|
5175
|
-
orange: "#ffa500",
|
|
5176
|
-
orangered: "#ff4500",
|
|
5177
|
-
orchid: "#da70d6",
|
|
5178
|
-
palegoldenrod: "#eee8aa",
|
|
5179
|
-
palegreen: "#98fb98",
|
|
5180
|
-
paleturquoise: "#afeeee",
|
|
5181
|
-
palevioletred: "#d87093",
|
|
5182
|
-
papayawhip: "#ffefd5",
|
|
5183
|
-
peachpuff: "#ffdab9",
|
|
5184
|
-
peru: "#cd853f",
|
|
5185
|
-
pink: "#ffc0cb",
|
|
5186
|
-
plum: "#dda0dd",
|
|
5187
|
-
powderblue: "#b0e0e6",
|
|
5188
|
-
purple: "#800080",
|
|
5189
|
-
red: "#ff0000",
|
|
5190
|
-
rosybrown: "#bc8f8f",
|
|
5191
|
-
royalblue: "#4169e1",
|
|
5192
|
-
saddlebrown: "#8b4513",
|
|
5193
|
-
salmon: "#fa8072",
|
|
5194
|
-
sandybrown: "#f4a460",
|
|
5195
|
-
seagreen: "#2e8b57",
|
|
5196
|
-
seashell: "#fff5ee",
|
|
5197
|
-
sienna: "#a0522d",
|
|
5198
|
-
silver: "#c0c0c0",
|
|
5199
|
-
skyblue: "#87ceeb",
|
|
5200
|
-
slateblue: "#6a5acd",
|
|
5201
|
-
slategray: "#708090",
|
|
5202
|
-
slategrey: "#708090",
|
|
5203
|
-
snow: "#fffafa",
|
|
5204
|
-
springgreen: "#00ff7f",
|
|
5205
|
-
steelblue: "#4682b4",
|
|
5206
|
-
tan: "#d2b48c",
|
|
5207
|
-
teal: "#008080",
|
|
5208
|
-
thistle: "#d8bfd8",
|
|
5209
|
-
tomato: "#ff6347",
|
|
5210
|
-
turquoise: "#40e0d0",
|
|
5211
|
-
violet: "#ee82ee",
|
|
5212
|
-
wheat: "#f5deb3",
|
|
5213
|
-
white: "#ffffff",
|
|
5214
|
-
whitesmoke: "#f5f5f5",
|
|
5215
|
-
yellow: "#ffff00",
|
|
5216
|
-
yellowgreen: "#9acd32",
|
|
5217
|
-
currentColor: "The value of the 'color' property.",
|
|
5218
|
-
activeBorder: "Active window border.",
|
|
5219
|
-
activecaption: "Active window caption.",
|
|
5220
|
-
appworkspace: "Background color of multiple document interface.",
|
|
5221
|
-
background: "Desktop background.",
|
|
5222
|
-
buttonface: "The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.",
|
|
5223
|
-
buttonhighlight: "The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
|
|
5224
|
-
buttonshadow: "The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
|
|
5225
|
-
buttontext: "Text on push buttons.",
|
|
5226
|
-
captiontext: "Text in caption, size box, and scrollbar arrow box.",
|
|
5227
|
-
graytext: "Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.",
|
|
5228
|
-
greytext: "Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.",
|
|
5229
|
-
highlight: "Item(s) selected in a control.",
|
|
5230
|
-
highlighttext: "Text of item(s) selected in a control.",
|
|
5231
|
-
inactiveborder: "Inactive window border.",
|
|
5232
|
-
inactivecaption: "Inactive window caption.",
|
|
5233
|
-
inactivecaptiontext: "Color of text in an inactive caption.",
|
|
5234
|
-
infobackground: "Background color for tooltip controls.",
|
|
5235
|
-
infotext: "Text color for tooltip controls.",
|
|
5236
|
-
menu: "Menu background.",
|
|
5237
|
-
menutext: "Text in menus.",
|
|
5238
|
-
scrollbar: "Scroll bar gray area.",
|
|
5239
|
-
threeddarkshadow: "The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
|
|
5240
|
-
threedface: "The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
|
|
5241
|
-
threedhighlight: "The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
|
|
5242
|
-
threedlightshadow: "The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
|
|
5243
|
-
threedshadow: "The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
|
|
5244
|
-
window: "Window background.",
|
|
5245
|
-
windowframe: "Window frame.",
|
|
5246
|
-
windowtext: "Text in windows."
|
|
5247
|
-
};
|
|
5248
|
-
function Combinator(text, line, col) {
|
|
5249
|
-
SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE);
|
|
5250
|
-
this.type = "unknown";
|
|
5251
|
-
if (/^\s+$/.test(text)) {
|
|
5252
|
-
this.type = "descendant";
|
|
5253
|
-
} else if (text === ">") {
|
|
5254
|
-
this.type = "child";
|
|
5255
|
-
} else if (text === "+") {
|
|
5256
|
-
this.type = "adjacent-sibling";
|
|
5257
|
-
} else if (text === "~") {
|
|
5258
|
-
this.type = "sibling";
|
|
5259
|
-
}
|
|
5260
|
-
}
|
|
5261
|
-
Combinator.prototype = new SyntaxUnit();
|
|
5262
|
-
Combinator.prototype.constructor = Combinator;
|
|
5263
|
-
function MediaFeature(name, value) {
|
|
5264
|
-
SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE);
|
|
5265
|
-
this.name = name;
|
|
5266
|
-
this.value = value;
|
|
5267
|
-
}
|
|
5268
|
-
MediaFeature.prototype = new SyntaxUnit();
|
|
5269
|
-
MediaFeature.prototype.constructor = MediaFeature;
|
|
5270
|
-
function MediaQuery(modifier, mediaType, features, line, col) {
|
|
5271
|
-
SyntaxUnit.call(this, (modifier ? modifier + " " : "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE);
|
|
5272
|
-
this.modifier = modifier;
|
|
5273
|
-
this.mediaType = mediaType;
|
|
5274
|
-
this.features = features;
|
|
5275
|
-
}
|
|
5276
|
-
MediaQuery.prototype = new SyntaxUnit();
|
|
5277
|
-
MediaQuery.prototype.constructor = MediaQuery;
|
|
5278
|
-
function Parser(options) {
|
|
5279
|
-
EventTarget.call(this);
|
|
5280
|
-
this.options = options || {};
|
|
5281
|
-
this._tokenStream = null;
|
|
5282
|
-
}
|
|
5283
|
-
Parser.DEFAULT_TYPE = 0;
|
|
5284
|
-
Parser.COMBINATOR_TYPE = 1;
|
|
5285
|
-
Parser.MEDIA_FEATURE_TYPE = 2;
|
|
5286
|
-
Parser.MEDIA_QUERY_TYPE = 3;
|
|
5287
|
-
Parser.PROPERTY_NAME_TYPE = 4;
|
|
5288
|
-
Parser.PROPERTY_VALUE_TYPE = 5;
|
|
5289
|
-
Parser.PROPERTY_VALUE_PART_TYPE = 6;
|
|
5290
|
-
Parser.SELECTOR_TYPE = 7;
|
|
5291
|
-
Parser.SELECTOR_PART_TYPE = 8;
|
|
5292
|
-
Parser.SELECTOR_SUB_PART_TYPE = 9;
|
|
5293
|
-
Parser.prototype = function() {
|
|
5294
|
-
var proto = new EventTarget(), prop, additions = {
|
|
5295
|
-
__proto__: null,
|
|
5296
|
-
constructor: Parser,
|
|
5297
|
-
DEFAULT_TYPE: 0,
|
|
5298
|
-
COMBINATOR_TYPE: 1,
|
|
5299
|
-
MEDIA_FEATURE_TYPE: 2,
|
|
5300
|
-
MEDIA_QUERY_TYPE: 3,
|
|
5301
|
-
PROPERTY_NAME_TYPE: 4,
|
|
5302
|
-
PROPERTY_VALUE_TYPE: 5,
|
|
5303
|
-
PROPERTY_VALUE_PART_TYPE: 6,
|
|
5304
|
-
SELECTOR_TYPE: 7,
|
|
5305
|
-
SELECTOR_PART_TYPE: 8,
|
|
5306
|
-
SELECTOR_SUB_PART_TYPE: 9,
|
|
5307
|
-
_stylesheet: function() {
|
|
5308
|
-
var tokenStream = this._tokenStream, count, token, tt;
|
|
5309
|
-
this.fire("startstylesheet");
|
|
5310
|
-
this._charset();
|
|
5311
|
-
this._skipCruft();
|
|
5312
|
-
while (tokenStream.peek() === Tokens.IMPORT_SYM) {
|
|
5313
|
-
this._import();
|
|
5314
|
-
this._skipCruft();
|
|
5315
|
-
}
|
|
5316
|
-
while (tokenStream.peek() === Tokens.NAMESPACE_SYM) {
|
|
5317
|
-
this._namespace();
|
|
5318
|
-
this._skipCruft();
|
|
5319
|
-
}
|
|
5320
|
-
tt = tokenStream.peek();
|
|
5321
|
-
while (tt > Tokens.EOF) {
|
|
5322
|
-
try {
|
|
5323
|
-
switch (tt) {
|
|
5324
|
-
case Tokens.MEDIA_SYM:
|
|
5325
|
-
this._media();
|
|
5326
|
-
this._skipCruft();
|
|
5327
|
-
break;
|
|
5328
|
-
case Tokens.PAGE_SYM:
|
|
5329
|
-
this._page();
|
|
5330
|
-
this._skipCruft();
|
|
5331
|
-
break;
|
|
5332
|
-
case Tokens.FONT_FACE_SYM:
|
|
5333
|
-
this._font_face();
|
|
5334
|
-
this._skipCruft();
|
|
5335
|
-
break;
|
|
5336
|
-
case Tokens.KEYFRAMES_SYM:
|
|
5337
|
-
this._keyframes();
|
|
5338
|
-
this._skipCruft();
|
|
5339
|
-
break;
|
|
5340
|
-
case Tokens.VIEWPORT_SYM:
|
|
5341
|
-
this._viewport();
|
|
5342
|
-
this._skipCruft();
|
|
5343
|
-
break;
|
|
5344
|
-
case Tokens.DOCUMENT_SYM:
|
|
5345
|
-
this._document();
|
|
5346
|
-
this._skipCruft();
|
|
5347
|
-
break;
|
|
5348
|
-
case Tokens.UNKNOWN_SYM:
|
|
5349
|
-
tokenStream.get();
|
|
5350
|
-
if (!this.options.strict) {
|
|
5351
|
-
this.fire({
|
|
5352
|
-
type: "error",
|
|
5353
|
-
error: null,
|
|
5354
|
-
message: "Unknown @ rule: " + tokenStream.LT(0).value + ".",
|
|
5355
|
-
line: tokenStream.LT(0).startLine,
|
|
5356
|
-
col: tokenStream.LT(0).startCol
|
|
5357
|
-
});
|
|
5358
|
-
count = 0;
|
|
5359
|
-
while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) === Tokens.LBRACE) {
|
|
5360
|
-
count++;
|
|
5361
|
-
}
|
|
5362
|
-
while (count) {
|
|
5363
|
-
tokenStream.advance([Tokens.RBRACE]);
|
|
5364
|
-
count--;
|
|
5365
|
-
}
|
|
5366
|
-
} else {
|
|
5367
|
-
throw new SyntaxError2("Unknown @ rule.", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol);
|
|
5368
|
-
}
|
|
5369
|
-
break;
|
|
5370
|
-
case Tokens.S:
|
|
5371
|
-
this._readWhitespace();
|
|
5372
|
-
break;
|
|
5373
|
-
default:
|
|
5374
|
-
if (!this._ruleset()) {
|
|
5375
|
-
switch (tt) {
|
|
5376
|
-
case Tokens.CHARSET_SYM:
|
|
5377
|
-
token = tokenStream.LT(1);
|
|
5378
|
-
this._charset(false);
|
|
5379
|
-
throw new SyntaxError2("@charset not allowed here.", token.startLine, token.startCol);
|
|
5380
|
-
case Tokens.IMPORT_SYM:
|
|
5381
|
-
token = tokenStream.LT(1);
|
|
5382
|
-
this._import(false);
|
|
5383
|
-
throw new SyntaxError2("@import not allowed here.", token.startLine, token.startCol);
|
|
5384
|
-
case Tokens.NAMESPACE_SYM:
|
|
5385
|
-
token = tokenStream.LT(1);
|
|
5386
|
-
this._namespace(false);
|
|
5387
|
-
throw new SyntaxError2("@namespace not allowed here.", token.startLine, token.startCol);
|
|
5388
|
-
default:
|
|
5389
|
-
tokenStream.get();
|
|
5390
|
-
this._unexpectedToken(tokenStream.token());
|
|
5391
|
-
}
|
|
5392
|
-
}
|
|
5393
|
-
}
|
|
5394
|
-
} catch (ex) {
|
|
5395
|
-
if (ex instanceof SyntaxError2 && !this.options.strict) {
|
|
5396
|
-
this.fire({
|
|
5397
|
-
type: "error",
|
|
5398
|
-
error: ex,
|
|
5399
|
-
message: ex.message,
|
|
5400
|
-
line: ex.line,
|
|
5401
|
-
col: ex.col
|
|
5402
|
-
});
|
|
5403
|
-
} else {
|
|
5404
|
-
throw ex;
|
|
5405
|
-
}
|
|
5406
|
-
}
|
|
5407
|
-
tt = tokenStream.peek();
|
|
5408
|
-
}
|
|
5409
|
-
if (tt !== Tokens.EOF) {
|
|
5410
|
-
this._unexpectedToken(tokenStream.token());
|
|
5411
|
-
}
|
|
5412
|
-
this.fire("endstylesheet");
|
|
5413
|
-
},
|
|
5414
|
-
_charset: function(emit) {
|
|
5415
|
-
var tokenStream = this._tokenStream, charset, token, line, col;
|
|
5416
|
-
if (tokenStream.match(Tokens.CHARSET_SYM)) {
|
|
5417
|
-
line = tokenStream.token().startLine;
|
|
5418
|
-
col = tokenStream.token().startCol;
|
|
5419
|
-
this._readWhitespace();
|
|
5420
|
-
tokenStream.mustMatch(Tokens.STRING);
|
|
5421
|
-
token = tokenStream.token();
|
|
5422
|
-
charset = token.value;
|
|
5423
|
-
this._readWhitespace();
|
|
5424
|
-
tokenStream.mustMatch(Tokens.SEMICOLON);
|
|
5425
|
-
if (emit !== false) {
|
|
5426
|
-
this.fire({
|
|
5427
|
-
type: "charset",
|
|
5428
|
-
charset,
|
|
5429
|
-
line,
|
|
5430
|
-
col
|
|
5431
|
-
});
|
|
5432
|
-
}
|
|
5433
|
-
}
|
|
5434
|
-
},
|
|
5435
|
-
_import: function(emit) {
|
|
5436
|
-
var tokenStream = this._tokenStream, uri, importToken, mediaList = [];
|
|
5437
|
-
tokenStream.mustMatch(Tokens.IMPORT_SYM);
|
|
5438
|
-
importToken = tokenStream.token();
|
|
5439
|
-
this._readWhitespace();
|
|
5440
|
-
tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);
|
|
5441
|
-
uri = tokenStream.token().value.replace(/^(?:url\()?["']?([^"']+?)["']?\)?$/, "$1");
|
|
5442
|
-
this._readWhitespace();
|
|
5443
|
-
mediaList = this._media_query_list();
|
|
5444
|
-
tokenStream.mustMatch(Tokens.SEMICOLON);
|
|
5445
|
-
this._readWhitespace();
|
|
5446
|
-
if (emit !== false) {
|
|
5447
|
-
this.fire({
|
|
5448
|
-
type: "import",
|
|
5449
|
-
uri,
|
|
5450
|
-
media: mediaList,
|
|
5451
|
-
line: importToken.startLine,
|
|
5452
|
-
col: importToken.startCol
|
|
5453
|
-
});
|
|
5454
|
-
}
|
|
5455
|
-
},
|
|
5456
|
-
_namespace: function(emit) {
|
|
5457
|
-
var tokenStream = this._tokenStream, line, col, prefix, uri;
|
|
5458
|
-
tokenStream.mustMatch(Tokens.NAMESPACE_SYM);
|
|
5459
|
-
line = tokenStream.token().startLine;
|
|
5460
|
-
col = tokenStream.token().startCol;
|
|
5461
|
-
this._readWhitespace();
|
|
5462
|
-
if (tokenStream.match(Tokens.IDENT)) {
|
|
5463
|
-
prefix = tokenStream.token().value;
|
|
5464
|
-
this._readWhitespace();
|
|
5465
|
-
}
|
|
5466
|
-
tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);
|
|
5467
|
-
uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1");
|
|
5468
|
-
this._readWhitespace();
|
|
5469
|
-
tokenStream.mustMatch(Tokens.SEMICOLON);
|
|
5470
|
-
this._readWhitespace();
|
|
5471
|
-
if (emit !== false) {
|
|
5472
|
-
this.fire({
|
|
5473
|
-
type: "namespace",
|
|
5474
|
-
prefix,
|
|
5475
|
-
uri,
|
|
5476
|
-
line,
|
|
5477
|
-
col
|
|
5478
|
-
});
|
|
5479
|
-
}
|
|
5480
|
-
},
|
|
5481
|
-
_media: function() {
|
|
5482
|
-
var tokenStream = this._tokenStream, line, col, mediaList;
|
|
5483
|
-
tokenStream.mustMatch(Tokens.MEDIA_SYM);
|
|
5484
|
-
line = tokenStream.token().startLine;
|
|
5485
|
-
col = tokenStream.token().startCol;
|
|
5486
|
-
this._readWhitespace();
|
|
5487
|
-
mediaList = this._media_query_list();
|
|
5488
|
-
tokenStream.mustMatch(Tokens.LBRACE);
|
|
5489
|
-
this._readWhitespace();
|
|
5490
|
-
this.fire({
|
|
5491
|
-
type: "startmedia",
|
|
5492
|
-
media: mediaList,
|
|
5493
|
-
line,
|
|
5494
|
-
col
|
|
5495
|
-
});
|
|
5496
|
-
while (true) {
|
|
5497
|
-
if (tokenStream.peek() === Tokens.PAGE_SYM) {
|
|
5498
|
-
this._page();
|
|
5499
|
-
} else if (tokenStream.peek() === Tokens.FONT_FACE_SYM) {
|
|
5500
|
-
this._font_face();
|
|
5501
|
-
} else if (tokenStream.peek() === Tokens.VIEWPORT_SYM) {
|
|
5502
|
-
this._viewport();
|
|
5503
|
-
} else if (tokenStream.peek() === Tokens.DOCUMENT_SYM) {
|
|
5504
|
-
this._document();
|
|
5505
|
-
} else if (!this._ruleset()) {
|
|
5506
|
-
break;
|
|
5507
|
-
}
|
|
5508
|
-
}
|
|
5509
|
-
tokenStream.mustMatch(Tokens.RBRACE);
|
|
5510
|
-
this._readWhitespace();
|
|
5511
|
-
this.fire({
|
|
5512
|
-
type: "endmedia",
|
|
5513
|
-
media: mediaList,
|
|
5514
|
-
line,
|
|
5515
|
-
col
|
|
5516
|
-
});
|
|
5517
|
-
},
|
|
5518
|
-
_media_query_list: function() {
|
|
5519
|
-
var tokenStream = this._tokenStream, mediaList = [];
|
|
5520
|
-
this._readWhitespace();
|
|
5521
|
-
if (tokenStream.peek() === Tokens.IDENT || tokenStream.peek() === Tokens.LPAREN) {
|
|
5522
|
-
mediaList.push(this._media_query());
|
|
5523
|
-
}
|
|
5524
|
-
while (tokenStream.match(Tokens.COMMA)) {
|
|
5525
|
-
this._readWhitespace();
|
|
5526
|
-
mediaList.push(this._media_query());
|
|
5527
|
-
}
|
|
5528
|
-
return mediaList;
|
|
5529
|
-
},
|
|
5530
|
-
_media_query: function() {
|
|
5531
|
-
var tokenStream = this._tokenStream, type = null, ident = null, token = null, expressions = [];
|
|
5532
|
-
if (tokenStream.match(Tokens.IDENT)) {
|
|
5533
|
-
ident = tokenStream.token().value.toLowerCase();
|
|
5534
|
-
if (ident !== "only" && ident !== "not") {
|
|
5535
|
-
tokenStream.unget();
|
|
5536
|
-
ident = null;
|
|
5537
|
-
} else {
|
|
5538
|
-
token = tokenStream.token();
|
|
5539
|
-
}
|
|
5540
|
-
}
|
|
5541
|
-
this._readWhitespace();
|
|
5542
|
-
if (tokenStream.peek() === Tokens.IDENT) {
|
|
5543
|
-
type = this._media_type();
|
|
5544
|
-
if (token === null) {
|
|
5545
|
-
token = tokenStream.token();
|
|
5546
|
-
}
|
|
5547
|
-
} else if (tokenStream.peek() === Tokens.LPAREN) {
|
|
5548
|
-
if (token === null) {
|
|
5549
|
-
token = tokenStream.LT(1);
|
|
5550
|
-
}
|
|
5551
|
-
expressions.push(this._media_expression());
|
|
5552
|
-
}
|
|
5553
|
-
if (type === null && expressions.length === 0) {
|
|
5554
|
-
return null;
|
|
5555
|
-
} else {
|
|
5556
|
-
this._readWhitespace();
|
|
5557
|
-
while (tokenStream.match(Tokens.IDENT)) {
|
|
5558
|
-
if (tokenStream.token().value.toLowerCase() !== "and") {
|
|
5559
|
-
this._unexpectedToken(tokenStream.token());
|
|
5560
|
-
}
|
|
5561
|
-
this._readWhitespace();
|
|
5562
|
-
expressions.push(this._media_expression());
|
|
5563
|
-
}
|
|
5564
|
-
}
|
|
5565
|
-
return new MediaQuery(ident, type, expressions, token.startLine, token.startCol);
|
|
5566
|
-
},
|
|
5567
|
-
_media_type: function() {
|
|
5568
|
-
return this._media_feature();
|
|
5569
|
-
},
|
|
5570
|
-
_media_expression: function() {
|
|
5571
|
-
var tokenStream = this._tokenStream, feature = null, token, expression = null;
|
|
5572
|
-
tokenStream.mustMatch(Tokens.LPAREN);
|
|
5573
|
-
feature = this._media_feature();
|
|
5574
|
-
this._readWhitespace();
|
|
5575
|
-
if (tokenStream.match(Tokens.COLON)) {
|
|
5576
|
-
this._readWhitespace();
|
|
5577
|
-
token = tokenStream.LT(1);
|
|
5578
|
-
expression = this._expression();
|
|
5579
|
-
}
|
|
5580
|
-
tokenStream.mustMatch(Tokens.RPAREN);
|
|
5581
|
-
this._readWhitespace();
|
|
5582
|
-
return new MediaFeature(feature, expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null);
|
|
5583
|
-
},
|
|
5584
|
-
_media_feature: function() {
|
|
5585
|
-
var tokenStream = this._tokenStream;
|
|
5586
|
-
this._readWhitespace();
|
|
5587
|
-
tokenStream.mustMatch(Tokens.IDENT);
|
|
5588
|
-
return SyntaxUnit.fromToken(tokenStream.token());
|
|
5589
|
-
},
|
|
5590
|
-
_page: function() {
|
|
5591
|
-
var tokenStream = this._tokenStream, line, col, identifier = null, pseudoPage = null;
|
|
5592
|
-
tokenStream.mustMatch(Tokens.PAGE_SYM);
|
|
5593
|
-
line = tokenStream.token().startLine;
|
|
5594
|
-
col = tokenStream.token().startCol;
|
|
5595
|
-
this._readWhitespace();
|
|
5596
|
-
if (tokenStream.match(Tokens.IDENT)) {
|
|
5597
|
-
identifier = tokenStream.token().value;
|
|
5598
|
-
if (identifier.toLowerCase() === "auto") {
|
|
5599
|
-
this._unexpectedToken(tokenStream.token());
|
|
5600
|
-
}
|
|
5601
|
-
}
|
|
5602
|
-
if (tokenStream.peek() === Tokens.COLON) {
|
|
5603
|
-
pseudoPage = this._pseudo_page();
|
|
5604
|
-
}
|
|
5605
|
-
this._readWhitespace();
|
|
5606
|
-
this.fire({
|
|
5607
|
-
type: "startpage",
|
|
5608
|
-
id: identifier,
|
|
5609
|
-
pseudo: pseudoPage,
|
|
5610
|
-
line,
|
|
5611
|
-
col
|
|
5612
|
-
});
|
|
5613
|
-
this._readDeclarations(true, true);
|
|
5614
|
-
this.fire({
|
|
5615
|
-
type: "endpage",
|
|
5616
|
-
id: identifier,
|
|
5617
|
-
pseudo: pseudoPage,
|
|
5618
|
-
line,
|
|
5619
|
-
col
|
|
5620
|
-
});
|
|
5621
|
-
},
|
|
5622
|
-
_margin: function() {
|
|
5623
|
-
var tokenStream = this._tokenStream, line, col, marginSym = this._margin_sym();
|
|
5624
|
-
if (marginSym) {
|
|
5625
|
-
line = tokenStream.token().startLine;
|
|
5626
|
-
col = tokenStream.token().startCol;
|
|
5627
|
-
this.fire({
|
|
5628
|
-
type: "startpagemargin",
|
|
5629
|
-
margin: marginSym,
|
|
5630
|
-
line,
|
|
5631
|
-
col
|
|
5632
|
-
});
|
|
5633
|
-
this._readDeclarations(true);
|
|
5634
|
-
this.fire({
|
|
5635
|
-
type: "endpagemargin",
|
|
5636
|
-
margin: marginSym,
|
|
5637
|
-
line,
|
|
5638
|
-
col
|
|
5639
|
-
});
|
|
5640
|
-
return true;
|
|
5641
|
-
} else {
|
|
5642
|
-
return false;
|
|
5643
|
-
}
|
|
5644
|
-
},
|
|
5645
|
-
_margin_sym: function() {
|
|
5646
|
-
var tokenStream = this._tokenStream;
|
|
5647
|
-
if (tokenStream.match([
|
|
5648
|
-
Tokens.TOPLEFTCORNER_SYM,
|
|
5649
|
-
Tokens.TOPLEFT_SYM,
|
|
5650
|
-
Tokens.TOPCENTER_SYM,
|
|
5651
|
-
Tokens.TOPRIGHT_SYM,
|
|
5652
|
-
Tokens.TOPRIGHTCORNER_SYM,
|
|
5653
|
-
Tokens.BOTTOMLEFTCORNER_SYM,
|
|
5654
|
-
Tokens.BOTTOMLEFT_SYM,
|
|
5655
|
-
Tokens.BOTTOMCENTER_SYM,
|
|
5656
|
-
Tokens.BOTTOMRIGHT_SYM,
|
|
5657
|
-
Tokens.BOTTOMRIGHTCORNER_SYM,
|
|
5658
|
-
Tokens.LEFTTOP_SYM,
|
|
5659
|
-
Tokens.LEFTMIDDLE_SYM,
|
|
5660
|
-
Tokens.LEFTBOTTOM_SYM,
|
|
5661
|
-
Tokens.RIGHTTOP_SYM,
|
|
5662
|
-
Tokens.RIGHTMIDDLE_SYM,
|
|
5663
|
-
Tokens.RIGHTBOTTOM_SYM
|
|
5664
|
-
])) {
|
|
5665
|
-
return SyntaxUnit.fromToken(tokenStream.token());
|
|
5666
|
-
} else {
|
|
5667
|
-
return null;
|
|
5668
|
-
}
|
|
5669
|
-
},
|
|
5670
|
-
_pseudo_page: function() {
|
|
5671
|
-
var tokenStream = this._tokenStream;
|
|
5672
|
-
tokenStream.mustMatch(Tokens.COLON);
|
|
5673
|
-
tokenStream.mustMatch(Tokens.IDENT);
|
|
5674
|
-
return tokenStream.token().value;
|
|
5675
|
-
},
|
|
5676
|
-
_font_face: function() {
|
|
5677
|
-
var tokenStream = this._tokenStream, line, col;
|
|
5678
|
-
tokenStream.mustMatch(Tokens.FONT_FACE_SYM);
|
|
5679
|
-
line = tokenStream.token().startLine;
|
|
5680
|
-
col = tokenStream.token().startCol;
|
|
5681
|
-
this._readWhitespace();
|
|
5682
|
-
this.fire({
|
|
5683
|
-
type: "startfontface",
|
|
5684
|
-
line,
|
|
5685
|
-
col
|
|
5686
|
-
});
|
|
5687
|
-
this._readDeclarations(true);
|
|
5688
|
-
this.fire({
|
|
5689
|
-
type: "endfontface",
|
|
5690
|
-
line,
|
|
5691
|
-
col
|
|
5692
|
-
});
|
|
5693
|
-
},
|
|
5694
|
-
_viewport: function() {
|
|
5695
|
-
var tokenStream = this._tokenStream, line, col;
|
|
5696
|
-
tokenStream.mustMatch(Tokens.VIEWPORT_SYM);
|
|
5697
|
-
line = tokenStream.token().startLine;
|
|
5698
|
-
col = tokenStream.token().startCol;
|
|
5699
|
-
this._readWhitespace();
|
|
5700
|
-
this.fire({
|
|
5701
|
-
type: "startviewport",
|
|
5702
|
-
line,
|
|
5703
|
-
col
|
|
5704
|
-
});
|
|
5705
|
-
this._readDeclarations(true);
|
|
5706
|
-
this.fire({
|
|
5707
|
-
type: "endviewport",
|
|
5708
|
-
line,
|
|
5709
|
-
col
|
|
5710
|
-
});
|
|
5711
|
-
},
|
|
5712
|
-
_document: function() {
|
|
5713
|
-
var tokenStream = this._tokenStream, token, functions = [], prefix = "";
|
|
5714
|
-
tokenStream.mustMatch(Tokens.DOCUMENT_SYM);
|
|
5715
|
-
token = tokenStream.token();
|
|
5716
|
-
if (/^@\-([^\-]+)\-/.test(token.value)) {
|
|
5717
|
-
prefix = RegExp.$1;
|
|
5718
|
-
}
|
|
5719
|
-
this._readWhitespace();
|
|
5720
|
-
functions.push(this._document_function());
|
|
5721
|
-
while (tokenStream.match(Tokens.COMMA)) {
|
|
5722
|
-
this._readWhitespace();
|
|
5723
|
-
functions.push(this._document_function());
|
|
5724
|
-
}
|
|
5725
|
-
tokenStream.mustMatch(Tokens.LBRACE);
|
|
5726
|
-
this._readWhitespace();
|
|
5727
|
-
this.fire({
|
|
5728
|
-
type: "startdocument",
|
|
5729
|
-
functions,
|
|
5730
|
-
prefix,
|
|
5731
|
-
line: token.startLine,
|
|
5732
|
-
col: token.startCol
|
|
5733
|
-
});
|
|
5734
|
-
while (true) {
|
|
5735
|
-
if (tokenStream.peek() === Tokens.PAGE_SYM) {
|
|
5736
|
-
this._page();
|
|
5737
|
-
} else if (tokenStream.peek() === Tokens.FONT_FACE_SYM) {
|
|
5738
|
-
this._font_face();
|
|
5739
|
-
} else if (tokenStream.peek() === Tokens.VIEWPORT_SYM) {
|
|
5740
|
-
this._viewport();
|
|
5741
|
-
} else if (tokenStream.peek() === Tokens.MEDIA_SYM) {
|
|
5742
|
-
this._media();
|
|
5743
|
-
} else if (!this._ruleset()) {
|
|
5744
|
-
break;
|
|
5745
|
-
}
|
|
5746
|
-
}
|
|
5747
|
-
tokenStream.mustMatch(Tokens.RBRACE);
|
|
5748
|
-
this._readWhitespace();
|
|
5749
|
-
this.fire({
|
|
5750
|
-
type: "enddocument",
|
|
5751
|
-
functions,
|
|
5752
|
-
prefix,
|
|
5753
|
-
line: token.startLine,
|
|
5754
|
-
col: token.startCol
|
|
5755
|
-
});
|
|
5756
|
-
},
|
|
5757
|
-
_document_function: function() {
|
|
5758
|
-
var tokenStream = this._tokenStream, value;
|
|
5759
|
-
if (tokenStream.match(Tokens.URI)) {
|
|
5760
|
-
value = tokenStream.token().value;
|
|
5761
|
-
this._readWhitespace();
|
|
5762
|
-
} else {
|
|
5763
|
-
value = this._function();
|
|
5764
|
-
}
|
|
5765
|
-
return value;
|
|
5766
|
-
},
|
|
5767
|
-
_operator: function(inFunction) {
|
|
5768
|
-
var tokenStream = this._tokenStream, token = null;
|
|
5769
|
-
if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) || inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS])) {
|
|
5770
|
-
token = tokenStream.token();
|
|
5771
|
-
this._readWhitespace();
|
|
5772
|
-
}
|
|
5773
|
-
return token ? PropertyValuePart.fromToken(token) : null;
|
|
5774
|
-
},
|
|
5775
|
-
_combinator: function() {
|
|
5776
|
-
var tokenStream = this._tokenStream, value = null, token;
|
|
5777
|
-
if (tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])) {
|
|
5778
|
-
token = tokenStream.token();
|
|
5779
|
-
value = new Combinator(token.value, token.startLine, token.startCol);
|
|
5780
|
-
this._readWhitespace();
|
|
5781
|
-
}
|
|
5782
|
-
return value;
|
|
5783
|
-
},
|
|
5784
|
-
_unary_operator: function() {
|
|
5785
|
-
var tokenStream = this._tokenStream;
|
|
5786
|
-
if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])) {
|
|
5787
|
-
return tokenStream.token().value;
|
|
5788
|
-
} else {
|
|
5789
|
-
return null;
|
|
5790
|
-
}
|
|
5791
|
-
},
|
|
5792
|
-
_property: function() {
|
|
5793
|
-
var tokenStream = this._tokenStream, value = null, hack = null, tokenValue, token, line, col;
|
|
5794
|
-
if (tokenStream.peek() === Tokens.STAR && this.options.starHack) {
|
|
5795
|
-
tokenStream.get();
|
|
5796
|
-
token = tokenStream.token();
|
|
5797
|
-
hack = token.value;
|
|
5798
|
-
line = token.startLine;
|
|
5799
|
-
col = token.startCol;
|
|
5800
|
-
}
|
|
5801
|
-
if (tokenStream.match(Tokens.IDENT)) {
|
|
5802
|
-
token = tokenStream.token();
|
|
5803
|
-
tokenValue = token.value;
|
|
5804
|
-
if (tokenValue.charAt(0) === "_" && this.options.underscoreHack) {
|
|
5805
|
-
hack = "_";
|
|
5806
|
-
tokenValue = tokenValue.substring(1);
|
|
5807
|
-
}
|
|
5808
|
-
value = new PropertyName(tokenValue, hack, line || token.startLine, col || token.startCol);
|
|
5809
|
-
this._readWhitespace();
|
|
5810
|
-
}
|
|
5811
|
-
return value;
|
|
5812
|
-
},
|
|
5813
|
-
_ruleset: function() {
|
|
5814
|
-
var tokenStream = this._tokenStream, tt, selectors;
|
|
5815
|
-
try {
|
|
5816
|
-
selectors = this._selectors_group();
|
|
5817
|
-
} catch (ex) {
|
|
5818
|
-
if (ex instanceof SyntaxError2 && !this.options.strict) {
|
|
5819
|
-
this.fire({
|
|
5820
|
-
type: "error",
|
|
5821
|
-
error: ex,
|
|
5822
|
-
message: ex.message,
|
|
5823
|
-
line: ex.line,
|
|
5824
|
-
col: ex.col
|
|
5825
|
-
});
|
|
5826
|
-
tt = tokenStream.advance([Tokens.RBRACE]);
|
|
5827
|
-
if (tt === Tokens.RBRACE) {
|
|
5828
|
-
} else {
|
|
5829
|
-
throw ex;
|
|
5830
|
-
}
|
|
5831
|
-
} else {
|
|
5832
|
-
throw ex;
|
|
5833
|
-
}
|
|
5834
|
-
return true;
|
|
5835
|
-
}
|
|
5836
|
-
if (selectors) {
|
|
5837
|
-
this.fire({
|
|
5838
|
-
type: "startrule",
|
|
5839
|
-
selectors,
|
|
5840
|
-
line: selectors[0].line,
|
|
5841
|
-
col: selectors[0].col
|
|
5842
|
-
});
|
|
5843
|
-
this._readDeclarations(true);
|
|
5844
|
-
this.fire({
|
|
5845
|
-
type: "endrule",
|
|
5846
|
-
selectors,
|
|
5847
|
-
line: selectors[0].line,
|
|
5848
|
-
col: selectors[0].col
|
|
5849
|
-
});
|
|
5850
|
-
}
|
|
5851
|
-
return selectors;
|
|
5852
|
-
},
|
|
5853
|
-
_selectors_group: function() {
|
|
5854
|
-
var tokenStream = this._tokenStream, selectors = [], selector;
|
|
5855
|
-
selector = this._selector();
|
|
5856
|
-
if (selector !== null) {
|
|
5857
|
-
selectors.push(selector);
|
|
5858
|
-
while (tokenStream.match(Tokens.COMMA)) {
|
|
5859
|
-
this._readWhitespace();
|
|
5860
|
-
selector = this._selector();
|
|
5861
|
-
if (selector !== null) {
|
|
5862
|
-
selectors.push(selector);
|
|
5863
|
-
} else {
|
|
5864
|
-
this._unexpectedToken(tokenStream.LT(1));
|
|
5865
|
-
}
|
|
5866
|
-
}
|
|
5867
|
-
}
|
|
5868
|
-
return selectors.length ? selectors : null;
|
|
5869
|
-
},
|
|
5870
|
-
_selector: function() {
|
|
5871
|
-
var tokenStream = this._tokenStream, selector = [], nextSelector = null, combinator = null, ws = null;
|
|
5872
|
-
nextSelector = this._simple_selector_sequence();
|
|
5873
|
-
if (nextSelector === null) {
|
|
5874
|
-
return null;
|
|
5875
|
-
}
|
|
5876
|
-
selector.push(nextSelector);
|
|
5877
|
-
do {
|
|
5878
|
-
combinator = this._combinator();
|
|
5879
|
-
if (combinator !== null) {
|
|
5880
|
-
selector.push(combinator);
|
|
5881
|
-
nextSelector = this._simple_selector_sequence();
|
|
5882
|
-
if (nextSelector === null) {
|
|
5883
|
-
this._unexpectedToken(tokenStream.LT(1));
|
|
5884
|
-
} else {
|
|
5885
|
-
selector.push(nextSelector);
|
|
5886
|
-
}
|
|
5887
|
-
} else {
|
|
5888
|
-
if (this._readWhitespace()) {
|
|
5889
|
-
ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol);
|
|
5890
|
-
combinator = this._combinator();
|
|
5891
|
-
nextSelector = this._simple_selector_sequence();
|
|
5892
|
-
if (nextSelector === null) {
|
|
5893
|
-
if (combinator !== null) {
|
|
5894
|
-
this._unexpectedToken(tokenStream.LT(1));
|
|
5895
|
-
}
|
|
5896
|
-
} else {
|
|
5897
|
-
if (combinator !== null) {
|
|
5898
|
-
selector.push(combinator);
|
|
5899
|
-
} else {
|
|
5900
|
-
selector.push(ws);
|
|
5901
|
-
}
|
|
5902
|
-
selector.push(nextSelector);
|
|
5903
|
-
}
|
|
5904
|
-
} else {
|
|
5905
|
-
break;
|
|
5906
|
-
}
|
|
5907
|
-
}
|
|
5908
|
-
} while (true);
|
|
5909
|
-
return new Selector(selector, selector[0].line, selector[0].col);
|
|
5910
|
-
},
|
|
5911
|
-
_simple_selector_sequence: function() {
|
|
5912
|
-
var tokenStream = this._tokenStream, elementName = null, modifiers = [], selectorText = "", components = [
|
|
5913
|
-
function() {
|
|
5914
|
-
return tokenStream.match(Tokens.HASH) ? new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : null;
|
|
5915
|
-
},
|
|
5916
|
-
this._class,
|
|
5917
|
-
this._attrib,
|
|
5918
|
-
this._pseudo,
|
|
5919
|
-
this._negation
|
|
5920
|
-
], i = 0, len = components.length, component = null, line, col;
|
|
5921
|
-
line = tokenStream.LT(1).startLine;
|
|
5922
|
-
col = tokenStream.LT(1).startCol;
|
|
5923
|
-
elementName = this._type_selector();
|
|
5924
|
-
if (!elementName) {
|
|
5925
|
-
elementName = this._universal();
|
|
5926
|
-
}
|
|
5927
|
-
if (elementName !== null) {
|
|
5928
|
-
selectorText += elementName;
|
|
5929
|
-
}
|
|
5930
|
-
while (true) {
|
|
5931
|
-
if (tokenStream.peek() === Tokens.S) {
|
|
5932
|
-
break;
|
|
5933
|
-
}
|
|
5934
|
-
while (i < len && component === null) {
|
|
5935
|
-
component = components[i++].call(this);
|
|
5936
|
-
}
|
|
5937
|
-
if (component === null) {
|
|
5938
|
-
if (selectorText === "") {
|
|
5939
|
-
return null;
|
|
5940
|
-
} else {
|
|
5941
|
-
break;
|
|
5942
|
-
}
|
|
5943
|
-
} else {
|
|
5944
|
-
i = 0;
|
|
5945
|
-
modifiers.push(component);
|
|
5946
|
-
selectorText += component.toString();
|
|
5947
|
-
component = null;
|
|
5948
|
-
}
|
|
5949
|
-
}
|
|
5950
|
-
return selectorText !== "" ? new SelectorPart(elementName, modifiers, selectorText, line, col) : null;
|
|
5951
|
-
},
|
|
5952
|
-
_type_selector: function() {
|
|
5953
|
-
var tokenStream = this._tokenStream, ns = this._namespace_prefix(), elementName = this._element_name();
|
|
5954
|
-
if (!elementName) {
|
|
5955
|
-
if (ns) {
|
|
5956
|
-
tokenStream.unget();
|
|
5957
|
-
if (ns.length > 1) {
|
|
5958
|
-
tokenStream.unget();
|
|
5959
|
-
}
|
|
5960
|
-
}
|
|
5961
|
-
return null;
|
|
5962
|
-
} else {
|
|
5963
|
-
if (ns) {
|
|
5964
|
-
elementName.text = ns + elementName.text;
|
|
5965
|
-
elementName.col -= ns.length;
|
|
5966
|
-
}
|
|
5967
|
-
return elementName;
|
|
5968
|
-
}
|
|
5969
|
-
},
|
|
5970
|
-
_class: function() {
|
|
5971
|
-
var tokenStream = this._tokenStream, token;
|
|
5972
|
-
if (tokenStream.match(Tokens.DOT)) {
|
|
5973
|
-
tokenStream.mustMatch(Tokens.IDENT);
|
|
5974
|
-
token = tokenStream.token();
|
|
5975
|
-
return new SelectorSubPart("." + token.value, "class", token.startLine, token.startCol - 1);
|
|
5976
|
-
} else {
|
|
5977
|
-
return null;
|
|
5978
|
-
}
|
|
5979
|
-
},
|
|
5980
|
-
_element_name: function() {
|
|
5981
|
-
var tokenStream = this._tokenStream, token;
|
|
5982
|
-
if (tokenStream.match(Tokens.IDENT)) {
|
|
5983
|
-
token = tokenStream.token();
|
|
5984
|
-
return new SelectorSubPart(token.value, "elementName", token.startLine, token.startCol);
|
|
5985
|
-
} else {
|
|
5986
|
-
return null;
|
|
5987
|
-
}
|
|
5988
|
-
},
|
|
5989
|
-
_namespace_prefix: function() {
|
|
5990
|
-
var tokenStream = this._tokenStream, value = "";
|
|
5991
|
-
if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE) {
|
|
5992
|
-
if (tokenStream.match([Tokens.IDENT, Tokens.STAR])) {
|
|
5993
|
-
value += tokenStream.token().value;
|
|
5994
|
-
}
|
|
5995
|
-
tokenStream.mustMatch(Tokens.PIPE);
|
|
5996
|
-
value += "|";
|
|
5997
|
-
}
|
|
5998
|
-
return value.length ? value : null;
|
|
5999
|
-
},
|
|
6000
|
-
_universal: function() {
|
|
6001
|
-
var tokenStream = this._tokenStream, value = "", ns;
|
|
6002
|
-
ns = this._namespace_prefix();
|
|
6003
|
-
if (ns) {
|
|
6004
|
-
value += ns;
|
|
6005
|
-
}
|
|
6006
|
-
if (tokenStream.match(Tokens.STAR)) {
|
|
6007
|
-
value += "*";
|
|
6008
|
-
}
|
|
6009
|
-
return value.length ? value : null;
|
|
6010
|
-
},
|
|
6011
|
-
_attrib: function() {
|
|
6012
|
-
var tokenStream = this._tokenStream, value = null, ns, token;
|
|
6013
|
-
if (tokenStream.match(Tokens.LBRACKET)) {
|
|
6014
|
-
token = tokenStream.token();
|
|
6015
|
-
value = token.value;
|
|
6016
|
-
value += this._readWhitespace();
|
|
6017
|
-
ns = this._namespace_prefix();
|
|
6018
|
-
if (ns) {
|
|
6019
|
-
value += ns;
|
|
6020
|
-
}
|
|
6021
|
-
tokenStream.mustMatch(Tokens.IDENT);
|
|
6022
|
-
value += tokenStream.token().value;
|
|
6023
|
-
value += this._readWhitespace();
|
|
6024
|
-
if (tokenStream.match([
|
|
6025
|
-
Tokens.PREFIXMATCH,
|
|
6026
|
-
Tokens.SUFFIXMATCH,
|
|
6027
|
-
Tokens.SUBSTRINGMATCH,
|
|
6028
|
-
Tokens.EQUALS,
|
|
6029
|
-
Tokens.INCLUDES,
|
|
6030
|
-
Tokens.DASHMATCH
|
|
6031
|
-
])) {
|
|
6032
|
-
value += tokenStream.token().value;
|
|
6033
|
-
value += this._readWhitespace();
|
|
6034
|
-
tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]);
|
|
6035
|
-
value += tokenStream.token().value;
|
|
6036
|
-
value += this._readWhitespace();
|
|
6037
|
-
}
|
|
6038
|
-
tokenStream.mustMatch(Tokens.RBRACKET);
|
|
6039
|
-
return new SelectorSubPart(value + "]", "attribute", token.startLine, token.startCol);
|
|
6040
|
-
} else {
|
|
6041
|
-
return null;
|
|
6042
|
-
}
|
|
6043
|
-
},
|
|
6044
|
-
_pseudo: function() {
|
|
6045
|
-
var tokenStream = this._tokenStream, pseudo = null, colons = ":", line, col;
|
|
6046
|
-
if (tokenStream.match(Tokens.COLON)) {
|
|
6047
|
-
if (tokenStream.match(Tokens.COLON)) {
|
|
6048
|
-
colons += ":";
|
|
6049
|
-
}
|
|
6050
|
-
if (tokenStream.match(Tokens.IDENT)) {
|
|
6051
|
-
pseudo = tokenStream.token().value;
|
|
6052
|
-
line = tokenStream.token().startLine;
|
|
6053
|
-
col = tokenStream.token().startCol - colons.length;
|
|
6054
|
-
} else if (tokenStream.peek() === Tokens.FUNCTION) {
|
|
6055
|
-
line = tokenStream.LT(1).startLine;
|
|
6056
|
-
col = tokenStream.LT(1).startCol - colons.length;
|
|
6057
|
-
pseudo = this._functional_pseudo();
|
|
6058
|
-
}
|
|
6059
|
-
if (pseudo) {
|
|
6060
|
-
pseudo = new SelectorSubPart(colons + pseudo, "pseudo", line, col);
|
|
6061
|
-
}
|
|
6062
|
-
}
|
|
6063
|
-
return pseudo;
|
|
6064
|
-
},
|
|
6065
|
-
_functional_pseudo: function() {
|
|
6066
|
-
var tokenStream = this._tokenStream, value = null;
|
|
6067
|
-
if (tokenStream.match(Tokens.FUNCTION)) {
|
|
6068
|
-
value = tokenStream.token().value;
|
|
6069
|
-
value += this._readWhitespace();
|
|
6070
|
-
value += this._expression();
|
|
6071
|
-
tokenStream.mustMatch(Tokens.RPAREN);
|
|
6072
|
-
value += ")";
|
|
6073
|
-
}
|
|
6074
|
-
return value;
|
|
6075
|
-
},
|
|
6076
|
-
_expression: function() {
|
|
6077
|
-
var tokenStream = this._tokenStream, value = "";
|
|
6078
|
-
while (tokenStream.match([
|
|
6079
|
-
Tokens.PLUS,
|
|
6080
|
-
Tokens.MINUS,
|
|
6081
|
-
Tokens.DIMENSION,
|
|
6082
|
-
Tokens.NUMBER,
|
|
6083
|
-
Tokens.STRING,
|
|
6084
|
-
Tokens.IDENT,
|
|
6085
|
-
Tokens.LENGTH,
|
|
6086
|
-
Tokens.FREQ,
|
|
6087
|
-
Tokens.ANGLE,
|
|
6088
|
-
Tokens.TIME,
|
|
6089
|
-
Tokens.RESOLUTION,
|
|
6090
|
-
Tokens.SLASH
|
|
6091
|
-
])) {
|
|
6092
|
-
value += tokenStream.token().value;
|
|
6093
|
-
value += this._readWhitespace();
|
|
6094
|
-
}
|
|
6095
|
-
return value.length ? value : null;
|
|
6096
|
-
},
|
|
6097
|
-
_negation: function() {
|
|
6098
|
-
var tokenStream = this._tokenStream, line, col, value = "", arg, subpart = null;
|
|
6099
|
-
if (tokenStream.match(Tokens.NOT)) {
|
|
6100
|
-
value = tokenStream.token().value;
|
|
6101
|
-
line = tokenStream.token().startLine;
|
|
6102
|
-
col = tokenStream.token().startCol;
|
|
6103
|
-
value += this._readWhitespace();
|
|
6104
|
-
arg = this._negation_arg();
|
|
6105
|
-
value += arg;
|
|
6106
|
-
value += this._readWhitespace();
|
|
6107
|
-
tokenStream.match(Tokens.RPAREN);
|
|
6108
|
-
value += tokenStream.token().value;
|
|
6109
|
-
subpart = new SelectorSubPart(value, "not", line, col);
|
|
6110
|
-
subpart.args.push(arg);
|
|
6111
|
-
}
|
|
6112
|
-
return subpart;
|
|
6113
|
-
},
|
|
6114
|
-
_negation_arg: function() {
|
|
6115
|
-
var tokenStream = this._tokenStream, args = [
|
|
6116
|
-
this._type_selector,
|
|
6117
|
-
this._universal,
|
|
6118
|
-
function() {
|
|
6119
|
-
return tokenStream.match(Tokens.HASH) ? new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : null;
|
|
6120
|
-
},
|
|
6121
|
-
this._class,
|
|
6122
|
-
this._attrib,
|
|
6123
|
-
this._pseudo
|
|
6124
|
-
], arg = null, i = 0, len = args.length, line, col, part;
|
|
6125
|
-
line = tokenStream.LT(1).startLine;
|
|
6126
|
-
col = tokenStream.LT(1).startCol;
|
|
6127
|
-
while (i < len && arg === null) {
|
|
6128
|
-
arg = args[i].call(this);
|
|
6129
|
-
i++;
|
|
6130
|
-
}
|
|
6131
|
-
if (arg === null) {
|
|
6132
|
-
this._unexpectedToken(tokenStream.LT(1));
|
|
6133
|
-
}
|
|
6134
|
-
if (arg.type === "elementName") {
|
|
6135
|
-
part = new SelectorPart(arg, [], arg.toString(), line, col);
|
|
6136
|
-
} else {
|
|
6137
|
-
part = new SelectorPart(null, [arg], arg.toString(), line, col);
|
|
6138
|
-
}
|
|
6139
|
-
return part;
|
|
6140
|
-
},
|
|
6141
|
-
_declaration: function() {
|
|
6142
|
-
var tokenStream = this._tokenStream, property = null, expr = null, prio = null, invalid = null, propertyName = "";
|
|
6143
|
-
property = this._property();
|
|
6144
|
-
if (property !== null) {
|
|
6145
|
-
tokenStream.mustMatch(Tokens.COLON);
|
|
6146
|
-
this._readWhitespace();
|
|
6147
|
-
expr = this._expr();
|
|
6148
|
-
if (!expr || expr.length === 0) {
|
|
6149
|
-
this._unexpectedToken(tokenStream.LT(1));
|
|
6150
|
-
}
|
|
6151
|
-
prio = this._prio();
|
|
6152
|
-
propertyName = property.toString();
|
|
6153
|
-
if (this.options.starHack && property.hack === "*" || this.options.underscoreHack && property.hack === "_") {
|
|
6154
|
-
propertyName = property.text;
|
|
6155
|
-
}
|
|
6156
|
-
try {
|
|
6157
|
-
this._validateProperty(propertyName, expr);
|
|
6158
|
-
} catch (ex) {
|
|
6159
|
-
invalid = ex;
|
|
6160
|
-
}
|
|
6161
|
-
this.fire({
|
|
6162
|
-
type: "property",
|
|
6163
|
-
property,
|
|
6164
|
-
value: expr,
|
|
6165
|
-
important: prio,
|
|
6166
|
-
line: property.line,
|
|
6167
|
-
col: property.col,
|
|
6168
|
-
invalid
|
|
6169
|
-
});
|
|
6170
|
-
return true;
|
|
6171
|
-
} else {
|
|
6172
|
-
return false;
|
|
6173
|
-
}
|
|
6174
|
-
},
|
|
6175
|
-
_prio: function() {
|
|
6176
|
-
var tokenStream = this._tokenStream, result = tokenStream.match(Tokens.IMPORTANT_SYM);
|
|
6177
|
-
this._readWhitespace();
|
|
6178
|
-
return result;
|
|
6179
|
-
},
|
|
6180
|
-
_expr: function(inFunction) {
|
|
6181
|
-
var values = [], value = null, operator = null;
|
|
6182
|
-
value = this._term(inFunction);
|
|
6183
|
-
if (value !== null) {
|
|
6184
|
-
values.push(value);
|
|
6185
|
-
do {
|
|
6186
|
-
operator = this._operator(inFunction);
|
|
6187
|
-
if (operator) {
|
|
6188
|
-
values.push(operator);
|
|
6189
|
-
}
|
|
6190
|
-
value = this._term(inFunction);
|
|
6191
|
-
if (value === null) {
|
|
6192
|
-
break;
|
|
6193
|
-
} else {
|
|
6194
|
-
values.push(value);
|
|
6195
|
-
}
|
|
6196
|
-
} while (true);
|
|
6197
|
-
}
|
|
6198
|
-
return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null;
|
|
6199
|
-
},
|
|
6200
|
-
_term: function(inFunction) {
|
|
6201
|
-
var tokenStream = this._tokenStream, unary = null, value = null, endChar = null, token, line, col;
|
|
6202
|
-
unary = this._unary_operator();
|
|
6203
|
-
if (unary !== null) {
|
|
6204
|
-
line = tokenStream.token().startLine;
|
|
6205
|
-
col = tokenStream.token().startCol;
|
|
6206
|
-
}
|
|
6207
|
-
if (tokenStream.peek() === Tokens.IE_FUNCTION && this.options.ieFilters) {
|
|
6208
|
-
value = this._ie_function();
|
|
6209
|
-
if (unary === null) {
|
|
6210
|
-
line = tokenStream.token().startLine;
|
|
6211
|
-
col = tokenStream.token().startCol;
|
|
6212
|
-
}
|
|
6213
|
-
} else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])) {
|
|
6214
|
-
token = tokenStream.token();
|
|
6215
|
-
endChar = token.endChar;
|
|
6216
|
-
value = token.value + this._expr(inFunction).text;
|
|
6217
|
-
if (unary === null) {
|
|
6218
|
-
line = tokenStream.token().startLine;
|
|
6219
|
-
col = tokenStream.token().startCol;
|
|
6220
|
-
}
|
|
6221
|
-
tokenStream.mustMatch(Tokens.type(endChar));
|
|
6222
|
-
value += endChar;
|
|
6223
|
-
this._readWhitespace();
|
|
6224
|
-
} else if (tokenStream.match([
|
|
6225
|
-
Tokens.NUMBER,
|
|
6226
|
-
Tokens.PERCENTAGE,
|
|
6227
|
-
Tokens.LENGTH,
|
|
6228
|
-
Tokens.ANGLE,
|
|
6229
|
-
Tokens.TIME,
|
|
6230
|
-
Tokens.FREQ,
|
|
6231
|
-
Tokens.STRING,
|
|
6232
|
-
Tokens.IDENT,
|
|
6233
|
-
Tokens.URI,
|
|
6234
|
-
Tokens.UNICODE_RANGE
|
|
6235
|
-
])) {
|
|
6236
|
-
value = tokenStream.token().value;
|
|
6237
|
-
if (unary === null) {
|
|
6238
|
-
line = tokenStream.token().startLine;
|
|
6239
|
-
col = tokenStream.token().startCol;
|
|
6240
|
-
}
|
|
6241
|
-
this._readWhitespace();
|
|
6242
|
-
} else {
|
|
6243
|
-
token = this._hexcolor();
|
|
6244
|
-
if (token === null) {
|
|
6245
|
-
if (unary === null) {
|
|
6246
|
-
line = tokenStream.LT(1).startLine;
|
|
6247
|
-
col = tokenStream.LT(1).startCol;
|
|
6248
|
-
}
|
|
6249
|
-
if (value === null) {
|
|
6250
|
-
if (tokenStream.LA(3) === Tokens.EQUALS && this.options.ieFilters) {
|
|
6251
|
-
value = this._ie_function();
|
|
6252
|
-
} else {
|
|
6253
|
-
value = this._function();
|
|
6254
|
-
}
|
|
6255
|
-
}
|
|
6256
|
-
} else {
|
|
6257
|
-
value = token.value;
|
|
6258
|
-
if (unary === null) {
|
|
6259
|
-
line = token.startLine;
|
|
6260
|
-
col = token.startCol;
|
|
6261
|
-
}
|
|
6262
|
-
}
|
|
6263
|
-
}
|
|
6264
|
-
return value !== null ? new PropertyValuePart(unary !== null ? unary + value : value, line, col) : null;
|
|
6265
|
-
},
|
|
6266
|
-
_function: function() {
|
|
6267
|
-
var tokenStream = this._tokenStream, functionText = null, expr = null, lt;
|
|
6268
|
-
if (tokenStream.match(Tokens.FUNCTION)) {
|
|
6269
|
-
functionText = tokenStream.token().value;
|
|
6270
|
-
this._readWhitespace();
|
|
6271
|
-
expr = this._expr(true);
|
|
6272
|
-
functionText += expr;
|
|
6273
|
-
if (this.options.ieFilters && tokenStream.peek() === Tokens.EQUALS) {
|
|
6274
|
-
do {
|
|
6275
|
-
if (this._readWhitespace()) {
|
|
6276
|
-
functionText += tokenStream.token().value;
|
|
6277
|
-
}
|
|
6278
|
-
if (tokenStream.LA(0) === Tokens.COMMA) {
|
|
6279
|
-
functionText += tokenStream.token().value;
|
|
6280
|
-
}
|
|
6281
|
-
tokenStream.match(Tokens.IDENT);
|
|
6282
|
-
functionText += tokenStream.token().value;
|
|
6283
|
-
tokenStream.match(Tokens.EQUALS);
|
|
6284
|
-
functionText += tokenStream.token().value;
|
|
6285
|
-
lt = tokenStream.peek();
|
|
6286
|
-
while (lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN) {
|
|
6287
|
-
tokenStream.get();
|
|
6288
|
-
functionText += tokenStream.token().value;
|
|
6289
|
-
lt = tokenStream.peek();
|
|
6290
|
-
}
|
|
6291
|
-
} while (tokenStream.match([Tokens.COMMA, Tokens.S]));
|
|
6292
|
-
}
|
|
6293
|
-
tokenStream.match(Tokens.RPAREN);
|
|
6294
|
-
functionText += ")";
|
|
6295
|
-
this._readWhitespace();
|
|
6296
|
-
}
|
|
6297
|
-
return functionText;
|
|
6298
|
-
},
|
|
6299
|
-
_ie_function: function() {
|
|
6300
|
-
var tokenStream = this._tokenStream, functionText = null, lt;
|
|
6301
|
-
if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])) {
|
|
6302
|
-
functionText = tokenStream.token().value;
|
|
6303
|
-
do {
|
|
6304
|
-
if (this._readWhitespace()) {
|
|
6305
|
-
functionText += tokenStream.token().value;
|
|
6306
|
-
}
|
|
6307
|
-
if (tokenStream.LA(0) === Tokens.COMMA) {
|
|
6308
|
-
functionText += tokenStream.token().value;
|
|
6309
|
-
}
|
|
6310
|
-
tokenStream.match(Tokens.IDENT);
|
|
6311
|
-
functionText += tokenStream.token().value;
|
|
6312
|
-
tokenStream.match(Tokens.EQUALS);
|
|
6313
|
-
functionText += tokenStream.token().value;
|
|
6314
|
-
lt = tokenStream.peek();
|
|
6315
|
-
while (lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN) {
|
|
6316
|
-
tokenStream.get();
|
|
6317
|
-
functionText += tokenStream.token().value;
|
|
6318
|
-
lt = tokenStream.peek();
|
|
6319
|
-
}
|
|
6320
|
-
} while (tokenStream.match([Tokens.COMMA, Tokens.S]));
|
|
6321
|
-
tokenStream.match(Tokens.RPAREN);
|
|
6322
|
-
functionText += ")";
|
|
6323
|
-
this._readWhitespace();
|
|
6324
|
-
}
|
|
6325
|
-
return functionText;
|
|
6326
|
-
},
|
|
6327
|
-
_hexcolor: function() {
|
|
6328
|
-
var tokenStream = this._tokenStream, token = null, color;
|
|
6329
|
-
if (tokenStream.match(Tokens.HASH)) {
|
|
6330
|
-
token = tokenStream.token();
|
|
6331
|
-
color = token.value;
|
|
6332
|
-
if (!/#[a-f0-9]{3,6}/i.test(color)) {
|
|
6333
|
-
throw new SyntaxError2("Expected a hex color but found '" + color + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
|
|
6334
|
-
}
|
|
6335
|
-
this._readWhitespace();
|
|
6336
|
-
}
|
|
6337
|
-
return token;
|
|
6338
|
-
},
|
|
6339
|
-
_keyframes: function() {
|
|
6340
|
-
var tokenStream = this._tokenStream, token, tt, name, prefix = "";
|
|
6341
|
-
tokenStream.mustMatch(Tokens.KEYFRAMES_SYM);
|
|
6342
|
-
token = tokenStream.token();
|
|
6343
|
-
if (/^@\-([^\-]+)\-/.test(token.value)) {
|
|
6344
|
-
prefix = RegExp.$1;
|
|
6345
|
-
}
|
|
6346
|
-
this._readWhitespace();
|
|
6347
|
-
name = this._keyframe_name();
|
|
6348
|
-
this._readWhitespace();
|
|
6349
|
-
tokenStream.mustMatch(Tokens.LBRACE);
|
|
6350
|
-
this.fire({
|
|
6351
|
-
type: "startkeyframes",
|
|
6352
|
-
name,
|
|
6353
|
-
prefix,
|
|
6354
|
-
line: token.startLine,
|
|
6355
|
-
col: token.startCol
|
|
6356
|
-
});
|
|
6357
|
-
this._readWhitespace();
|
|
6358
|
-
tt = tokenStream.peek();
|
|
6359
|
-
while (tt === Tokens.IDENT || tt === Tokens.PERCENTAGE) {
|
|
6360
|
-
this._keyframe_rule();
|
|
6361
|
-
this._readWhitespace();
|
|
6362
|
-
tt = tokenStream.peek();
|
|
6363
|
-
}
|
|
6364
|
-
this.fire({
|
|
6365
|
-
type: "endkeyframes",
|
|
6366
|
-
name,
|
|
6367
|
-
prefix,
|
|
6368
|
-
line: token.startLine,
|
|
6369
|
-
col: token.startCol
|
|
6370
|
-
});
|
|
6371
|
-
this._readWhitespace();
|
|
6372
|
-
tokenStream.mustMatch(Tokens.RBRACE);
|
|
6373
|
-
},
|
|
6374
|
-
_keyframe_name: function() {
|
|
6375
|
-
var tokenStream = this._tokenStream;
|
|
6376
|
-
tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]);
|
|
6377
|
-
return SyntaxUnit.fromToken(tokenStream.token());
|
|
6378
|
-
},
|
|
6379
|
-
_keyframe_rule: function() {
|
|
6380
|
-
var keyList = this._key_list();
|
|
6381
|
-
this.fire({
|
|
6382
|
-
type: "startkeyframerule",
|
|
6383
|
-
keys: keyList,
|
|
6384
|
-
line: keyList[0].line,
|
|
6385
|
-
col: keyList[0].col
|
|
6386
|
-
});
|
|
6387
|
-
this._readDeclarations(true);
|
|
6388
|
-
this.fire({
|
|
6389
|
-
type: "endkeyframerule",
|
|
6390
|
-
keys: keyList,
|
|
6391
|
-
line: keyList[0].line,
|
|
6392
|
-
col: keyList[0].col
|
|
6393
|
-
});
|
|
6394
|
-
},
|
|
6395
|
-
_key_list: function() {
|
|
6396
|
-
var tokenStream = this._tokenStream, keyList = [];
|
|
6397
|
-
keyList.push(this._key());
|
|
6398
|
-
this._readWhitespace();
|
|
6399
|
-
while (tokenStream.match(Tokens.COMMA)) {
|
|
6400
|
-
this._readWhitespace();
|
|
6401
|
-
keyList.push(this._key());
|
|
6402
|
-
this._readWhitespace();
|
|
6403
|
-
}
|
|
6404
|
-
return keyList;
|
|
6405
|
-
},
|
|
6406
|
-
_key: function() {
|
|
6407
|
-
var tokenStream = this._tokenStream, token;
|
|
6408
|
-
if (tokenStream.match(Tokens.PERCENTAGE)) {
|
|
6409
|
-
return SyntaxUnit.fromToken(tokenStream.token());
|
|
6410
|
-
} else if (tokenStream.match(Tokens.IDENT)) {
|
|
6411
|
-
token = tokenStream.token();
|
|
6412
|
-
if (/from|to/i.test(token.value)) {
|
|
6413
|
-
return SyntaxUnit.fromToken(token);
|
|
6414
|
-
}
|
|
6415
|
-
tokenStream.unget();
|
|
6416
|
-
}
|
|
6417
|
-
this._unexpectedToken(tokenStream.LT(1));
|
|
6418
|
-
},
|
|
6419
|
-
_skipCruft: function() {
|
|
6420
|
-
while (this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])) {
|
|
6421
|
-
}
|
|
6422
|
-
},
|
|
6423
|
-
_readDeclarations: function(checkStart, readMargins) {
|
|
6424
|
-
var tokenStream = this._tokenStream, tt;
|
|
6425
|
-
this._readWhitespace();
|
|
6426
|
-
if (checkStart) {
|
|
6427
|
-
tokenStream.mustMatch(Tokens.LBRACE);
|
|
6428
|
-
}
|
|
6429
|
-
this._readWhitespace();
|
|
6430
|
-
try {
|
|
6431
|
-
while (true) {
|
|
6432
|
-
if (tokenStream.match(Tokens.SEMICOLON) || readMargins && this._margin()) {
|
|
6433
|
-
} else if (this._declaration()) {
|
|
6434
|
-
if (!tokenStream.match(Tokens.SEMICOLON)) {
|
|
6435
|
-
break;
|
|
6436
|
-
}
|
|
6437
|
-
} else {
|
|
6438
|
-
break;
|
|
6439
|
-
}
|
|
6440
|
-
this._readWhitespace();
|
|
6441
|
-
}
|
|
6442
|
-
tokenStream.mustMatch(Tokens.RBRACE);
|
|
6443
|
-
this._readWhitespace();
|
|
6444
|
-
} catch (ex) {
|
|
6445
|
-
if (ex instanceof SyntaxError2 && !this.options.strict) {
|
|
6446
|
-
this.fire({
|
|
6447
|
-
type: "error",
|
|
6448
|
-
error: ex,
|
|
6449
|
-
message: ex.message,
|
|
6450
|
-
line: ex.line,
|
|
6451
|
-
col: ex.col
|
|
6452
|
-
});
|
|
6453
|
-
tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]);
|
|
6454
|
-
if (tt === Tokens.SEMICOLON) {
|
|
6455
|
-
this._readDeclarations(false, readMargins);
|
|
6456
|
-
} else if (tt !== Tokens.RBRACE) {
|
|
6457
|
-
throw ex;
|
|
6458
|
-
}
|
|
6459
|
-
} else {
|
|
6460
|
-
throw ex;
|
|
6461
|
-
}
|
|
6462
|
-
}
|
|
6463
|
-
},
|
|
6464
|
-
_readWhitespace: function() {
|
|
6465
|
-
var tokenStream = this._tokenStream, ws = "";
|
|
6466
|
-
while (tokenStream.match(Tokens.S)) {
|
|
6467
|
-
ws += tokenStream.token().value;
|
|
6468
|
-
}
|
|
6469
|
-
return ws;
|
|
6470
|
-
},
|
|
6471
|
-
_unexpectedToken: function(token) {
|
|
6472
|
-
throw new SyntaxError2("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
|
|
6473
|
-
},
|
|
6474
|
-
_verifyEnd: function() {
|
|
6475
|
-
if (this._tokenStream.LA(1) !== Tokens.EOF) {
|
|
6476
|
-
this._unexpectedToken(this._tokenStream.LT(1));
|
|
6477
|
-
}
|
|
6478
|
-
},
|
|
6479
|
-
_validateProperty: function(property, value) {
|
|
6480
|
-
Validation.validate(property, value);
|
|
6481
|
-
},
|
|
6482
|
-
parse: function(input) {
|
|
6483
|
-
this._tokenStream = new TokenStream(input, Tokens);
|
|
6484
|
-
this._stylesheet();
|
|
6485
|
-
},
|
|
6486
|
-
parseStyleSheet: function(input) {
|
|
6487
|
-
return this.parse(input);
|
|
6488
|
-
},
|
|
6489
|
-
parseMediaQuery: function(input) {
|
|
6490
|
-
this._tokenStream = new TokenStream(input, Tokens);
|
|
6491
|
-
var result = this._media_query();
|
|
6492
|
-
this._verifyEnd();
|
|
6493
|
-
return result;
|
|
6494
|
-
},
|
|
6495
|
-
parsePropertyValue: function(input) {
|
|
6496
|
-
this._tokenStream = new TokenStream(input, Tokens);
|
|
6497
|
-
this._readWhitespace();
|
|
6498
|
-
var result = this._expr();
|
|
6499
|
-
this._readWhitespace();
|
|
6500
|
-
this._verifyEnd();
|
|
6501
|
-
return result;
|
|
6502
|
-
},
|
|
6503
|
-
parseRule: function(input) {
|
|
6504
|
-
this._tokenStream = new TokenStream(input, Tokens);
|
|
6505
|
-
this._readWhitespace();
|
|
6506
|
-
var result = this._ruleset();
|
|
6507
|
-
this._readWhitespace();
|
|
6508
|
-
this._verifyEnd();
|
|
6509
|
-
return result;
|
|
6510
|
-
},
|
|
6511
|
-
parseSelector: function(input) {
|
|
6512
|
-
this._tokenStream = new TokenStream(input, Tokens);
|
|
6513
|
-
this._readWhitespace();
|
|
6514
|
-
var result = this._selector();
|
|
6515
|
-
this._readWhitespace();
|
|
6516
|
-
this._verifyEnd();
|
|
6517
|
-
return result;
|
|
6518
|
-
},
|
|
6519
|
-
parseStyleAttribute: function(input) {
|
|
6520
|
-
input += "}";
|
|
6521
|
-
this._tokenStream = new TokenStream(input, Tokens);
|
|
6522
|
-
this._readDeclarations();
|
|
6523
|
-
}
|
|
6524
|
-
};
|
|
6525
|
-
for (prop in additions) {
|
|
6526
|
-
if (Object.prototype.hasOwnProperty.call(additions, prop)) {
|
|
6527
|
-
proto[prop] = additions[prop];
|
|
6528
|
-
}
|
|
6529
|
-
}
|
|
6530
|
-
return proto;
|
|
6531
|
-
}();
|
|
6532
|
-
var Properties = {
|
|
6533
|
-
__proto__: null,
|
|
6534
|
-
"align-items": "flex-start | flex-end | center | baseline | stretch",
|
|
6535
|
-
"align-content": "flex-start | flex-end | center | space-between | space-around | stretch",
|
|
6536
|
-
"align-self": "auto | flex-start | flex-end | center | baseline | stretch",
|
|
6537
|
-
"-webkit-align-items": "flex-start | flex-end | center | baseline | stretch",
|
|
6538
|
-
"-webkit-align-content": "flex-start | flex-end | center | space-between | space-around | stretch",
|
|
6539
|
-
"-webkit-align-self": "auto | flex-start | flex-end | center | baseline | stretch",
|
|
6540
|
-
"alignment-adjust": "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | <percentage> | <length>",
|
|
6541
|
-
"alignment-baseline": "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
|
|
6542
|
-
"animation": 1,
|
|
6543
|
-
"animation-delay": { multi: "<time>", comma: true },
|
|
6544
|
-
"animation-direction": { multi: "normal | alternate", comma: true },
|
|
6545
|
-
"animation-duration": { multi: "<time>", comma: true },
|
|
6546
|
-
"animation-fill-mode": { multi: "none | forwards | backwards | both", comma: true },
|
|
6547
|
-
"animation-iteration-count": { multi: "<number> | infinite", comma: true },
|
|
6548
|
-
"animation-name": { multi: "none | <ident>", comma: true },
|
|
6549
|
-
"animation-play-state": { multi: "running | paused", comma: true },
|
|
6550
|
-
"animation-timing-function": 1,
|
|
6551
|
-
"-moz-animation-delay": { multi: "<time>", comma: true },
|
|
6552
|
-
"-moz-animation-direction": { multi: "normal | alternate", comma: true },
|
|
6553
|
-
"-moz-animation-duration": { multi: "<time>", comma: true },
|
|
6554
|
-
"-moz-animation-iteration-count": { multi: "<number> | infinite", comma: true },
|
|
6555
|
-
"-moz-animation-name": { multi: "none | <ident>", comma: true },
|
|
6556
|
-
"-moz-animation-play-state": { multi: "running | paused", comma: true },
|
|
6557
|
-
"-ms-animation-delay": { multi: "<time>", comma: true },
|
|
6558
|
-
"-ms-animation-direction": { multi: "normal | alternate", comma: true },
|
|
6559
|
-
"-ms-animation-duration": { multi: "<time>", comma: true },
|
|
6560
|
-
"-ms-animation-iteration-count": { multi: "<number> | infinite", comma: true },
|
|
6561
|
-
"-ms-animation-name": { multi: "none | <ident>", comma: true },
|
|
6562
|
-
"-ms-animation-play-state": { multi: "running | paused", comma: true },
|
|
6563
|
-
"-webkit-animation-delay": { multi: "<time>", comma: true },
|
|
6564
|
-
"-webkit-animation-direction": { multi: "normal | alternate", comma: true },
|
|
6565
|
-
"-webkit-animation-duration": { multi: "<time>", comma: true },
|
|
6566
|
-
"-webkit-animation-fill-mode": { multi: "none | forwards | backwards | both", comma: true },
|
|
6567
|
-
"-webkit-animation-iteration-count": { multi: "<number> | infinite", comma: true },
|
|
6568
|
-
"-webkit-animation-name": { multi: "none | <ident>", comma: true },
|
|
6569
|
-
"-webkit-animation-play-state": { multi: "running | paused", comma: true },
|
|
6570
|
-
"-o-animation-delay": { multi: "<time>", comma: true },
|
|
6571
|
-
"-o-animation-direction": { multi: "normal | alternate", comma: true },
|
|
6572
|
-
"-o-animation-duration": { multi: "<time>", comma: true },
|
|
6573
|
-
"-o-animation-iteration-count": { multi: "<number> | infinite", comma: true },
|
|
6574
|
-
"-o-animation-name": { multi: "none | <ident>", comma: true },
|
|
6575
|
-
"-o-animation-play-state": { multi: "running | paused", comma: true },
|
|
6576
|
-
"appearance": "icon | window | desktop | workspace | document | tooltip | dialog | button | push-button | hyperlink | radio | radio-button | checkbox | menu-item | tab | menu | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password | normal | none | inherit",
|
|
6577
|
-
"azimuth": function(expression) {
|
|
6578
|
-
var simple = "<angle> | leftwards | rightwards | inherit", direction = "left-side | far-left | left | center-left | center | center-right | right | far-right | right-side", behind = false, valid = false, part;
|
|
6579
|
-
if (!ValidationTypes.isAny(expression, simple)) {
|
|
6580
|
-
if (ValidationTypes.isAny(expression, "behind")) {
|
|
6581
|
-
behind = true;
|
|
6582
|
-
valid = true;
|
|
6583
|
-
}
|
|
6584
|
-
if (ValidationTypes.isAny(expression, direction)) {
|
|
6585
|
-
valid = true;
|
|
6586
|
-
if (!behind) {
|
|
6587
|
-
ValidationTypes.isAny(expression, "behind");
|
|
6588
|
-
}
|
|
6589
|
-
}
|
|
6590
|
-
}
|
|
6591
|
-
if (expression.hasNext()) {
|
|
6592
|
-
part = expression.next();
|
|
6593
|
-
if (valid) {
|
|
6594
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
6595
|
-
} else {
|
|
6596
|
-
throw new ValidationError("Expected (<'azimuth'>) but found '" + part + "'.", part.line, part.col);
|
|
6597
|
-
}
|
|
6598
|
-
}
|
|
6599
|
-
},
|
|
6600
|
-
"backface-visibility": "visible | hidden",
|
|
6601
|
-
"background": 1,
|
|
6602
|
-
"background-attachment": { multi: "<attachment>", comma: true },
|
|
6603
|
-
"background-clip": { multi: "<box>", comma: true },
|
|
6604
|
-
"background-color": "<color> | inherit",
|
|
6605
|
-
"background-image": { multi: "<bg-image>", comma: true },
|
|
6606
|
-
"background-origin": { multi: "<box>", comma: true },
|
|
6607
|
-
"background-position": { multi: "<bg-position>", comma: true },
|
|
6608
|
-
"background-repeat": { multi: "<repeat-style>" },
|
|
6609
|
-
"background-size": { multi: "<bg-size>", comma: true },
|
|
6610
|
-
"baseline-shift": "baseline | sub | super | <percentage> | <length>",
|
|
6611
|
-
"behavior": 1,
|
|
6612
|
-
"binding": 1,
|
|
6613
|
-
"bleed": "<length>",
|
|
6614
|
-
"bookmark-label": "<content> | <attr> | <string>",
|
|
6615
|
-
"bookmark-level": "none | <integer>",
|
|
6616
|
-
"bookmark-state": "open | closed",
|
|
6617
|
-
"bookmark-target": "none | <uri> | <attr>",
|
|
6618
|
-
"border": "<border-width> || <border-style> || <color>",
|
|
6619
|
-
"border-bottom": "<border-width> || <border-style> || <color>",
|
|
6620
|
-
"border-bottom-color": "<color> | inherit",
|
|
6621
|
-
"border-bottom-left-radius": "<x-one-radius>",
|
|
6622
|
-
"border-bottom-right-radius": "<x-one-radius>",
|
|
6623
|
-
"border-bottom-style": "<border-style>",
|
|
6624
|
-
"border-bottom-width": "<border-width>",
|
|
6625
|
-
"border-collapse": "collapse | separate | inherit",
|
|
6626
|
-
"border-color": { multi: "<color> | inherit", max: 4 },
|
|
6627
|
-
"border-image": 1,
|
|
6628
|
-
"border-image-outset": { multi: "<length> | <number>", max: 4 },
|
|
6629
|
-
"border-image-repeat": { multi: "stretch | repeat | round", max: 2 },
|
|
6630
|
-
"border-image-slice": function(expression) {
|
|
6631
|
-
var valid = false, numeric = "<number> | <percentage>", fill = false, count = 0, max = 4, part;
|
|
6632
|
-
if (ValidationTypes.isAny(expression, "fill")) {
|
|
6633
|
-
fill = true;
|
|
6634
|
-
valid = true;
|
|
6635
|
-
}
|
|
6636
|
-
while (expression.hasNext() && count < max) {
|
|
6637
|
-
valid = ValidationTypes.isAny(expression, numeric);
|
|
6638
|
-
if (!valid) {
|
|
6639
|
-
break;
|
|
6640
|
-
}
|
|
6641
|
-
count++;
|
|
6642
|
-
}
|
|
6643
|
-
if (!fill) {
|
|
6644
|
-
ValidationTypes.isAny(expression, "fill");
|
|
6645
|
-
} else {
|
|
6646
|
-
valid = true;
|
|
6647
|
-
}
|
|
6648
|
-
if (expression.hasNext()) {
|
|
6649
|
-
part = expression.next();
|
|
6650
|
-
if (valid) {
|
|
6651
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
6652
|
-
} else {
|
|
6653
|
-
throw new ValidationError("Expected ([<number> | <percentage>]{1,4} && fill?) but found '" + part + "'.", part.line, part.col);
|
|
6654
|
-
}
|
|
6655
|
-
}
|
|
6656
|
-
},
|
|
6657
|
-
"border-image-source": "<image> | none",
|
|
6658
|
-
"border-image-width": { multi: "<length> | <percentage> | <number> | auto", max: 4 },
|
|
6659
|
-
"border-left": "<border-width> || <border-style> || <color>",
|
|
6660
|
-
"border-left-color": "<color> | inherit",
|
|
6661
|
-
"border-left-style": "<border-style>",
|
|
6662
|
-
"border-left-width": "<border-width>",
|
|
6663
|
-
"border-radius": function(expression) {
|
|
6664
|
-
var valid = false, simple = "<length> | <percentage> | inherit", slash = false, count = 0, max = 8, part;
|
|
6665
|
-
while (expression.hasNext() && count < max) {
|
|
6666
|
-
valid = ValidationTypes.isAny(expression, simple);
|
|
6667
|
-
if (!valid) {
|
|
6668
|
-
if (String(expression.peek()) === "/" && count > 0 && !slash) {
|
|
6669
|
-
slash = true;
|
|
6670
|
-
max = count + 5;
|
|
6671
|
-
expression.next();
|
|
6672
|
-
} else {
|
|
6673
|
-
break;
|
|
6674
|
-
}
|
|
6675
|
-
}
|
|
6676
|
-
count++;
|
|
6677
|
-
}
|
|
6678
|
-
if (expression.hasNext()) {
|
|
6679
|
-
part = expression.next();
|
|
6680
|
-
if (valid) {
|
|
6681
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
6682
|
-
} else {
|
|
6683
|
-
throw new ValidationError("Expected (<'border-radius'>) but found '" + part + "'.", part.line, part.col);
|
|
6684
|
-
}
|
|
6685
|
-
}
|
|
6686
|
-
},
|
|
6687
|
-
"border-right": "<border-width> || <border-style> || <color>",
|
|
6688
|
-
"border-right-color": "<color> | inherit",
|
|
6689
|
-
"border-right-style": "<border-style>",
|
|
6690
|
-
"border-right-width": "<border-width>",
|
|
6691
|
-
"border-spacing": { multi: "<length> | inherit", max: 2 },
|
|
6692
|
-
"border-style": { multi: "<border-style>", max: 4 },
|
|
6693
|
-
"border-top": "<border-width> || <border-style> || <color>",
|
|
6694
|
-
"border-top-color": "<color> | inherit",
|
|
6695
|
-
"border-top-left-radius": "<x-one-radius>",
|
|
6696
|
-
"border-top-right-radius": "<x-one-radius>",
|
|
6697
|
-
"border-top-style": "<border-style>",
|
|
6698
|
-
"border-top-width": "<border-width>",
|
|
6699
|
-
"border-width": { multi: "<border-width>", max: 4 },
|
|
6700
|
-
"bottom": "<margin-width> | inherit",
|
|
6701
|
-
"-moz-box-align": "start | end | center | baseline | stretch",
|
|
6702
|
-
"-moz-box-decoration-break": "slice |clone",
|
|
6703
|
-
"-moz-box-direction": "normal | reverse | inherit",
|
|
6704
|
-
"-moz-box-flex": "<number>",
|
|
6705
|
-
"-moz-box-flex-group": "<integer>",
|
|
6706
|
-
"-moz-box-lines": "single | multiple",
|
|
6707
|
-
"-moz-box-ordinal-group": "<integer>",
|
|
6708
|
-
"-moz-box-orient": "horizontal | vertical | inline-axis | block-axis | inherit",
|
|
6709
|
-
"-moz-box-pack": "start | end | center | justify",
|
|
6710
|
-
"-o-box-decoration-break": "slice | clone",
|
|
6711
|
-
"-webkit-box-align": "start | end | center | baseline | stretch",
|
|
6712
|
-
"-webkit-box-decoration-break": "slice |clone",
|
|
6713
|
-
"-webkit-box-direction": "normal | reverse | inherit",
|
|
6714
|
-
"-webkit-box-flex": "<number>",
|
|
6715
|
-
"-webkit-box-flex-group": "<integer>",
|
|
6716
|
-
"-webkit-box-lines": "single | multiple",
|
|
6717
|
-
"-webkit-box-ordinal-group": "<integer>",
|
|
6718
|
-
"-webkit-box-orient": "horizontal | vertical | inline-axis | block-axis | inherit",
|
|
6719
|
-
"-webkit-box-pack": "start | end | center | justify",
|
|
6720
|
-
"box-decoration-break": "slice | clone",
|
|
6721
|
-
"box-shadow": function(expression) {
|
|
6722
|
-
var part;
|
|
6723
|
-
if (!ValidationTypes.isAny(expression, "none")) {
|
|
6724
|
-
Validation.multiProperty("<shadow>", expression, true, Infinity);
|
|
6725
|
-
} else {
|
|
6726
|
-
if (expression.hasNext()) {
|
|
6727
|
-
part = expression.next();
|
|
6728
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
6729
|
-
}
|
|
6730
|
-
}
|
|
6731
|
-
},
|
|
6732
|
-
"box-sizing": "content-box | border-box | inherit",
|
|
6733
|
-
"break-after": "auto | always | avoid | left | right | page | column | avoid-page | avoid-column",
|
|
6734
|
-
"break-before": "auto | always | avoid | left | right | page | column | avoid-page | avoid-column",
|
|
6735
|
-
"break-inside": "auto | avoid | avoid-page | avoid-column",
|
|
6736
|
-
"caption-side": "top | bottom | inherit",
|
|
6737
|
-
"clear": "none | right | left | both | inherit",
|
|
6738
|
-
"clip": 1,
|
|
6739
|
-
"color": "<color> | inherit",
|
|
6740
|
-
"color-profile": 1,
|
|
6741
|
-
"column-count": "<integer> | auto",
|
|
6742
|
-
"column-fill": "auto | balance",
|
|
6743
|
-
"column-gap": "<length> | normal",
|
|
6744
|
-
"column-rule": "<border-width> || <border-style> || <color>",
|
|
6745
|
-
"column-rule-color": "<color>",
|
|
6746
|
-
"column-rule-style": "<border-style>",
|
|
6747
|
-
"column-rule-width": "<border-width>",
|
|
6748
|
-
"column-span": "none | all",
|
|
6749
|
-
"column-width": "<length> | auto",
|
|
6750
|
-
"columns": 1,
|
|
6751
|
-
"content": 1,
|
|
6752
|
-
"counter-increment": 1,
|
|
6753
|
-
"counter-reset": 1,
|
|
6754
|
-
"crop": "<shape> | auto",
|
|
6755
|
-
"cue": "cue-after | cue-before | inherit",
|
|
6756
|
-
"cue-after": 1,
|
|
6757
|
-
"cue-before": 1,
|
|
6758
|
-
"cursor": 1,
|
|
6759
|
-
"direction": "ltr | rtl | inherit",
|
|
6760
|
-
"display": "inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | grid | inline-grid | run-in | ruby | ruby-base | ruby-text | ruby-base-container | ruby-text-container | contents | none | inherit | -moz-box | -moz-inline-block | -moz-inline-box | -moz-inline-grid | -moz-inline-stack | -moz-inline-table | -moz-grid | -moz-grid-group | -moz-grid-line | -moz-groupbox | -moz-deck | -moz-popup | -moz-stack | -moz-marker | -webkit-box | -webkit-inline-box | -ms-flexbox | -ms-inline-flexbox | flex | -webkit-flex | inline-flex | -webkit-inline-flex",
|
|
6761
|
-
"dominant-baseline": 1,
|
|
6762
|
-
"drop-initial-after-adjust": "central | middle | after-edge | text-after-edge | ideographic | alphabetic | mathematical | <percentage> | <length>",
|
|
6763
|
-
"drop-initial-after-align": "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
|
|
6764
|
-
"drop-initial-before-adjust": "before-edge | text-before-edge | central | middle | hanging | mathematical | <percentage> | <length>",
|
|
6765
|
-
"drop-initial-before-align": "caps-height | baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
|
|
6766
|
-
"drop-initial-size": "auto | line | <length> | <percentage>",
|
|
6767
|
-
"drop-initial-value": "initial | <integer>",
|
|
6768
|
-
"elevation": "<angle> | below | level | above | higher | lower | inherit",
|
|
6769
|
-
"empty-cells": "show | hide | inherit",
|
|
6770
|
-
"filter": 1,
|
|
6771
|
-
"fit": "fill | hidden | meet | slice",
|
|
6772
|
-
"fit-position": 1,
|
|
6773
|
-
"flex": "<flex>",
|
|
6774
|
-
"flex-basis": "<width>",
|
|
6775
|
-
"flex-direction": "row | row-reverse | column | column-reverse",
|
|
6776
|
-
"flex-flow": "<flex-direction> || <flex-wrap>",
|
|
6777
|
-
"flex-grow": "<number>",
|
|
6778
|
-
"flex-shrink": "<number>",
|
|
6779
|
-
"flex-wrap": "nowrap | wrap | wrap-reverse",
|
|
6780
|
-
"-webkit-flex": "<flex>",
|
|
6781
|
-
"-webkit-flex-basis": "<width>",
|
|
6782
|
-
"-webkit-flex-direction": "row | row-reverse | column | column-reverse",
|
|
6783
|
-
"-webkit-flex-flow": "<flex-direction> || <flex-wrap>",
|
|
6784
|
-
"-webkit-flex-grow": "<number>",
|
|
6785
|
-
"-webkit-flex-shrink": "<number>",
|
|
6786
|
-
"-webkit-flex-wrap": "nowrap | wrap | wrap-reverse",
|
|
6787
|
-
"-ms-flex": "<flex>",
|
|
6788
|
-
"-ms-flex-align": "start | end | center | stretch | baseline",
|
|
6789
|
-
"-ms-flex-direction": "row | row-reverse | column | column-reverse | inherit",
|
|
6790
|
-
"-ms-flex-order": "<number>",
|
|
6791
|
-
"-ms-flex-pack": "start | end | center | justify",
|
|
6792
|
-
"-ms-flex-wrap": "nowrap | wrap | wrap-reverse",
|
|
6793
|
-
"float": "left | right | none | inherit",
|
|
6794
|
-
"float-offset": 1,
|
|
6795
|
-
"font": 1,
|
|
6796
|
-
"font-family": 1,
|
|
6797
|
-
"font-feature-settings": "<feature-tag-value> | normal | inherit",
|
|
6798
|
-
"font-kerning": "auto | normal | none | initial | inherit | unset",
|
|
6799
|
-
"font-size": "<absolute-size> | <relative-size> | <length> | <percentage> | inherit",
|
|
6800
|
-
"font-size-adjust": "<number> | none | inherit",
|
|
6801
|
-
"font-stretch": "normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | inherit",
|
|
6802
|
-
"font-style": "normal | italic | oblique | inherit",
|
|
6803
|
-
"font-variant": "normal | small-caps | inherit",
|
|
6804
|
-
"font-variant-caps": "normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps",
|
|
6805
|
-
"font-variant-position": "normal | sub | super | inherit | initial | unset",
|
|
6806
|
-
"font-weight": "normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit",
|
|
6807
|
-
"grid": 1,
|
|
6808
|
-
"grid-area": 1,
|
|
6809
|
-
"grid-auto-columns": 1,
|
|
6810
|
-
"grid-auto-flow": 1,
|
|
6811
|
-
"grid-auto-position": 1,
|
|
6812
|
-
"grid-auto-rows": 1,
|
|
6813
|
-
"grid-cell-stacking": "columns | rows | layer",
|
|
6814
|
-
"grid-column": 1,
|
|
6815
|
-
"grid-columns": 1,
|
|
6816
|
-
"grid-column-align": "start | end | center | stretch",
|
|
6817
|
-
"grid-column-sizing": 1,
|
|
6818
|
-
"grid-column-start": 1,
|
|
6819
|
-
"grid-column-end": 1,
|
|
6820
|
-
"grid-column-span": "<integer>",
|
|
6821
|
-
"grid-flow": "none | rows | columns",
|
|
6822
|
-
"grid-layer": "<integer>",
|
|
6823
|
-
"grid-row": 1,
|
|
6824
|
-
"grid-rows": 1,
|
|
6825
|
-
"grid-row-align": "start | end | center | stretch",
|
|
6826
|
-
"grid-row-start": 1,
|
|
6827
|
-
"grid-row-end": 1,
|
|
6828
|
-
"grid-row-span": "<integer>",
|
|
6829
|
-
"grid-row-sizing": 1,
|
|
6830
|
-
"grid-template": 1,
|
|
6831
|
-
"grid-template-areas": 1,
|
|
6832
|
-
"grid-template-columns": 1,
|
|
6833
|
-
"grid-template-rows": 1,
|
|
6834
|
-
"hanging-punctuation": 1,
|
|
6835
|
-
"height": "<margin-width> | <content-sizing> | inherit",
|
|
6836
|
-
"hyphenate-after": "<integer> | auto",
|
|
6837
|
-
"hyphenate-before": "<integer> | auto",
|
|
6838
|
-
"hyphenate-character": "<string> | auto",
|
|
6839
|
-
"hyphenate-lines": "no-limit | <integer>",
|
|
6840
|
-
"hyphenate-resource": 1,
|
|
6841
|
-
"hyphens": "none | manual | auto",
|
|
6842
|
-
"icon": 1,
|
|
6843
|
-
"image-orientation": "angle | auto",
|
|
6844
|
-
"image-rendering": 1,
|
|
6845
|
-
"image-resolution": 1,
|
|
6846
|
-
"ime-mode": "auto | normal | active | inactive | disabled | inherit",
|
|
6847
|
-
"inline-box-align": "initial | last | <integer>",
|
|
6848
|
-
"justify-content": "flex-start | flex-end | center | space-between | space-around",
|
|
6849
|
-
"-webkit-justify-content": "flex-start | flex-end | center | space-between | space-around",
|
|
6850
|
-
"left": "<margin-width> | inherit",
|
|
6851
|
-
"letter-spacing": "<length> | normal | inherit",
|
|
6852
|
-
"line-height": "<number> | <length> | <percentage> | normal | inherit",
|
|
6853
|
-
"line-break": "auto | loose | normal | strict",
|
|
6854
|
-
"line-stacking": 1,
|
|
6855
|
-
"line-stacking-ruby": "exclude-ruby | include-ruby",
|
|
6856
|
-
"line-stacking-shift": "consider-shifts | disregard-shifts",
|
|
6857
|
-
"line-stacking-strategy": "inline-line-height | block-line-height | max-height | grid-height",
|
|
6858
|
-
"list-style": 1,
|
|
6859
|
-
"list-style-image": "<uri> | none | inherit",
|
|
6860
|
-
"list-style-position": "inside | outside | inherit",
|
|
6861
|
-
"list-style-type": "disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha | upper-alpha | none | inherit",
|
|
6862
|
-
"margin": { multi: "<margin-width> | inherit", max: 4 },
|
|
6863
|
-
"margin-bottom": "<margin-width> | inherit",
|
|
6864
|
-
"margin-left": "<margin-width> | inherit",
|
|
6865
|
-
"margin-right": "<margin-width> | inherit",
|
|
6866
|
-
"margin-top": "<margin-width> | inherit",
|
|
6867
|
-
"mark": 1,
|
|
6868
|
-
"mark-after": 1,
|
|
6869
|
-
"mark-before": 1,
|
|
6870
|
-
"marks": 1,
|
|
6871
|
-
"marquee-direction": 1,
|
|
6872
|
-
"marquee-play-count": 1,
|
|
6873
|
-
"marquee-speed": 1,
|
|
6874
|
-
"marquee-style": 1,
|
|
6875
|
-
"max-height": "<length> | <percentage> | <content-sizing> | none | inherit",
|
|
6876
|
-
"max-width": "<length> | <percentage> | <content-sizing> | none | inherit",
|
|
6877
|
-
"min-height": "<length> | <percentage> | <content-sizing> | contain-floats | -moz-contain-floats | -webkit-contain-floats | inherit",
|
|
6878
|
-
"min-width": "<length> | <percentage> | <content-sizing> | contain-floats | -moz-contain-floats | -webkit-contain-floats | inherit",
|
|
6879
|
-
"move-to": 1,
|
|
6880
|
-
"nav-down": 1,
|
|
6881
|
-
"nav-index": 1,
|
|
6882
|
-
"nav-left": 1,
|
|
6883
|
-
"nav-right": 1,
|
|
6884
|
-
"nav-up": 1,
|
|
6885
|
-
"object-fit": "fill | contain | cover | none | scale-down",
|
|
6886
|
-
"object-position": "<bg-position>",
|
|
6887
|
-
"opacity": "<number> | inherit",
|
|
6888
|
-
"order": "<integer>",
|
|
6889
|
-
"-webkit-order": "<integer>",
|
|
6890
|
-
"orphans": "<integer> | inherit",
|
|
6891
|
-
"outline": 1,
|
|
6892
|
-
"outline-color": "<color> | invert | inherit",
|
|
6893
|
-
"outline-offset": 1,
|
|
6894
|
-
"outline-style": "<border-style> | inherit",
|
|
6895
|
-
"outline-width": "<border-width> | inherit",
|
|
6896
|
-
"overflow": "visible | hidden | scroll | auto | inherit",
|
|
6897
|
-
"overflow-style": 1,
|
|
6898
|
-
"overflow-wrap": "normal | break-word",
|
|
6899
|
-
"overflow-x": 1,
|
|
6900
|
-
"overflow-y": 1,
|
|
6901
|
-
"padding": { multi: "<padding-width> | inherit", max: 4 },
|
|
6902
|
-
"padding-bottom": "<padding-width> | inherit",
|
|
6903
|
-
"padding-left": "<padding-width> | inherit",
|
|
6904
|
-
"padding-right": "<padding-width> | inherit",
|
|
6905
|
-
"padding-top": "<padding-width> | inherit",
|
|
6906
|
-
"page": 1,
|
|
6907
|
-
"page-break-after": "auto | always | avoid | left | right | inherit",
|
|
6908
|
-
"page-break-before": "auto | always | avoid | left | right | inherit",
|
|
6909
|
-
"page-break-inside": "auto | avoid | inherit",
|
|
6910
|
-
"page-policy": 1,
|
|
6911
|
-
"pause": 1,
|
|
6912
|
-
"pause-after": 1,
|
|
6913
|
-
"pause-before": 1,
|
|
6914
|
-
"perspective": 1,
|
|
6915
|
-
"perspective-origin": 1,
|
|
6916
|
-
"phonemes": 1,
|
|
6917
|
-
"pitch": 1,
|
|
6918
|
-
"pitch-range": 1,
|
|
6919
|
-
"play-during": 1,
|
|
6920
|
-
"pointer-events": "auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit",
|
|
6921
|
-
"position": "static | relative | absolute | fixed | inherit",
|
|
6922
|
-
"presentation-level": 1,
|
|
6923
|
-
"punctuation-trim": 1,
|
|
6924
|
-
"quotes": 1,
|
|
6925
|
-
"rendering-intent": 1,
|
|
6926
|
-
"resize": 1,
|
|
6927
|
-
"rest": 1,
|
|
6928
|
-
"rest-after": 1,
|
|
6929
|
-
"rest-before": 1,
|
|
6930
|
-
"richness": 1,
|
|
6931
|
-
"right": "<margin-width> | inherit",
|
|
6932
|
-
"rotation": 1,
|
|
6933
|
-
"rotation-point": 1,
|
|
6934
|
-
"ruby-align": 1,
|
|
6935
|
-
"ruby-overhang": 1,
|
|
6936
|
-
"ruby-position": 1,
|
|
6937
|
-
"ruby-span": 1,
|
|
6938
|
-
"size": 1,
|
|
6939
|
-
"speak": "normal | none | spell-out | inherit",
|
|
6940
|
-
"speak-header": "once | always | inherit",
|
|
6941
|
-
"speak-numeral": "digits | continuous | inherit",
|
|
6942
|
-
"speak-punctuation": "code | none | inherit",
|
|
6943
|
-
"speech-rate": 1,
|
|
6944
|
-
"src": 1,
|
|
6945
|
-
"stress": 1,
|
|
6946
|
-
"string-set": 1,
|
|
6947
|
-
"table-layout": "auto | fixed | inherit",
|
|
6948
|
-
"tab-size": "<integer> | <length>",
|
|
6949
|
-
"target": 1,
|
|
6950
|
-
"target-name": 1,
|
|
6951
|
-
"target-new": 1,
|
|
6952
|
-
"target-position": 1,
|
|
6953
|
-
"text-align": "left | right | center | justify | match-parent | start | end | inherit",
|
|
6954
|
-
"text-align-last": 1,
|
|
6955
|
-
"text-decoration": 1,
|
|
6956
|
-
"text-emphasis": 1,
|
|
6957
|
-
"text-height": 1,
|
|
6958
|
-
"text-indent": "<length> | <percentage> | inherit",
|
|
6959
|
-
"text-justify": "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida",
|
|
6960
|
-
"text-outline": 1,
|
|
6961
|
-
"text-overflow": 1,
|
|
6962
|
-
"text-rendering": "auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit",
|
|
6963
|
-
"text-shadow": 1,
|
|
6964
|
-
"text-transform": "capitalize | uppercase | lowercase | none | inherit",
|
|
6965
|
-
"text-wrap": "normal | none | avoid",
|
|
6966
|
-
"top": "<margin-width> | inherit",
|
|
6967
|
-
"-ms-touch-action": "auto | none | pan-x | pan-y | pan-left | pan-right | pan-up | pan-down | manipulation",
|
|
6968
|
-
"touch-action": "auto | none | pan-x | pan-y | pan-left | pan-right | pan-up | pan-down | manipulation",
|
|
6969
|
-
"transform": 1,
|
|
6970
|
-
"transform-origin": 1,
|
|
6971
|
-
"transform-style": 1,
|
|
6972
|
-
"transition": 1,
|
|
6973
|
-
"transition-delay": 1,
|
|
6974
|
-
"transition-duration": 1,
|
|
6975
|
-
"transition-property": 1,
|
|
6976
|
-
"transition-timing-function": 1,
|
|
6977
|
-
"unicode-bidi": "normal | embed | isolate | bidi-override | isolate-override | plaintext | inherit",
|
|
6978
|
-
"user-modify": "read-only | read-write | write-only | inherit",
|
|
6979
|
-
"user-select": "none | text | toggle | element | elements | all | inherit",
|
|
6980
|
-
"vertical-align": "auto | use-script | baseline | sub | super | top | text-top | central | middle | bottom | text-bottom | <percentage> | <length> | inherit",
|
|
6981
|
-
"visibility": "visible | hidden | collapse | inherit",
|
|
6982
|
-
"voice-balance": 1,
|
|
6983
|
-
"voice-duration": 1,
|
|
6984
|
-
"voice-family": 1,
|
|
6985
|
-
"voice-pitch": 1,
|
|
6986
|
-
"voice-pitch-range": 1,
|
|
6987
|
-
"voice-rate": 1,
|
|
6988
|
-
"voice-stress": 1,
|
|
6989
|
-
"voice-volume": 1,
|
|
6990
|
-
"volume": 1,
|
|
6991
|
-
"white-space": "normal | pre | nowrap | pre-wrap | pre-line | inherit | -pre-wrap | -o-pre-wrap | -moz-pre-wrap | -hp-pre-wrap",
|
|
6992
|
-
"white-space-collapse": 1,
|
|
6993
|
-
"widows": "<integer> | inherit",
|
|
6994
|
-
"width": "<length> | <percentage> | <content-sizing> | auto | inherit",
|
|
6995
|
-
"will-change": { multi: "<ident>", comma: true },
|
|
6996
|
-
"word-break": "normal | keep-all | break-all",
|
|
6997
|
-
"word-spacing": "<length> | normal | inherit",
|
|
6998
|
-
"word-wrap": "normal | break-word",
|
|
6999
|
-
"writing-mode": "horizontal-tb | vertical-rl | vertical-lr | lr-tb | rl-tb | tb-rl | bt-rl | tb-lr | bt-lr | lr-bt | rl-bt | lr | rl | tb | inherit",
|
|
7000
|
-
"z-index": "<integer> | auto | inherit",
|
|
7001
|
-
"zoom": "<number> | <percentage> | normal"
|
|
7002
|
-
};
|
|
7003
|
-
function PropertyName(text, hack, line, col) {
|
|
7004
|
-
SyntaxUnit.call(this, text, line, col, Parser.PROPERTY_NAME_TYPE);
|
|
7005
|
-
this.hack = hack;
|
|
7006
|
-
}
|
|
7007
|
-
PropertyName.prototype = new SyntaxUnit();
|
|
7008
|
-
PropertyName.prototype.constructor = PropertyName;
|
|
7009
|
-
PropertyName.prototype.toString = function() {
|
|
7010
|
-
return (this.hack ? this.hack : "") + this.text;
|
|
7011
|
-
};
|
|
7012
|
-
function PropertyValue(parts, line, col) {
|
|
7013
|
-
SyntaxUnit.call(this, parts.join(" "), line, col, Parser.PROPERTY_VALUE_TYPE);
|
|
7014
|
-
this.parts = parts;
|
|
7015
|
-
}
|
|
7016
|
-
PropertyValue.prototype = new SyntaxUnit();
|
|
7017
|
-
PropertyValue.prototype.constructor = PropertyValue;
|
|
7018
|
-
function PropertyValueIterator(value) {
|
|
7019
|
-
this._i = 0;
|
|
7020
|
-
this._parts = value.parts;
|
|
7021
|
-
this._marks = [];
|
|
7022
|
-
this.value = value;
|
|
7023
|
-
}
|
|
7024
|
-
PropertyValueIterator.prototype.count = function() {
|
|
7025
|
-
return this._parts.length;
|
|
7026
|
-
};
|
|
7027
|
-
PropertyValueIterator.prototype.isFirst = function() {
|
|
7028
|
-
return this._i === 0;
|
|
7029
|
-
};
|
|
7030
|
-
PropertyValueIterator.prototype.hasNext = function() {
|
|
7031
|
-
return this._i < this._parts.length;
|
|
7032
|
-
};
|
|
7033
|
-
PropertyValueIterator.prototype.mark = function() {
|
|
7034
|
-
this._marks.push(this._i);
|
|
7035
|
-
};
|
|
7036
|
-
PropertyValueIterator.prototype.peek = function(count) {
|
|
7037
|
-
return this.hasNext() ? this._parts[this._i + (count || 0)] : null;
|
|
7038
|
-
};
|
|
7039
|
-
PropertyValueIterator.prototype.next = function() {
|
|
7040
|
-
return this.hasNext() ? this._parts[this._i++] : null;
|
|
7041
|
-
};
|
|
7042
|
-
PropertyValueIterator.prototype.previous = function() {
|
|
7043
|
-
return this._i > 0 ? this._parts[--this._i] : null;
|
|
7044
|
-
};
|
|
7045
|
-
PropertyValueIterator.prototype.restore = function() {
|
|
7046
|
-
if (this._marks.length) {
|
|
7047
|
-
this._i = this._marks.pop();
|
|
7048
|
-
}
|
|
7049
|
-
};
|
|
7050
|
-
function PropertyValuePart(text, line, col) {
|
|
7051
|
-
SyntaxUnit.call(this, text, line, col, Parser.PROPERTY_VALUE_PART_TYPE);
|
|
7052
|
-
this.type = "unknown";
|
|
7053
|
-
var temp;
|
|
7054
|
-
if (/^([+\-]?[\d\.]+)([a-z]+)$/i.test(text)) {
|
|
7055
|
-
this.type = "dimension";
|
|
7056
|
-
this.value = +RegExp.$1;
|
|
7057
|
-
this.units = RegExp.$2;
|
|
7058
|
-
switch (this.units.toLowerCase()) {
|
|
7059
|
-
case "em":
|
|
7060
|
-
case "rem":
|
|
7061
|
-
case "ex":
|
|
7062
|
-
case "px":
|
|
7063
|
-
case "cm":
|
|
7064
|
-
case "mm":
|
|
7065
|
-
case "in":
|
|
7066
|
-
case "pt":
|
|
7067
|
-
case "pc":
|
|
7068
|
-
case "ch":
|
|
7069
|
-
case "vh":
|
|
7070
|
-
case "vw":
|
|
7071
|
-
case "vmax":
|
|
7072
|
-
case "vmin":
|
|
7073
|
-
this.type = "length";
|
|
7074
|
-
break;
|
|
7075
|
-
case "fr":
|
|
7076
|
-
this.type = "grid";
|
|
7077
|
-
break;
|
|
7078
|
-
case "deg":
|
|
7079
|
-
case "rad":
|
|
7080
|
-
case "grad":
|
|
7081
|
-
this.type = "angle";
|
|
7082
|
-
break;
|
|
7083
|
-
case "ms":
|
|
7084
|
-
case "s":
|
|
7085
|
-
this.type = "time";
|
|
7086
|
-
break;
|
|
7087
|
-
case "hz":
|
|
7088
|
-
case "khz":
|
|
7089
|
-
this.type = "frequency";
|
|
7090
|
-
break;
|
|
7091
|
-
case "dpi":
|
|
7092
|
-
case "dpcm":
|
|
7093
|
-
this.type = "resolution";
|
|
7094
|
-
break;
|
|
7095
|
-
}
|
|
7096
|
-
} else if (/^([+\-]?[\d\.]+)%$/i.test(text)) {
|
|
7097
|
-
this.type = "percentage";
|
|
7098
|
-
this.value = +RegExp.$1;
|
|
7099
|
-
} else if (/^([+\-]?\d+)$/i.test(text)) {
|
|
7100
|
-
this.type = "integer";
|
|
7101
|
-
this.value = +RegExp.$1;
|
|
7102
|
-
} else if (/^([+\-]?[\d\.]+)$/i.test(text)) {
|
|
7103
|
-
this.type = "number";
|
|
7104
|
-
this.value = +RegExp.$1;
|
|
7105
|
-
} else if (/^#([a-f0-9]{3,6})/i.test(text)) {
|
|
7106
|
-
this.type = "color";
|
|
7107
|
-
temp = RegExp.$1;
|
|
7108
|
-
if (temp.length === 3) {
|
|
7109
|
-
this.red = parseInt(temp.charAt(0) + temp.charAt(0), 16);
|
|
7110
|
-
this.green = parseInt(temp.charAt(1) + temp.charAt(1), 16);
|
|
7111
|
-
this.blue = parseInt(temp.charAt(2) + temp.charAt(2), 16);
|
|
7112
|
-
} else {
|
|
7113
|
-
this.red = parseInt(temp.substring(0, 2), 16);
|
|
7114
|
-
this.green = parseInt(temp.substring(2, 4), 16);
|
|
7115
|
-
this.blue = parseInt(temp.substring(4, 6), 16);
|
|
7116
|
-
}
|
|
7117
|
-
} else if (/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i.test(text)) {
|
|
7118
|
-
this.type = "color";
|
|
7119
|
-
this.red = +RegExp.$1;
|
|
7120
|
-
this.green = +RegExp.$2;
|
|
7121
|
-
this.blue = +RegExp.$3;
|
|
7122
|
-
} else if (/^rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)) {
|
|
7123
|
-
this.type = "color";
|
|
7124
|
-
this.red = +RegExp.$1 * 255 / 100;
|
|
7125
|
-
this.green = +RegExp.$2 * 255 / 100;
|
|
7126
|
-
this.blue = +RegExp.$3 * 255 / 100;
|
|
7127
|
-
} else if (/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\s*\)/i.test(text)) {
|
|
7128
|
-
this.type = "color";
|
|
7129
|
-
this.red = +RegExp.$1;
|
|
7130
|
-
this.green = +RegExp.$2;
|
|
7131
|
-
this.blue = +RegExp.$3;
|
|
7132
|
-
this.alpha = +RegExp.$4;
|
|
7133
|
-
} else if (/^rgba\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)) {
|
|
7134
|
-
this.type = "color";
|
|
7135
|
-
this.red = +RegExp.$1 * 255 / 100;
|
|
7136
|
-
this.green = +RegExp.$2 * 255 / 100;
|
|
7137
|
-
this.blue = +RegExp.$3 * 255 / 100;
|
|
7138
|
-
this.alpha = +RegExp.$4;
|
|
7139
|
-
} else if (/^hsl\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)) {
|
|
7140
|
-
this.type = "color";
|
|
7141
|
-
this.hue = +RegExp.$1;
|
|
7142
|
-
this.saturation = +RegExp.$2 / 100;
|
|
7143
|
-
this.lightness = +RegExp.$3 / 100;
|
|
7144
|
-
} else if (/^hsla\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)) {
|
|
7145
|
-
this.type = "color";
|
|
7146
|
-
this.hue = +RegExp.$1;
|
|
7147
|
-
this.saturation = +RegExp.$2 / 100;
|
|
7148
|
-
this.lightness = +RegExp.$3 / 100;
|
|
7149
|
-
this.alpha = +RegExp.$4;
|
|
7150
|
-
} else if (/^url\(["']?([^\)"']+)["']?\)/i.test(text)) {
|
|
7151
|
-
this.type = "uri";
|
|
7152
|
-
this.uri = RegExp.$1;
|
|
7153
|
-
} else if (/^([^\(]+)\(/i.test(text)) {
|
|
7154
|
-
this.type = "function";
|
|
7155
|
-
this.name = RegExp.$1;
|
|
7156
|
-
this.value = text;
|
|
7157
|
-
} else if (/^"([^\n\r\f\\"]|\\\r\n|\\[^\r0-9a-f]|\\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?)*"/i.test(text)) {
|
|
7158
|
-
this.type = "string";
|
|
7159
|
-
this.value = PropertyValuePart.parseString(text);
|
|
7160
|
-
} else if (/^'([^\n\r\f\\']|\\\r\n|\\[^\r0-9a-f]|\\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?)*'/i.test(text)) {
|
|
7161
|
-
this.type = "string";
|
|
7162
|
-
this.value = PropertyValuePart.parseString(text);
|
|
7163
|
-
} else if (Colors[text.toLowerCase()]) {
|
|
7164
|
-
this.type = "color";
|
|
7165
|
-
temp = Colors[text.toLowerCase()].substring(1);
|
|
7166
|
-
this.red = parseInt(temp.substring(0, 2), 16);
|
|
7167
|
-
this.green = parseInt(temp.substring(2, 4), 16);
|
|
7168
|
-
this.blue = parseInt(temp.substring(4, 6), 16);
|
|
7169
|
-
} else if (/^[\,\/]$/.test(text)) {
|
|
7170
|
-
this.type = "operator";
|
|
7171
|
-
this.value = text;
|
|
7172
|
-
} else if (/^[a-z\-_\u0080-\uFFFF][a-z0-9\-_\u0080-\uFFFF]*$/i.test(text)) {
|
|
7173
|
-
this.type = "identifier";
|
|
7174
|
-
this.value = text;
|
|
7175
|
-
}
|
|
7176
|
-
}
|
|
7177
|
-
PropertyValuePart.prototype = new SyntaxUnit();
|
|
7178
|
-
PropertyValuePart.prototype.constructor = PropertyValuePart;
|
|
7179
|
-
PropertyValuePart.parseString = function(str) {
|
|
7180
|
-
str = str.slice(1, -1);
|
|
7181
|
-
var replacer = function(match, esc) {
|
|
7182
|
-
if (/^(\n|\r\n|\r|\f)$/.test(esc)) {
|
|
7183
|
-
return "";
|
|
7184
|
-
}
|
|
7185
|
-
var m = /^[0-9a-f]{1,6}/i.exec(esc);
|
|
7186
|
-
if (m) {
|
|
7187
|
-
var codePoint = parseInt(m[0], 16);
|
|
7188
|
-
if (String.fromCodePoint) {
|
|
7189
|
-
return String.fromCodePoint(codePoint);
|
|
7190
|
-
} else {
|
|
7191
|
-
return String.fromCharCode(codePoint);
|
|
7192
|
-
}
|
|
7193
|
-
}
|
|
7194
|
-
return esc;
|
|
7195
|
-
};
|
|
7196
|
-
return str.replace(
|
|
7197
|
-
/\\(\r\n|[^\r0-9a-f]|[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?)/ig,
|
|
7198
|
-
replacer
|
|
7199
|
-
);
|
|
7200
|
-
};
|
|
7201
|
-
PropertyValuePart.serializeString = function(value) {
|
|
7202
|
-
var replacer = function(match, c) {
|
|
7203
|
-
if (c === '"') {
|
|
7204
|
-
return "\\" + c;
|
|
7205
|
-
}
|
|
7206
|
-
var cp = String.codePointAt ? String.codePointAt(0) : String.charCodeAt(0);
|
|
7207
|
-
return "\\" + cp.toString(16) + " ";
|
|
7208
|
-
};
|
|
7209
|
-
return '"' + value.replace(/["\r\n\f]/g, replacer) + '"';
|
|
7210
|
-
};
|
|
7211
|
-
PropertyValuePart.fromToken = function(token) {
|
|
7212
|
-
return new PropertyValuePart(token.value, token.startLine, token.startCol);
|
|
7213
|
-
};
|
|
7214
|
-
var Pseudos = {
|
|
7215
|
-
__proto__: null,
|
|
7216
|
-
":first-letter": 1,
|
|
7217
|
-
":first-line": 1,
|
|
7218
|
-
":before": 1,
|
|
7219
|
-
":after": 1
|
|
7220
|
-
};
|
|
7221
|
-
Pseudos.ELEMENT = 1;
|
|
7222
|
-
Pseudos.CLASS = 2;
|
|
7223
|
-
Pseudos.isElement = function(pseudo) {
|
|
7224
|
-
return pseudo.indexOf("::") === 0 || Pseudos[pseudo.toLowerCase()] === Pseudos.ELEMENT;
|
|
7225
|
-
};
|
|
7226
|
-
function Selector(parts, line, col) {
|
|
7227
|
-
SyntaxUnit.call(this, parts.join(" "), line, col, Parser.SELECTOR_TYPE);
|
|
7228
|
-
this.parts = parts;
|
|
7229
|
-
this.specificity = Specificity.calculate(this);
|
|
7230
|
-
}
|
|
7231
|
-
Selector.prototype = new SyntaxUnit();
|
|
7232
|
-
Selector.prototype.constructor = Selector;
|
|
7233
|
-
function SelectorPart(elementName, modifiers, text, line, col) {
|
|
7234
|
-
SyntaxUnit.call(this, text, line, col, Parser.SELECTOR_PART_TYPE);
|
|
7235
|
-
this.elementName = elementName;
|
|
7236
|
-
this.modifiers = modifiers;
|
|
7237
|
-
}
|
|
7238
|
-
SelectorPart.prototype = new SyntaxUnit();
|
|
7239
|
-
SelectorPart.prototype.constructor = SelectorPart;
|
|
7240
|
-
function SelectorSubPart(text, type, line, col) {
|
|
7241
|
-
SyntaxUnit.call(this, text, line, col, Parser.SELECTOR_SUB_PART_TYPE);
|
|
7242
|
-
this.type = type;
|
|
7243
|
-
this.args = [];
|
|
7244
|
-
}
|
|
7245
|
-
SelectorSubPart.prototype = new SyntaxUnit();
|
|
7246
|
-
SelectorSubPart.prototype.constructor = SelectorSubPart;
|
|
7247
|
-
function Specificity(a, b, c, d) {
|
|
7248
|
-
this.a = a;
|
|
7249
|
-
this.b = b;
|
|
7250
|
-
this.c = c;
|
|
7251
|
-
this.d = d;
|
|
7252
|
-
}
|
|
7253
|
-
Specificity.prototype = {
|
|
7254
|
-
constructor: Specificity,
|
|
7255
|
-
compare: function(other) {
|
|
7256
|
-
var comps = ["a", "b", "c", "d"], i, len;
|
|
7257
|
-
for (i = 0, len = comps.length; i < len; i++) {
|
|
7258
|
-
if (this[comps[i]] < other[comps[i]]) {
|
|
7259
|
-
return -1;
|
|
7260
|
-
} else if (this[comps[i]] > other[comps[i]]) {
|
|
7261
|
-
return 1;
|
|
7262
|
-
}
|
|
7263
|
-
}
|
|
7264
|
-
return 0;
|
|
7265
|
-
},
|
|
7266
|
-
valueOf: function() {
|
|
7267
|
-
return this.a * 1e3 + this.b * 100 + this.c * 10 + this.d;
|
|
7268
|
-
},
|
|
7269
|
-
toString: function() {
|
|
7270
|
-
return this.a + "," + this.b + "," + this.c + "," + this.d;
|
|
7271
|
-
}
|
|
7272
|
-
};
|
|
7273
|
-
Specificity.calculate = function(selector) {
|
|
7274
|
-
var i, len, part, b = 0, c = 0, d = 0;
|
|
7275
|
-
function updateValues(part2) {
|
|
7276
|
-
var i2, j, len2, num, elementName = part2.elementName ? part2.elementName.text : "", modifier;
|
|
7277
|
-
if (elementName && elementName.charAt(elementName.length - 1) !== "*") {
|
|
7278
|
-
d++;
|
|
7279
|
-
}
|
|
7280
|
-
for (i2 = 0, len2 = part2.modifiers.length; i2 < len2; i2++) {
|
|
7281
|
-
modifier = part2.modifiers[i2];
|
|
7282
|
-
switch (modifier.type) {
|
|
7283
|
-
case "class":
|
|
7284
|
-
case "attribute":
|
|
7285
|
-
c++;
|
|
7286
|
-
break;
|
|
7287
|
-
case "id":
|
|
7288
|
-
b++;
|
|
7289
|
-
break;
|
|
7290
|
-
case "pseudo":
|
|
7291
|
-
if (Pseudos.isElement(modifier.text)) {
|
|
7292
|
-
d++;
|
|
7293
|
-
} else {
|
|
7294
|
-
c++;
|
|
7295
|
-
}
|
|
7296
|
-
break;
|
|
7297
|
-
case "not":
|
|
7298
|
-
for (j = 0, num = modifier.args.length; j < num; j++) {
|
|
7299
|
-
updateValues(modifier.args[j]);
|
|
7300
|
-
}
|
|
7301
|
-
}
|
|
7302
|
-
}
|
|
7303
|
-
}
|
|
7304
|
-
for (i = 0, len = selector.parts.length; i < len; i++) {
|
|
7305
|
-
part = selector.parts[i];
|
|
7306
|
-
if (part instanceof SelectorPart) {
|
|
7307
|
-
updateValues(part);
|
|
7308
|
-
}
|
|
7309
|
-
}
|
|
7310
|
-
return new Specificity(0, b, c, d);
|
|
7311
|
-
};
|
|
7312
|
-
var h = /^[0-9a-fA-F]$/, nl = /\n|\r\n|\r|\f/;
|
|
7313
|
-
function isHexDigit(c) {
|
|
7314
|
-
return c !== null && h.test(c);
|
|
7315
|
-
}
|
|
7316
|
-
function isDigit(c) {
|
|
7317
|
-
return c !== null && /\d/.test(c);
|
|
7318
|
-
}
|
|
7319
|
-
function isWhitespace(c) {
|
|
7320
|
-
return c !== null && /\s/.test(c);
|
|
7321
|
-
}
|
|
7322
|
-
function isNewLine(c) {
|
|
7323
|
-
return c !== null && nl.test(c);
|
|
7324
|
-
}
|
|
7325
|
-
function isNameStart(c) {
|
|
7326
|
-
return c !== null && /[a-z_\u0080-\uFFFF\\]/i.test(c);
|
|
7327
|
-
}
|
|
7328
|
-
function isNameChar(c) {
|
|
7329
|
-
return c !== null && (isNameStart(c) || /[0-9\-\\]/.test(c));
|
|
7330
|
-
}
|
|
7331
|
-
function isIdentStart(c) {
|
|
7332
|
-
return c !== null && (isNameStart(c) || /\-\\/.test(c));
|
|
7333
|
-
}
|
|
7334
|
-
function mix(receiver, supplier) {
|
|
7335
|
-
for (var prop in supplier) {
|
|
7336
|
-
if (Object.prototype.hasOwnProperty.call(supplier, prop)) {
|
|
7337
|
-
receiver[prop] = supplier[prop];
|
|
7338
|
-
}
|
|
7339
|
-
}
|
|
7340
|
-
return receiver;
|
|
7341
|
-
}
|
|
7342
|
-
function TokenStream(input) {
|
|
7343
|
-
TokenStreamBase.call(this, input, Tokens);
|
|
7344
|
-
}
|
|
7345
|
-
TokenStream.prototype = mix(new TokenStreamBase(), {
|
|
7346
|
-
_getToken: function(channel) {
|
|
7347
|
-
var c, reader = this._reader, token = null, startLine = reader.getLine(), startCol = reader.getCol();
|
|
7348
|
-
c = reader.read();
|
|
7349
|
-
while (c) {
|
|
7350
|
-
switch (c) {
|
|
7351
|
-
case "/":
|
|
7352
|
-
if (reader.peek() === "*") {
|
|
7353
|
-
token = this.commentToken(c, startLine, startCol);
|
|
7354
|
-
} else {
|
|
7355
|
-
token = this.charToken(c, startLine, startCol);
|
|
7356
|
-
}
|
|
7357
|
-
break;
|
|
7358
|
-
case "|":
|
|
7359
|
-
case "~":
|
|
7360
|
-
case "^":
|
|
7361
|
-
case "$":
|
|
7362
|
-
case "*":
|
|
7363
|
-
if (reader.peek() === "=") {
|
|
7364
|
-
token = this.comparisonToken(c, startLine, startCol);
|
|
7365
|
-
} else {
|
|
7366
|
-
token = this.charToken(c, startLine, startCol);
|
|
7367
|
-
}
|
|
7368
|
-
break;
|
|
7369
|
-
case '"':
|
|
7370
|
-
case "'":
|
|
7371
|
-
token = this.stringToken(c, startLine, startCol);
|
|
7372
|
-
break;
|
|
7373
|
-
case "#":
|
|
7374
|
-
if (isNameChar(reader.peek())) {
|
|
7375
|
-
token = this.hashToken(c, startLine, startCol);
|
|
7376
|
-
} else {
|
|
7377
|
-
token = this.charToken(c, startLine, startCol);
|
|
7378
|
-
}
|
|
7379
|
-
break;
|
|
7380
|
-
case ".":
|
|
7381
|
-
if (isDigit(reader.peek())) {
|
|
7382
|
-
token = this.numberToken(c, startLine, startCol);
|
|
7383
|
-
} else {
|
|
7384
|
-
token = this.charToken(c, startLine, startCol);
|
|
7385
|
-
}
|
|
7386
|
-
break;
|
|
7387
|
-
case "-":
|
|
7388
|
-
if (reader.peek() === "-") {
|
|
7389
|
-
token = this.htmlCommentEndToken(c, startLine, startCol);
|
|
7390
|
-
} else if (isNameStart(reader.peek())) {
|
|
7391
|
-
token = this.identOrFunctionToken(c, startLine, startCol);
|
|
7392
|
-
} else {
|
|
7393
|
-
token = this.charToken(c, startLine, startCol);
|
|
7394
|
-
}
|
|
7395
|
-
break;
|
|
7396
|
-
case "!":
|
|
7397
|
-
token = this.importantToken(c, startLine, startCol);
|
|
7398
|
-
break;
|
|
7399
|
-
case "@":
|
|
7400
|
-
token = this.atRuleToken(c, startLine, startCol);
|
|
7401
|
-
break;
|
|
7402
|
-
case ":":
|
|
7403
|
-
token = this.notToken(c, startLine, startCol);
|
|
7404
|
-
break;
|
|
7405
|
-
case "<":
|
|
7406
|
-
token = this.htmlCommentStartToken(c, startLine, startCol);
|
|
7407
|
-
break;
|
|
7408
|
-
case "U":
|
|
7409
|
-
case "u":
|
|
7410
|
-
if (reader.peek() === "+") {
|
|
7411
|
-
token = this.unicodeRangeToken(c, startLine, startCol);
|
|
7412
|
-
break;
|
|
7413
|
-
}
|
|
7414
|
-
default:
|
|
7415
|
-
if (isDigit(c)) {
|
|
7416
|
-
token = this.numberToken(c, startLine, startCol);
|
|
7417
|
-
} else if (isWhitespace(c)) {
|
|
7418
|
-
token = this.whitespaceToken(c, startLine, startCol);
|
|
7419
|
-
} else if (isIdentStart(c)) {
|
|
7420
|
-
token = this.identOrFunctionToken(c, startLine, startCol);
|
|
7421
|
-
} else {
|
|
7422
|
-
token = this.charToken(c, startLine, startCol);
|
|
7423
|
-
}
|
|
7424
|
-
}
|
|
7425
|
-
break;
|
|
7426
|
-
}
|
|
7427
|
-
if (!token && c === null) {
|
|
7428
|
-
token = this.createToken(Tokens.EOF, null, startLine, startCol);
|
|
7429
|
-
}
|
|
7430
|
-
return token;
|
|
7431
|
-
},
|
|
7432
|
-
createToken: function(tt, value, startLine, startCol, options) {
|
|
7433
|
-
var reader = this._reader;
|
|
7434
|
-
options = options || {};
|
|
7435
|
-
return {
|
|
7436
|
-
value,
|
|
7437
|
-
type: tt,
|
|
7438
|
-
channel: options.channel,
|
|
7439
|
-
endChar: options.endChar,
|
|
7440
|
-
hide: options.hide || false,
|
|
7441
|
-
startLine,
|
|
7442
|
-
startCol,
|
|
7443
|
-
endLine: reader.getLine(),
|
|
7444
|
-
endCol: reader.getCol()
|
|
7445
|
-
};
|
|
7446
|
-
},
|
|
7447
|
-
atRuleToken: function(first, startLine, startCol) {
|
|
7448
|
-
var rule = first, reader = this._reader, tt = Tokens.CHAR, ident;
|
|
7449
|
-
reader.mark();
|
|
7450
|
-
ident = this.readName();
|
|
7451
|
-
rule = first + ident;
|
|
7452
|
-
tt = Tokens.type(rule.toLowerCase());
|
|
7453
|
-
if (tt === Tokens.CHAR || tt === Tokens.UNKNOWN) {
|
|
7454
|
-
if (rule.length > 1) {
|
|
7455
|
-
tt = Tokens.UNKNOWN_SYM;
|
|
7456
|
-
} else {
|
|
7457
|
-
tt = Tokens.CHAR;
|
|
7458
|
-
rule = first;
|
|
7459
|
-
reader.reset();
|
|
7460
|
-
}
|
|
7461
|
-
}
|
|
7462
|
-
return this.createToken(tt, rule, startLine, startCol);
|
|
7463
|
-
},
|
|
7464
|
-
charToken: function(c, startLine, startCol) {
|
|
7465
|
-
var tt = Tokens.type(c);
|
|
7466
|
-
var opts = {};
|
|
7467
|
-
if (tt === -1) {
|
|
7468
|
-
tt = Tokens.CHAR;
|
|
7469
|
-
} else {
|
|
7470
|
-
opts.endChar = Tokens[tt].endChar;
|
|
7471
|
-
}
|
|
7472
|
-
return this.createToken(tt, c, startLine, startCol, opts);
|
|
7473
|
-
},
|
|
7474
|
-
commentToken: function(first, startLine, startCol) {
|
|
7475
|
-
var comment = this.readComment(first);
|
|
7476
|
-
return this.createToken(Tokens.COMMENT, comment, startLine, startCol);
|
|
7477
|
-
},
|
|
7478
|
-
comparisonToken: function(c, startLine, startCol) {
|
|
7479
|
-
var reader = this._reader, comparison = c + reader.read(), tt = Tokens.type(comparison) || Tokens.CHAR;
|
|
7480
|
-
return this.createToken(tt, comparison, startLine, startCol);
|
|
7481
|
-
},
|
|
7482
|
-
hashToken: function(first, startLine, startCol) {
|
|
7483
|
-
var name = this.readName(first);
|
|
7484
|
-
return this.createToken(Tokens.HASH, name, startLine, startCol);
|
|
7485
|
-
},
|
|
7486
|
-
htmlCommentStartToken: function(first, startLine, startCol) {
|
|
7487
|
-
var reader = this._reader, text = first;
|
|
7488
|
-
reader.mark();
|
|
7489
|
-
text += reader.readCount(3);
|
|
7490
|
-
if (text === "<!--") {
|
|
7491
|
-
return this.createToken(Tokens.CDO, text, startLine, startCol);
|
|
7492
|
-
} else {
|
|
7493
|
-
reader.reset();
|
|
7494
|
-
return this.charToken(first, startLine, startCol);
|
|
7495
|
-
}
|
|
7496
|
-
},
|
|
7497
|
-
htmlCommentEndToken: function(first, startLine, startCol) {
|
|
7498
|
-
var reader = this._reader, text = first;
|
|
7499
|
-
reader.mark();
|
|
7500
|
-
text += reader.readCount(2);
|
|
7501
|
-
if (text === "-->") {
|
|
7502
|
-
return this.createToken(Tokens.CDC, text, startLine, startCol);
|
|
7503
|
-
} else {
|
|
7504
|
-
reader.reset();
|
|
7505
|
-
return this.charToken(first, startLine, startCol);
|
|
7506
|
-
}
|
|
7507
|
-
},
|
|
7508
|
-
identOrFunctionToken: function(first, startLine, startCol) {
|
|
7509
|
-
var reader = this._reader, ident = this.readName(first), tt = Tokens.IDENT, uriFns = ["url(", "url-prefix(", "domain("];
|
|
7510
|
-
if (reader.peek() === "(") {
|
|
7511
|
-
ident += reader.read();
|
|
7512
|
-
if (uriFns.indexOf(ident.toLowerCase()) > -1) {
|
|
7513
|
-
tt = Tokens.URI;
|
|
7514
|
-
ident = this.readURI(ident);
|
|
7515
|
-
if (uriFns.indexOf(ident.toLowerCase()) > -1) {
|
|
7516
|
-
tt = Tokens.FUNCTION;
|
|
7517
|
-
}
|
|
7518
|
-
} else {
|
|
7519
|
-
tt = Tokens.FUNCTION;
|
|
7520
|
-
}
|
|
7521
|
-
} else if (reader.peek() === ":") {
|
|
7522
|
-
if (ident.toLowerCase() === "progid") {
|
|
7523
|
-
ident += reader.readTo("(");
|
|
7524
|
-
tt = Tokens.IE_FUNCTION;
|
|
7525
|
-
}
|
|
7526
|
-
}
|
|
7527
|
-
return this.createToken(tt, ident, startLine, startCol);
|
|
7528
|
-
},
|
|
7529
|
-
importantToken: function(first, startLine, startCol) {
|
|
7530
|
-
var reader = this._reader, important = first, tt = Tokens.CHAR, temp, c;
|
|
7531
|
-
reader.mark();
|
|
7532
|
-
c = reader.read();
|
|
7533
|
-
while (c) {
|
|
7534
|
-
if (c === "/") {
|
|
7535
|
-
if (reader.peek() !== "*") {
|
|
7536
|
-
break;
|
|
7537
|
-
} else {
|
|
7538
|
-
temp = this.readComment(c);
|
|
7539
|
-
if (temp === "") {
|
|
7540
|
-
break;
|
|
7541
|
-
}
|
|
7542
|
-
}
|
|
7543
|
-
} else if (isWhitespace(c)) {
|
|
7544
|
-
important += c + this.readWhitespace();
|
|
7545
|
-
} else if (/i/i.test(c)) {
|
|
7546
|
-
temp = reader.readCount(8);
|
|
7547
|
-
if (/mportant/i.test(temp)) {
|
|
7548
|
-
important += c + temp;
|
|
7549
|
-
tt = Tokens.IMPORTANT_SYM;
|
|
7550
|
-
}
|
|
7551
|
-
break;
|
|
7552
|
-
} else {
|
|
7553
|
-
break;
|
|
7554
|
-
}
|
|
7555
|
-
c = reader.read();
|
|
7556
|
-
}
|
|
7557
|
-
if (tt === Tokens.CHAR) {
|
|
7558
|
-
reader.reset();
|
|
7559
|
-
return this.charToken(first, startLine, startCol);
|
|
7560
|
-
} else {
|
|
7561
|
-
return this.createToken(tt, important, startLine, startCol);
|
|
7562
|
-
}
|
|
7563
|
-
},
|
|
7564
|
-
notToken: function(first, startLine, startCol) {
|
|
7565
|
-
var reader = this._reader, text = first;
|
|
7566
|
-
reader.mark();
|
|
7567
|
-
text += reader.readCount(4);
|
|
7568
|
-
if (text.toLowerCase() === ":not(") {
|
|
7569
|
-
return this.createToken(Tokens.NOT, text, startLine, startCol);
|
|
7570
|
-
} else {
|
|
7571
|
-
reader.reset();
|
|
7572
|
-
return this.charToken(first, startLine, startCol);
|
|
7573
|
-
}
|
|
7574
|
-
},
|
|
7575
|
-
numberToken: function(first, startLine, startCol) {
|
|
7576
|
-
var reader = this._reader, value = this.readNumber(first), ident, tt = Tokens.NUMBER, c = reader.peek();
|
|
7577
|
-
if (isIdentStart(c)) {
|
|
7578
|
-
ident = this.readName(reader.read());
|
|
7579
|
-
value += ident;
|
|
7580
|
-
if (/^em$|^ex$|^px$|^gd$|^rem$|^vw$|^vh$|^vmax$|^vmin$|^ch$|^cm$|^mm$|^in$|^pt$|^pc$/i.test(ident)) {
|
|
7581
|
-
tt = Tokens.LENGTH;
|
|
7582
|
-
} else if (/^deg|^rad$|^grad$/i.test(ident)) {
|
|
7583
|
-
tt = Tokens.ANGLE;
|
|
7584
|
-
} else if (/^ms$|^s$/i.test(ident)) {
|
|
7585
|
-
tt = Tokens.TIME;
|
|
7586
|
-
} else if (/^hz$|^khz$/i.test(ident)) {
|
|
7587
|
-
tt = Tokens.FREQ;
|
|
7588
|
-
} else if (/^dpi$|^dpcm$/i.test(ident)) {
|
|
7589
|
-
tt = Tokens.RESOLUTION;
|
|
7590
|
-
} else {
|
|
7591
|
-
tt = Tokens.DIMENSION;
|
|
7592
|
-
}
|
|
7593
|
-
} else if (c === "%") {
|
|
7594
|
-
value += reader.read();
|
|
7595
|
-
tt = Tokens.PERCENTAGE;
|
|
7596
|
-
}
|
|
7597
|
-
return this.createToken(tt, value, startLine, startCol);
|
|
7598
|
-
},
|
|
7599
|
-
stringToken: function(first, startLine, startCol) {
|
|
7600
|
-
var delim = first, string = first, reader = this._reader, prev = first, tt = Tokens.STRING, c = reader.read();
|
|
7601
|
-
while (c) {
|
|
7602
|
-
string += c;
|
|
7603
|
-
if (c === delim && prev !== "\\") {
|
|
7604
|
-
break;
|
|
7605
|
-
}
|
|
7606
|
-
if (isNewLine(reader.peek()) && c !== "\\") {
|
|
7607
|
-
tt = Tokens.INVALID;
|
|
7608
|
-
break;
|
|
7609
|
-
}
|
|
7610
|
-
prev = c;
|
|
7611
|
-
c = reader.read();
|
|
7612
|
-
}
|
|
7613
|
-
if (c === null) {
|
|
7614
|
-
tt = Tokens.INVALID;
|
|
7615
|
-
}
|
|
7616
|
-
return this.createToken(tt, string, startLine, startCol);
|
|
7617
|
-
},
|
|
7618
|
-
unicodeRangeToken: function(first, startLine, startCol) {
|
|
7619
|
-
var reader = this._reader, value = first, temp, tt = Tokens.CHAR;
|
|
7620
|
-
if (reader.peek() === "+") {
|
|
7621
|
-
reader.mark();
|
|
7622
|
-
value += reader.read();
|
|
7623
|
-
value += this.readUnicodeRangePart(true);
|
|
7624
|
-
if (value.length === 2) {
|
|
7625
|
-
reader.reset();
|
|
7626
|
-
} else {
|
|
7627
|
-
tt = Tokens.UNICODE_RANGE;
|
|
7628
|
-
if (value.indexOf("?") === -1) {
|
|
7629
|
-
if (reader.peek() === "-") {
|
|
7630
|
-
reader.mark();
|
|
7631
|
-
temp = reader.read();
|
|
7632
|
-
temp += this.readUnicodeRangePart(false);
|
|
7633
|
-
if (temp.length === 1) {
|
|
7634
|
-
reader.reset();
|
|
7635
|
-
} else {
|
|
7636
|
-
value += temp;
|
|
7637
|
-
}
|
|
7638
|
-
}
|
|
7639
|
-
}
|
|
7640
|
-
}
|
|
7641
|
-
}
|
|
7642
|
-
return this.createToken(tt, value, startLine, startCol);
|
|
7643
|
-
},
|
|
7644
|
-
whitespaceToken: function(first, startLine, startCol) {
|
|
7645
|
-
var value = first + this.readWhitespace();
|
|
7646
|
-
return this.createToken(Tokens.S, value, startLine, startCol);
|
|
7647
|
-
},
|
|
7648
|
-
readUnicodeRangePart: function(allowQuestionMark) {
|
|
7649
|
-
var reader = this._reader, part = "", c = reader.peek();
|
|
7650
|
-
while (isHexDigit(c) && part.length < 6) {
|
|
7651
|
-
reader.read();
|
|
7652
|
-
part += c;
|
|
7653
|
-
c = reader.peek();
|
|
7654
|
-
}
|
|
7655
|
-
if (allowQuestionMark) {
|
|
7656
|
-
while (c === "?" && part.length < 6) {
|
|
7657
|
-
reader.read();
|
|
7658
|
-
part += c;
|
|
7659
|
-
c = reader.peek();
|
|
7660
|
-
}
|
|
7661
|
-
}
|
|
7662
|
-
return part;
|
|
7663
|
-
},
|
|
7664
|
-
readWhitespace: function() {
|
|
7665
|
-
var reader = this._reader, whitespace = "", c = reader.peek();
|
|
7666
|
-
while (isWhitespace(c)) {
|
|
7667
|
-
reader.read();
|
|
7668
|
-
whitespace += c;
|
|
7669
|
-
c = reader.peek();
|
|
7670
|
-
}
|
|
7671
|
-
return whitespace;
|
|
7672
|
-
},
|
|
7673
|
-
readNumber: function(first) {
|
|
7674
|
-
var reader = this._reader, number = first, hasDot = first === ".", c = reader.peek();
|
|
7675
|
-
while (c) {
|
|
7676
|
-
if (isDigit(c)) {
|
|
7677
|
-
number += reader.read();
|
|
7678
|
-
} else if (c === ".") {
|
|
7679
|
-
if (hasDot) {
|
|
7680
|
-
break;
|
|
7681
|
-
} else {
|
|
7682
|
-
hasDot = true;
|
|
7683
|
-
number += reader.read();
|
|
7684
|
-
}
|
|
7685
|
-
} else {
|
|
7686
|
-
break;
|
|
7687
|
-
}
|
|
7688
|
-
c = reader.peek();
|
|
7689
|
-
}
|
|
7690
|
-
return number;
|
|
7691
|
-
},
|
|
7692
|
-
readString: function() {
|
|
7693
|
-
var reader = this._reader, delim = reader.read(), string = delim, prev = delim, c = reader.peek();
|
|
7694
|
-
while (c) {
|
|
7695
|
-
c = reader.read();
|
|
7696
|
-
string += c;
|
|
7697
|
-
if (c === delim && prev !== "\\") {
|
|
7698
|
-
break;
|
|
7699
|
-
}
|
|
7700
|
-
if (isNewLine(reader.peek()) && c !== "\\") {
|
|
7701
|
-
string = "";
|
|
7702
|
-
break;
|
|
7703
|
-
}
|
|
7704
|
-
prev = c;
|
|
7705
|
-
c = reader.peek();
|
|
7706
|
-
}
|
|
7707
|
-
if (c === null) {
|
|
7708
|
-
string = "";
|
|
7709
|
-
}
|
|
7710
|
-
return string;
|
|
7711
|
-
},
|
|
7712
|
-
readURI: function(first) {
|
|
7713
|
-
var reader = this._reader, uri = first, inner = "", c = reader.peek();
|
|
7714
|
-
reader.mark();
|
|
7715
|
-
while (c && isWhitespace(c)) {
|
|
7716
|
-
reader.read();
|
|
7717
|
-
c = reader.peek();
|
|
7718
|
-
}
|
|
7719
|
-
if (c === "'" || c === '"') {
|
|
7720
|
-
inner = this.readString();
|
|
7721
|
-
} else {
|
|
7722
|
-
inner = this.readURL();
|
|
7723
|
-
}
|
|
7724
|
-
c = reader.peek();
|
|
7725
|
-
while (c && isWhitespace(c)) {
|
|
7726
|
-
reader.read();
|
|
7727
|
-
c = reader.peek();
|
|
7728
|
-
}
|
|
7729
|
-
if (inner === "" || c !== ")") {
|
|
7730
|
-
uri = first;
|
|
7731
|
-
reader.reset();
|
|
7732
|
-
} else {
|
|
7733
|
-
uri += inner + reader.read();
|
|
7734
|
-
}
|
|
7735
|
-
return uri;
|
|
7736
|
-
},
|
|
7737
|
-
readURL: function() {
|
|
7738
|
-
var reader = this._reader, url = "", c = reader.peek();
|
|
7739
|
-
while (/^[!#$%&\\*-~]$/.test(c)) {
|
|
7740
|
-
url += reader.read();
|
|
7741
|
-
c = reader.peek();
|
|
7742
|
-
}
|
|
7743
|
-
return url;
|
|
7744
|
-
},
|
|
7745
|
-
readName: function(first) {
|
|
7746
|
-
var reader = this._reader, ident = first || "", c = reader.peek();
|
|
7747
|
-
while (true) {
|
|
7748
|
-
if (c === "\\") {
|
|
7749
|
-
ident += this.readEscape(reader.read());
|
|
7750
|
-
c = reader.peek();
|
|
7751
|
-
} else if (c && isNameChar(c)) {
|
|
7752
|
-
ident += reader.read();
|
|
7753
|
-
c = reader.peek();
|
|
7754
|
-
} else {
|
|
7755
|
-
break;
|
|
7756
|
-
}
|
|
7757
|
-
}
|
|
7758
|
-
return ident;
|
|
7759
|
-
},
|
|
7760
|
-
readEscape: function(first) {
|
|
7761
|
-
var reader = this._reader, cssEscape = first || "", i = 0, c = reader.peek();
|
|
7762
|
-
if (isHexDigit(c)) {
|
|
7763
|
-
do {
|
|
7764
|
-
cssEscape += reader.read();
|
|
7765
|
-
c = reader.peek();
|
|
7766
|
-
} while (c && isHexDigit(c) && ++i < 6);
|
|
7767
|
-
}
|
|
7768
|
-
if (cssEscape.length === 3 && /\s/.test(c) || cssEscape.length === 7 || cssEscape.length === 1) {
|
|
7769
|
-
reader.read();
|
|
7770
|
-
} else {
|
|
7771
|
-
c = "";
|
|
7772
|
-
}
|
|
7773
|
-
return cssEscape + c;
|
|
7774
|
-
},
|
|
7775
|
-
readComment: function(first) {
|
|
7776
|
-
var reader = this._reader, comment = first || "", c = reader.read();
|
|
7777
|
-
if (c === "*") {
|
|
7778
|
-
while (c) {
|
|
7779
|
-
comment += c;
|
|
7780
|
-
if (comment.length > 2 && c === "*" && reader.peek() === "/") {
|
|
7781
|
-
comment += reader.read();
|
|
7782
|
-
break;
|
|
7783
|
-
}
|
|
7784
|
-
c = reader.read();
|
|
7785
|
-
}
|
|
7786
|
-
return comment;
|
|
7787
|
-
} else {
|
|
7788
|
-
return "";
|
|
7789
|
-
}
|
|
7790
|
-
}
|
|
7791
|
-
});
|
|
7792
|
-
var Tokens = [
|
|
7793
|
-
{ name: "CDO" },
|
|
7794
|
-
{ name: "CDC" },
|
|
7795
|
-
{ name: "S", whitespace: true },
|
|
7796
|
-
{ name: "COMMENT", comment: true, hide: true, channel: "comment" },
|
|
7797
|
-
{ name: "INCLUDES", text: "~=" },
|
|
7798
|
-
{ name: "DASHMATCH", text: "|=" },
|
|
7799
|
-
{ name: "PREFIXMATCH", text: "^=" },
|
|
7800
|
-
{ name: "SUFFIXMATCH", text: "$=" },
|
|
7801
|
-
{ name: "SUBSTRINGMATCH", text: "*=" },
|
|
7802
|
-
{ name: "STRING" },
|
|
7803
|
-
{ name: "IDENT" },
|
|
7804
|
-
{ name: "HASH" },
|
|
7805
|
-
{ name: "IMPORT_SYM", text: "@import" },
|
|
7806
|
-
{ name: "PAGE_SYM", text: "@page" },
|
|
7807
|
-
{ name: "MEDIA_SYM", text: "@media" },
|
|
7808
|
-
{ name: "FONT_FACE_SYM", text: "@font-face" },
|
|
7809
|
-
{ name: "CHARSET_SYM", text: "@charset" },
|
|
7810
|
-
{ name: "NAMESPACE_SYM", text: "@namespace" },
|
|
7811
|
-
{ name: "VIEWPORT_SYM", text: ["@viewport", "@-ms-viewport", "@-o-viewport"] },
|
|
7812
|
-
{ name: "DOCUMENT_SYM", text: ["@document", "@-moz-document"] },
|
|
7813
|
-
{ name: "UNKNOWN_SYM" },
|
|
7814
|
-
{ name: "KEYFRAMES_SYM", text: ["@keyframes", "@-webkit-keyframes", "@-moz-keyframes", "@-o-keyframes"] },
|
|
7815
|
-
{ name: "IMPORTANT_SYM" },
|
|
7816
|
-
{ name: "LENGTH" },
|
|
7817
|
-
{ name: "ANGLE" },
|
|
7818
|
-
{ name: "TIME" },
|
|
7819
|
-
{ name: "FREQ" },
|
|
7820
|
-
{ name: "DIMENSION" },
|
|
7821
|
-
{ name: "PERCENTAGE" },
|
|
7822
|
-
{ name: "NUMBER" },
|
|
7823
|
-
{ name: "URI" },
|
|
7824
|
-
{ name: "FUNCTION" },
|
|
7825
|
-
{ name: "UNICODE_RANGE" },
|
|
7826
|
-
{ name: "INVALID" },
|
|
7827
|
-
{ name: "PLUS", text: "+" },
|
|
7828
|
-
{ name: "GREATER", text: ">" },
|
|
7829
|
-
{ name: "COMMA", text: "," },
|
|
7830
|
-
{ name: "TILDE", text: "~" },
|
|
7831
|
-
{ name: "NOT" },
|
|
7832
|
-
{ name: "TOPLEFTCORNER_SYM", text: "@top-left-corner" },
|
|
7833
|
-
{ name: "TOPLEFT_SYM", text: "@top-left" },
|
|
7834
|
-
{ name: "TOPCENTER_SYM", text: "@top-center" },
|
|
7835
|
-
{ name: "TOPRIGHT_SYM", text: "@top-right" },
|
|
7836
|
-
{ name: "TOPRIGHTCORNER_SYM", text: "@top-right-corner" },
|
|
7837
|
-
{ name: "BOTTOMLEFTCORNER_SYM", text: "@bottom-left-corner" },
|
|
7838
|
-
{ name: "BOTTOMLEFT_SYM", text: "@bottom-left" },
|
|
7839
|
-
{ name: "BOTTOMCENTER_SYM", text: "@bottom-center" },
|
|
7840
|
-
{ name: "BOTTOMRIGHT_SYM", text: "@bottom-right" },
|
|
7841
|
-
{ name: "BOTTOMRIGHTCORNER_SYM", text: "@bottom-right-corner" },
|
|
7842
|
-
{ name: "LEFTTOP_SYM", text: "@left-top" },
|
|
7843
|
-
{ name: "LEFTMIDDLE_SYM", text: "@left-middle" },
|
|
7844
|
-
{ name: "LEFTBOTTOM_SYM", text: "@left-bottom" },
|
|
7845
|
-
{ name: "RIGHTTOP_SYM", text: "@right-top" },
|
|
7846
|
-
{ name: "RIGHTMIDDLE_SYM", text: "@right-middle" },
|
|
7847
|
-
{ name: "RIGHTBOTTOM_SYM", text: "@right-bottom" },
|
|
7848
|
-
{ name: "RESOLUTION", state: "media" },
|
|
7849
|
-
{ name: "IE_FUNCTION" },
|
|
7850
|
-
{ name: "CHAR" },
|
|
7851
|
-
{
|
|
7852
|
-
name: "PIPE",
|
|
7853
|
-
text: "|"
|
|
7854
|
-
},
|
|
7855
|
-
{
|
|
7856
|
-
name: "SLASH",
|
|
7857
|
-
text: "/"
|
|
7858
|
-
},
|
|
7859
|
-
{
|
|
7860
|
-
name: "MINUS",
|
|
7861
|
-
text: "-"
|
|
7862
|
-
},
|
|
7863
|
-
{
|
|
7864
|
-
name: "STAR",
|
|
7865
|
-
text: "*"
|
|
7866
|
-
},
|
|
7867
|
-
{
|
|
7868
|
-
name: "LBRACE",
|
|
7869
|
-
endChar: "}",
|
|
7870
|
-
text: "{"
|
|
7871
|
-
},
|
|
7872
|
-
{
|
|
7873
|
-
name: "RBRACE",
|
|
7874
|
-
text: "}"
|
|
7875
|
-
},
|
|
7876
|
-
{
|
|
7877
|
-
name: "LBRACKET",
|
|
7878
|
-
endChar: "]",
|
|
7879
|
-
text: "["
|
|
7880
|
-
},
|
|
7881
|
-
{
|
|
7882
|
-
name: "RBRACKET",
|
|
7883
|
-
text: "]"
|
|
7884
|
-
},
|
|
7885
|
-
{
|
|
7886
|
-
name: "EQUALS",
|
|
7887
|
-
text: "="
|
|
7888
|
-
},
|
|
7889
|
-
{
|
|
7890
|
-
name: "COLON",
|
|
7891
|
-
text: ":"
|
|
7892
|
-
},
|
|
7893
|
-
{
|
|
7894
|
-
name: "SEMICOLON",
|
|
7895
|
-
text: ";"
|
|
7896
|
-
},
|
|
7897
|
-
{
|
|
7898
|
-
name: "LPAREN",
|
|
7899
|
-
endChar: ")",
|
|
7900
|
-
text: "("
|
|
7901
|
-
},
|
|
7902
|
-
{
|
|
7903
|
-
name: "RPAREN",
|
|
7904
|
-
text: ")"
|
|
7905
|
-
},
|
|
7906
|
-
{
|
|
7907
|
-
name: "DOT",
|
|
7908
|
-
text: "."
|
|
7909
|
-
}
|
|
7910
|
-
];
|
|
7911
|
-
(function() {
|
|
7912
|
-
var nameMap = [], typeMap = /* @__PURE__ */ Object.create(null);
|
|
7913
|
-
Tokens.UNKNOWN = -1;
|
|
7914
|
-
Tokens.unshift({ name: "EOF" });
|
|
7915
|
-
for (var i = 0, len = Tokens.length; i < len; i++) {
|
|
7916
|
-
nameMap.push(Tokens[i].name);
|
|
7917
|
-
Tokens[Tokens[i].name] = i;
|
|
7918
|
-
if (Tokens[i].text) {
|
|
7919
|
-
if (Tokens[i].text instanceof Array) {
|
|
7920
|
-
for (var j = 0; j < Tokens[i].text.length; j++) {
|
|
7921
|
-
typeMap[Tokens[i].text[j]] = i;
|
|
7922
|
-
}
|
|
7923
|
-
} else {
|
|
7924
|
-
typeMap[Tokens[i].text] = i;
|
|
7925
|
-
}
|
|
7926
|
-
}
|
|
7927
|
-
}
|
|
7928
|
-
Tokens.name = function(tt) {
|
|
7929
|
-
return nameMap[tt];
|
|
7930
|
-
};
|
|
7931
|
-
Tokens.type = function(c) {
|
|
7932
|
-
return typeMap[c] || -1;
|
|
7933
|
-
};
|
|
7934
|
-
})();
|
|
7935
|
-
var Validation = {
|
|
7936
|
-
validate: function(property, value) {
|
|
7937
|
-
var name = property.toString().toLowerCase(), expression = new PropertyValueIterator(value), spec = Properties[name];
|
|
7938
|
-
if (!spec) {
|
|
7939
|
-
if (name.indexOf("-") !== 0) {
|
|
7940
|
-
throw new ValidationError("Unknown property '" + property + "'.", property.line, property.col);
|
|
7941
|
-
}
|
|
7942
|
-
} else if (typeof spec !== "number") {
|
|
7943
|
-
if (typeof spec === "string") {
|
|
7944
|
-
if (spec.indexOf("||") > -1) {
|
|
7945
|
-
this.groupProperty(spec, expression);
|
|
7946
|
-
} else {
|
|
7947
|
-
this.singleProperty(spec, expression, 1);
|
|
7948
|
-
}
|
|
7949
|
-
} else if (spec.multi) {
|
|
7950
|
-
this.multiProperty(spec.multi, expression, spec.comma, spec.max || Infinity);
|
|
7951
|
-
} else if (typeof spec === "function") {
|
|
7952
|
-
spec(expression);
|
|
7953
|
-
}
|
|
7954
|
-
}
|
|
7955
|
-
},
|
|
7956
|
-
singleProperty: function(types, expression, max, partial) {
|
|
7957
|
-
var result = false, value = expression.value, count = 0, part;
|
|
7958
|
-
while (expression.hasNext() && count < max) {
|
|
7959
|
-
result = ValidationTypes.isAny(expression, types);
|
|
7960
|
-
if (!result) {
|
|
7961
|
-
break;
|
|
7962
|
-
}
|
|
7963
|
-
count++;
|
|
7964
|
-
}
|
|
7965
|
-
if (!result) {
|
|
7966
|
-
if (expression.hasNext() && !expression.isFirst()) {
|
|
7967
|
-
part = expression.peek();
|
|
7968
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
7969
|
-
} else {
|
|
7970
|
-
throw new ValidationError("Expected (" + types + ") but found '" + value + "'.", value.line, value.col);
|
|
4632
|
+
var s = "";
|
|
4633
|
+
if (this.scheme !== void 0)
|
|
4634
|
+
s += this.scheme + ":";
|
|
4635
|
+
if (this.isAbsolute()) {
|
|
4636
|
+
s += "//";
|
|
4637
|
+
if (this.username || this.password) {
|
|
4638
|
+
s += this.username || "";
|
|
4639
|
+
if (this.password) {
|
|
4640
|
+
s += ":" + this.password;
|
|
7971
4641
|
}
|
|
7972
|
-
|
|
7973
|
-
part = expression.next();
|
|
7974
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
4642
|
+
s += "@";
|
|
7975
4643
|
}
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
var result = false, value = expression.value, count = 0, part;
|
|
7979
|
-
while (expression.hasNext() && !result && count < max) {
|
|
7980
|
-
if (ValidationTypes.isAny(expression, types)) {
|
|
7981
|
-
count++;
|
|
7982
|
-
if (!expression.hasNext()) {
|
|
7983
|
-
result = true;
|
|
7984
|
-
} else if (comma) {
|
|
7985
|
-
if (String(expression.peek()) === ",") {
|
|
7986
|
-
part = expression.next();
|
|
7987
|
-
} else {
|
|
7988
|
-
break;
|
|
7989
|
-
}
|
|
7990
|
-
}
|
|
7991
|
-
} else {
|
|
7992
|
-
break;
|
|
7993
|
-
}
|
|
4644
|
+
if (this.host) {
|
|
4645
|
+
s += this.host;
|
|
7994
4646
|
}
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
4647
|
+
}
|
|
4648
|
+
if (this.port !== void 0)
|
|
4649
|
+
s += ":" + this.port;
|
|
4650
|
+
if (this.path !== void 0)
|
|
4651
|
+
s += this.path;
|
|
4652
|
+
if (this.query !== void 0)
|
|
4653
|
+
s += "?" + this.query;
|
|
4654
|
+
if (this.fragment !== void 0)
|
|
4655
|
+
s += "#" + this.fragment;
|
|
4656
|
+
return s;
|
|
4657
|
+
},
|
|
4658
|
+
resolve: function(relative) {
|
|
4659
|
+
var base = this;
|
|
4660
|
+
var r = new URL(relative);
|
|
4661
|
+
var t = new URL();
|
|
4662
|
+
if (r.scheme !== void 0) {
|
|
4663
|
+
t.scheme = r.scheme;
|
|
4664
|
+
t.username = r.username;
|
|
4665
|
+
t.password = r.password;
|
|
4666
|
+
t.host = r.host;
|
|
4667
|
+
t.port = r.port;
|
|
4668
|
+
t.path = remove_dot_segments(r.path);
|
|
4669
|
+
t.query = r.query;
|
|
4670
|
+
} else {
|
|
4671
|
+
t.scheme = base.scheme;
|
|
4672
|
+
if (r.host !== void 0) {
|
|
4673
|
+
t.username = r.username;
|
|
4674
|
+
t.password = r.password;
|
|
4675
|
+
t.host = r.host;
|
|
4676
|
+
t.port = r.port;
|
|
4677
|
+
t.path = remove_dot_segments(r.path);
|
|
4678
|
+
t.query = r.query;
|
|
4679
|
+
} else {
|
|
4680
|
+
t.username = base.username;
|
|
4681
|
+
t.password = base.password;
|
|
4682
|
+
t.host = base.host;
|
|
4683
|
+
t.port = base.port;
|
|
4684
|
+
if (!r.path) {
|
|
4685
|
+
t.path = base.path;
|
|
4686
|
+
if (r.query !== void 0)
|
|
4687
|
+
t.query = r.query;
|
|
4688
|
+
else
|
|
4689
|
+
t.query = base.query;
|
|
7999
4690
|
} else {
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
4691
|
+
if (r.path.charAt(0) === "/") {
|
|
4692
|
+
t.path = remove_dot_segments(r.path);
|
|
8003
4693
|
} else {
|
|
8004
|
-
|
|
4694
|
+
t.path = merge(base.path, r.path);
|
|
4695
|
+
t.path = remove_dot_segments(t.path);
|
|
8005
4696
|
}
|
|
4697
|
+
t.query = r.query;
|
|
8006
4698
|
}
|
|
8007
|
-
} else if (expression.hasNext()) {
|
|
8008
|
-
part = expression.next();
|
|
8009
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
8010
4699
|
}
|
|
8011
|
-
}
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
4700
|
+
}
|
|
4701
|
+
t.fragment = r.fragment;
|
|
4702
|
+
return t.toString();
|
|
4703
|
+
function merge(basepath, refpath) {
|
|
4704
|
+
if (base.host !== void 0 && !base.path)
|
|
4705
|
+
return "/" + refpath;
|
|
4706
|
+
var lastslash = basepath.lastIndexOf("/");
|
|
4707
|
+
if (lastslash === -1)
|
|
4708
|
+
return refpath;
|
|
4709
|
+
else
|
|
4710
|
+
return basepath.substring(0, lastslash + 1) + refpath;
|
|
4711
|
+
}
|
|
4712
|
+
function remove_dot_segments(path) {
|
|
4713
|
+
if (!path)
|
|
4714
|
+
return path;
|
|
4715
|
+
var output = "";
|
|
4716
|
+
while (path.length > 0) {
|
|
4717
|
+
if (path === "." || path === "..") {
|
|
4718
|
+
path = "";
|
|
8028
4719
|
break;
|
|
8029
4720
|
}
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
4721
|
+
var twochars = path.substring(0, 2);
|
|
4722
|
+
var threechars = path.substring(0, 3);
|
|
4723
|
+
var fourchars = path.substring(0, 4);
|
|
4724
|
+
if (threechars === "../") {
|
|
4725
|
+
path = path.substring(3);
|
|
4726
|
+
} else if (twochars === "./") {
|
|
4727
|
+
path = path.substring(2);
|
|
4728
|
+
} else if (threechars === "/./") {
|
|
4729
|
+
path = "/" + path.substring(3);
|
|
4730
|
+
} else if (twochars === "/." && path.length === 2) {
|
|
4731
|
+
path = "/";
|
|
4732
|
+
} else if (fourchars === "/../" || threechars === "/.." && path.length === 3) {
|
|
4733
|
+
path = "/" + path.substring(4);
|
|
4734
|
+
output = output.replace(/\/?[^\/]*$/, "");
|
|
8035
4735
|
} else {
|
|
8036
|
-
|
|
4736
|
+
var segment = path.match(/(\/?([^\/]*))/)[0];
|
|
4737
|
+
output += segment;
|
|
4738
|
+
path = path.substring(segment.length);
|
|
8037
4739
|
}
|
|
8038
|
-
} else if (expression.hasNext()) {
|
|
8039
|
-
part = expression.next();
|
|
8040
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
8041
4740
|
}
|
|
4741
|
+
return output;
|
|
8042
4742
|
}
|
|
8043
|
-
}
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
},
|
|
8105
|
-
"<attr>": function(part) {
|
|
8106
|
-
return part.type === "function" && part.name === "attr";
|
|
8107
|
-
},
|
|
8108
|
-
"<bg-image>": function(part) {
|
|
8109
|
-
return this["<image>"](part) || this["<gradient>"](part) || String(part) === "none";
|
|
8110
|
-
},
|
|
8111
|
-
"<gradient>": function(part) {
|
|
8112
|
-
return part.type === "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?(?:repeating\-)?(?:radial\-|linear\-)?gradient/i.test(part);
|
|
8113
|
-
},
|
|
8114
|
-
"<box>": function(part) {
|
|
8115
|
-
return ValidationTypes.isLiteral(part, "padding-box | border-box | content-box");
|
|
8116
|
-
},
|
|
8117
|
-
"<content>": function(part) {
|
|
8118
|
-
return part.type === "function" && part.name === "content";
|
|
8119
|
-
},
|
|
8120
|
-
"<relative-size>": function(part) {
|
|
8121
|
-
return ValidationTypes.isLiteral(part, "smaller | larger");
|
|
8122
|
-
},
|
|
8123
|
-
"<ident>": function(part) {
|
|
8124
|
-
return part.type === "identifier";
|
|
8125
|
-
},
|
|
8126
|
-
"<length>": function(part) {
|
|
8127
|
-
if (part.type === "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?calc/i.test(part)) {
|
|
8128
|
-
return true;
|
|
8129
|
-
} else {
|
|
8130
|
-
return part.type === "length" || part.type === "number" || part.type === "integer" || String(part) === "0";
|
|
8131
|
-
}
|
|
8132
|
-
},
|
|
8133
|
-
"<color>": function(part) {
|
|
8134
|
-
return part.type === "color" || String(part) === "transparent" || String(part) === "currentColor";
|
|
8135
|
-
},
|
|
8136
|
-
"<number>": function(part) {
|
|
8137
|
-
return part.type === "number" || this["<integer>"](part);
|
|
8138
|
-
},
|
|
8139
|
-
"<integer>": function(part) {
|
|
8140
|
-
return part.type === "integer";
|
|
8141
|
-
},
|
|
8142
|
-
"<line>": function(part) {
|
|
8143
|
-
return part.type === "integer";
|
|
8144
|
-
},
|
|
8145
|
-
"<angle>": function(part) {
|
|
8146
|
-
return part.type === "angle";
|
|
8147
|
-
},
|
|
8148
|
-
"<uri>": function(part) {
|
|
8149
|
-
return part.type === "uri";
|
|
8150
|
-
},
|
|
8151
|
-
"<image>": function(part) {
|
|
8152
|
-
return this["<uri>"](part);
|
|
8153
|
-
},
|
|
8154
|
-
"<percentage>": function(part) {
|
|
8155
|
-
return part.type === "percentage" || String(part) === "0";
|
|
8156
|
-
},
|
|
8157
|
-
"<border-width>": function(part) {
|
|
8158
|
-
return this["<length>"](part) || ValidationTypes.isLiteral(part, "thin | medium | thick");
|
|
8159
|
-
},
|
|
8160
|
-
"<border-style>": function(part) {
|
|
8161
|
-
return ValidationTypes.isLiteral(part, "none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset");
|
|
8162
|
-
},
|
|
8163
|
-
"<content-sizing>": function(part) {
|
|
8164
|
-
return ValidationTypes.isLiteral(part, "fill-available | -moz-available | -webkit-fill-available | max-content | -moz-max-content | -webkit-max-content | min-content | -moz-min-content | -webkit-min-content | fit-content | -moz-fit-content | -webkit-fit-content");
|
|
8165
|
-
},
|
|
8166
|
-
"<margin-width>": function(part) {
|
|
8167
|
-
return this["<length>"](part) || this["<percentage>"](part) || ValidationTypes.isLiteral(part, "auto");
|
|
8168
|
-
},
|
|
8169
|
-
"<padding-width>": function(part) {
|
|
8170
|
-
return this["<length>"](part) || this["<percentage>"](part);
|
|
8171
|
-
},
|
|
8172
|
-
"<shape>": function(part) {
|
|
8173
|
-
return part.type === "function" && (part.name === "rect" || part.name === "inset-rect");
|
|
8174
|
-
},
|
|
8175
|
-
"<time>": function(part) {
|
|
8176
|
-
return part.type === "time";
|
|
8177
|
-
},
|
|
8178
|
-
"<flex-grow>": function(part) {
|
|
8179
|
-
return this["<number>"](part);
|
|
8180
|
-
},
|
|
8181
|
-
"<flex-shrink>": function(part) {
|
|
8182
|
-
return this["<number>"](part);
|
|
8183
|
-
},
|
|
8184
|
-
"<width>": function(part) {
|
|
8185
|
-
return this["<margin-width>"](part);
|
|
8186
|
-
},
|
|
8187
|
-
"<flex-basis>": function(part) {
|
|
8188
|
-
return this["<width>"](part);
|
|
8189
|
-
},
|
|
8190
|
-
"<flex-direction>": function(part) {
|
|
8191
|
-
return ValidationTypes.isLiteral(part, "row | row-reverse | column | column-reverse");
|
|
8192
|
-
},
|
|
8193
|
-
"<flex-wrap>": function(part) {
|
|
8194
|
-
return ValidationTypes.isLiteral(part, "nowrap | wrap | wrap-reverse");
|
|
8195
|
-
},
|
|
8196
|
-
"<feature-tag-value>": function(part) {
|
|
8197
|
-
return part.type === "function" && /^[A-Z0-9]{4}$/i.test(part);
|
|
8198
|
-
}
|
|
8199
|
-
},
|
|
8200
|
-
complex: {
|
|
8201
|
-
__proto__: null,
|
|
8202
|
-
"<bg-position>": function(expression) {
|
|
8203
|
-
var result = false, numeric = "<percentage> | <length>", xDir = "left | right", yDir = "top | bottom", count = 0;
|
|
8204
|
-
while (expression.peek(count) && expression.peek(count).text !== ",") {
|
|
8205
|
-
count++;
|
|
8206
|
-
}
|
|
8207
|
-
if (count < 3) {
|
|
8208
|
-
if (ValidationTypes.isAny(expression, xDir + " | center | " + numeric)) {
|
|
8209
|
-
result = true;
|
|
8210
|
-
ValidationTypes.isAny(expression, yDir + " | center | " + numeric);
|
|
8211
|
-
} else if (ValidationTypes.isAny(expression, yDir)) {
|
|
8212
|
-
result = true;
|
|
8213
|
-
ValidationTypes.isAny(expression, xDir + " | center");
|
|
8214
|
-
}
|
|
8215
|
-
} else {
|
|
8216
|
-
if (ValidationTypes.isAny(expression, xDir)) {
|
|
8217
|
-
if (ValidationTypes.isAny(expression, yDir)) {
|
|
8218
|
-
result = true;
|
|
8219
|
-
ValidationTypes.isAny(expression, numeric);
|
|
8220
|
-
} else if (ValidationTypes.isAny(expression, numeric)) {
|
|
8221
|
-
if (ValidationTypes.isAny(expression, yDir)) {
|
|
8222
|
-
result = true;
|
|
8223
|
-
ValidationTypes.isAny(expression, numeric);
|
|
8224
|
-
} else if (ValidationTypes.isAny(expression, "center")) {
|
|
8225
|
-
result = true;
|
|
8226
|
-
}
|
|
8227
|
-
}
|
|
8228
|
-
} else if (ValidationTypes.isAny(expression, yDir)) {
|
|
8229
|
-
if (ValidationTypes.isAny(expression, xDir)) {
|
|
8230
|
-
result = true;
|
|
8231
|
-
ValidationTypes.isAny(expression, numeric);
|
|
8232
|
-
} else if (ValidationTypes.isAny(expression, numeric)) {
|
|
8233
|
-
if (ValidationTypes.isAny(expression, xDir)) {
|
|
8234
|
-
result = true;
|
|
8235
|
-
ValidationTypes.isAny(expression, numeric);
|
|
8236
|
-
} else if (ValidationTypes.isAny(expression, "center")) {
|
|
8237
|
-
result = true;
|
|
8238
|
-
}
|
|
8239
|
-
}
|
|
8240
|
-
} else if (ValidationTypes.isAny(expression, "center")) {
|
|
8241
|
-
if (ValidationTypes.isAny(expression, xDir + " | " + yDir)) {
|
|
8242
|
-
result = true;
|
|
8243
|
-
ValidationTypes.isAny(expression, numeric);
|
|
8244
|
-
}
|
|
8245
|
-
}
|
|
8246
|
-
}
|
|
8247
|
-
return result;
|
|
8248
|
-
},
|
|
8249
|
-
"<bg-size>": function(expression) {
|
|
8250
|
-
var result = false, numeric = "<percentage> | <length> | auto";
|
|
8251
|
-
if (ValidationTypes.isAny(expression, "cover | contain")) {
|
|
8252
|
-
result = true;
|
|
8253
|
-
} else if (ValidationTypes.isAny(expression, numeric)) {
|
|
8254
|
-
result = true;
|
|
8255
|
-
ValidationTypes.isAny(expression, numeric);
|
|
8256
|
-
}
|
|
8257
|
-
return result;
|
|
8258
|
-
},
|
|
8259
|
-
"<repeat-style>": function(expression) {
|
|
8260
|
-
var result = false, values = "repeat | space | round | no-repeat", part;
|
|
8261
|
-
if (expression.hasNext()) {
|
|
8262
|
-
part = expression.next();
|
|
8263
|
-
if (ValidationTypes.isLiteral(part, "repeat-x | repeat-y")) {
|
|
8264
|
-
result = true;
|
|
8265
|
-
} else if (ValidationTypes.isLiteral(part, values)) {
|
|
8266
|
-
result = true;
|
|
8267
|
-
if (expression.hasNext() && ValidationTypes.isLiteral(expression.peek(), values)) {
|
|
8268
|
-
expression.next();
|
|
8269
|
-
}
|
|
8270
|
-
}
|
|
8271
|
-
}
|
|
8272
|
-
return result;
|
|
8273
|
-
},
|
|
8274
|
-
"<shadow>": function(expression) {
|
|
8275
|
-
var result = false, count = 0, inset = false, color = false;
|
|
8276
|
-
if (expression.hasNext()) {
|
|
8277
|
-
if (ValidationTypes.isAny(expression, "inset")) {
|
|
8278
|
-
inset = true;
|
|
8279
|
-
}
|
|
8280
|
-
if (ValidationTypes.isAny(expression, "<color>")) {
|
|
8281
|
-
color = true;
|
|
8282
|
-
}
|
|
8283
|
-
while (ValidationTypes.isAny(expression, "<length>") && count < 4) {
|
|
8284
|
-
count++;
|
|
8285
|
-
}
|
|
8286
|
-
if (expression.hasNext()) {
|
|
8287
|
-
if (!color) {
|
|
8288
|
-
ValidationTypes.isAny(expression, "<color>");
|
|
8289
|
-
}
|
|
8290
|
-
if (!inset) {
|
|
8291
|
-
ValidationTypes.isAny(expression, "inset");
|
|
8292
|
-
}
|
|
8293
|
-
}
|
|
8294
|
-
result = count >= 2 && count <= 4;
|
|
4743
|
+
}
|
|
4744
|
+
};
|
|
4745
|
+
}
|
|
4746
|
+
});
|
|
4747
|
+
|
|
4748
|
+
// external/npm/node_modules/domino/lib/CustomEvent.js
|
|
4749
|
+
var require_CustomEvent = __commonJS({
|
|
4750
|
+
"external/npm/node_modules/domino/lib/CustomEvent.js"(exports, module) {
|
|
4751
|
+
"use strict";
|
|
4752
|
+
module.exports = CustomEvent;
|
|
4753
|
+
var Event = require_Event();
|
|
4754
|
+
function CustomEvent(type, dictionary) {
|
|
4755
|
+
Event.call(this, type, dictionary);
|
|
4756
|
+
}
|
|
4757
|
+
CustomEvent.prototype = Object.create(Event.prototype, {
|
|
4758
|
+
constructor: { value: CustomEvent }
|
|
4759
|
+
});
|
|
4760
|
+
}
|
|
4761
|
+
});
|
|
4762
|
+
|
|
4763
|
+
// external/npm/node_modules/domino/lib/events.js
|
|
4764
|
+
var require_events = __commonJS({
|
|
4765
|
+
"external/npm/node_modules/domino/lib/events.js"(exports, module) {
|
|
4766
|
+
"use strict";
|
|
4767
|
+
module.exports = {
|
|
4768
|
+
Event: require_Event(),
|
|
4769
|
+
UIEvent: require_UIEvent(),
|
|
4770
|
+
MouseEvent: require_MouseEvent(),
|
|
4771
|
+
CustomEvent: require_CustomEvent()
|
|
4772
|
+
};
|
|
4773
|
+
}
|
|
4774
|
+
});
|
|
4775
|
+
|
|
4776
|
+
// external/npm/node_modules/domino/lib/style_parser.js
|
|
4777
|
+
var require_style_parser = __commonJS({
|
|
4778
|
+
"external/npm/node_modules/domino/lib/style_parser.js"(exports) {
|
|
4779
|
+
"use strict";
|
|
4780
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4781
|
+
exports.hyphenate = exports.parse = void 0;
|
|
4782
|
+
function parse(value) {
|
|
4783
|
+
const styles = [];
|
|
4784
|
+
let i = 0;
|
|
4785
|
+
let parenDepth = 0;
|
|
4786
|
+
let quote = 0;
|
|
4787
|
+
let valueStart = 0;
|
|
4788
|
+
let propStart = 0;
|
|
4789
|
+
let currentProp = null;
|
|
4790
|
+
while (i < value.length) {
|
|
4791
|
+
const token = value.charCodeAt(i++);
|
|
4792
|
+
switch (token) {
|
|
4793
|
+
case 40:
|
|
4794
|
+
parenDepth++;
|
|
4795
|
+
break;
|
|
4796
|
+
case 41:
|
|
4797
|
+
parenDepth--;
|
|
4798
|
+
break;
|
|
4799
|
+
case 39:
|
|
4800
|
+
if (quote === 0) {
|
|
4801
|
+
quote = 39;
|
|
4802
|
+
} else if (quote === 39 && value.charCodeAt(i - 1) !== 92) {
|
|
4803
|
+
quote = 0;
|
|
8295
4804
|
}
|
|
8296
|
-
|
|
8297
|
-
|
|
8298
|
-
|
|
8299
|
-
|
|
8300
|
-
if (
|
|
8301
|
-
|
|
8302
|
-
ValidationTypes.isAny(expression, simple);
|
|
4805
|
+
break;
|
|
4806
|
+
case 34:
|
|
4807
|
+
if (quote === 0) {
|
|
4808
|
+
quote = 34;
|
|
4809
|
+
} else if (quote === 34 && value.charCodeAt(i - 1) !== 92) {
|
|
4810
|
+
quote = 0;
|
|
8303
4811
|
}
|
|
8304
|
-
|
|
8305
|
-
|
|
8306
|
-
|
|
8307
|
-
|
|
8308
|
-
|
|
8309
|
-
result = true;
|
|
8310
|
-
} else {
|
|
8311
|
-
if (ValidationTypes.isType(expression, "<flex-grow>")) {
|
|
8312
|
-
if (expression.peek()) {
|
|
8313
|
-
if (ValidationTypes.isType(expression, "<flex-shrink>")) {
|
|
8314
|
-
if (expression.peek()) {
|
|
8315
|
-
result = ValidationTypes.isType(expression, "<flex-basis>");
|
|
8316
|
-
} else {
|
|
8317
|
-
result = true;
|
|
8318
|
-
}
|
|
8319
|
-
} else if (ValidationTypes.isType(expression, "<flex-basis>")) {
|
|
8320
|
-
result = expression.peek() === null;
|
|
8321
|
-
}
|
|
8322
|
-
} else {
|
|
8323
|
-
result = true;
|
|
8324
|
-
}
|
|
8325
|
-
} else if (ValidationTypes.isType(expression, "<flex-basis>")) {
|
|
8326
|
-
result = true;
|
|
8327
|
-
}
|
|
4812
|
+
break;
|
|
4813
|
+
case 58:
|
|
4814
|
+
if (!currentProp && parenDepth === 0 && quote === 0) {
|
|
4815
|
+
currentProp = hyphenate(value.substring(propStart, i - 1).trim());
|
|
4816
|
+
valueStart = i;
|
|
8328
4817
|
}
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
|
|
4818
|
+
break;
|
|
4819
|
+
case 59:
|
|
4820
|
+
if (currentProp && valueStart > 0 && parenDepth === 0 && quote === 0) {
|
|
4821
|
+
const styleVal = value.substring(valueStart, i - 1).trim();
|
|
4822
|
+
styles.push(currentProp, styleVal);
|
|
4823
|
+
propStart = i;
|
|
4824
|
+
valueStart = 0;
|
|
4825
|
+
currentProp = null;
|
|
8332
4826
|
}
|
|
8333
|
-
|
|
8334
|
-
}
|
|
4827
|
+
break;
|
|
8335
4828
|
}
|
|
8336
|
-
};
|
|
8337
|
-
parserlib.css = {
|
|
8338
|
-
__proto__: null,
|
|
8339
|
-
Colors,
|
|
8340
|
-
Combinator,
|
|
8341
|
-
Parser,
|
|
8342
|
-
PropertyName,
|
|
8343
|
-
PropertyValue,
|
|
8344
|
-
PropertyValuePart,
|
|
8345
|
-
MediaFeature,
|
|
8346
|
-
MediaQuery,
|
|
8347
|
-
Selector,
|
|
8348
|
-
SelectorPart,
|
|
8349
|
-
SelectorSubPart,
|
|
8350
|
-
Specificity,
|
|
8351
|
-
TokenStream,
|
|
8352
|
-
Tokens,
|
|
8353
|
-
ValidationError
|
|
8354
|
-
};
|
|
8355
|
-
})();
|
|
8356
|
-
(function() {
|
|
8357
|
-
for (var prop in parserlib) {
|
|
8358
|
-
exports[prop] = parserlib[prop];
|
|
8359
4829
|
}
|
|
8360
|
-
|
|
4830
|
+
if (currentProp && valueStart) {
|
|
4831
|
+
const styleVal = value.slice(valueStart).trim();
|
|
4832
|
+
styles.push(currentProp, styleVal);
|
|
4833
|
+
}
|
|
4834
|
+
return styles;
|
|
4835
|
+
}
|
|
4836
|
+
exports.parse = parse;
|
|
4837
|
+
function hyphenate(value) {
|
|
4838
|
+
return value.replace(/[a-z][A-Z]/g, (v) => {
|
|
4839
|
+
return v.charAt(0) + "-" + v.charAt(1);
|
|
4840
|
+
}).toLowerCase();
|
|
4841
|
+
}
|
|
4842
|
+
exports.hyphenate = hyphenate;
|
|
8361
4843
|
}
|
|
8362
4844
|
});
|
|
8363
4845
|
|
|
@@ -8365,23 +4847,33 @@ var require_cssparser = __commonJS({
|
|
|
8365
4847
|
var require_CSSStyleDeclaration = __commonJS({
|
|
8366
4848
|
"external/npm/node_modules/domino/lib/CSSStyleDeclaration.js"(exports, module) {
|
|
8367
4849
|
"use strict";
|
|
8368
|
-
var
|
|
4850
|
+
var { parse } = require_style_parser();
|
|
8369
4851
|
module.exports = CSSStyleDeclaration;
|
|
8370
4852
|
function CSSStyleDeclaration(elt) {
|
|
8371
4853
|
this._element = elt;
|
|
8372
4854
|
}
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
|
|
8379
|
-
|
|
8380
|
-
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
4855
|
+
var IMPORTANT_BANG = "!important";
|
|
4856
|
+
function parseStyles(value) {
|
|
4857
|
+
const result = {
|
|
4858
|
+
property: {},
|
|
4859
|
+
priority: {}
|
|
4860
|
+
};
|
|
4861
|
+
if (!value) {
|
|
4862
|
+
return result;
|
|
4863
|
+
}
|
|
4864
|
+
const styleValues = parse(value);
|
|
4865
|
+
if (styleValues.length < 2) {
|
|
4866
|
+
return result;
|
|
4867
|
+
}
|
|
4868
|
+
for (let i = 0; i < styleValues.length; i += 2) {
|
|
4869
|
+
const name = styleValues[i];
|
|
4870
|
+
let value2 = styleValues[i + 1];
|
|
4871
|
+
if (value2.endsWith(IMPORTANT_BANG)) {
|
|
4872
|
+
result.priority[name] = "important";
|
|
4873
|
+
value2 = value2.slice(0, -IMPORTANT_BANG.length).trim();
|
|
4874
|
+
}
|
|
4875
|
+
result.property[name] = value2;
|
|
4876
|
+
}
|
|
8385
4877
|
return result;
|
|
8386
4878
|
}
|
|
8387
4879
|
var NO_CHANGE = {};
|
|
@@ -8448,6 +4940,7 @@ var require_CSSStyleDeclaration = __commonJS({
|
|
|
8448
4940
|
if (value !== NO_CHANGE) {
|
|
8449
4941
|
value = "" + value;
|
|
8450
4942
|
}
|
|
4943
|
+
value = value.trim();
|
|
8451
4944
|
if (value === "") {
|
|
8452
4945
|
this.removeProperty(property);
|
|
8453
4946
|
return;
|
|
@@ -19938,27 +16431,11 @@ var require_lib = __commonJS({
|
|
|
19938
16431
|
}
|
|
19939
16432
|
});
|
|
19940
16433
|
export default require_lib();
|
|
19941
|
-
|
|
19942
|
-
|
|
19943
|
-
|
|
19944
|
-
|
|
19945
|
-
|
|
19946
|
-
|
|
19947
|
-
|
|
19948
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19949
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
19950
|
-
furnished to do so, subject to the following conditions:
|
|
19951
|
-
|
|
19952
|
-
The above copyright notice and this permission notice shall be included in
|
|
19953
|
-
all copies or substantial portions of the Software.
|
|
19954
|
-
|
|
19955
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19956
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19957
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19958
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19959
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19960
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19961
|
-
THE SOFTWARE.
|
|
19962
|
-
|
|
19963
|
-
*/
|
|
16434
|
+
/**
|
|
16435
|
+
* @license
|
|
16436
|
+
* Copyright Google LLC All Rights Reserved.
|
|
16437
|
+
*
|
|
16438
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
16439
|
+
* found in the LICENSE file at https://angular.io/license
|
|
16440
|
+
*/
|
|
19964
16441
|
//# sourceMappingURL=bundled-domino.mjs.map
|