@acemir/cssom 0.9.11 → 0.9.12
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/build/CSSOM.js +9 -5
- package/lib/CSSNamespaceRule.js +9 -5
- package/package.json +1 -1
package/build/CSSOM.js
CHANGED
|
@@ -883,10 +883,10 @@ Object.defineProperty(CSSOM.CSSNamespaceRule.prototype, "cssText", {
|
|
|
883
883
|
}
|
|
884
884
|
|
|
885
885
|
// Regex to match valid namespace syntax:
|
|
886
|
-
// 1. [optional prefix] url("...") or [optional prefix] url('...') or [optional prefix] url()
|
|
886
|
+
// 1. [optional prefix] url("...") or [optional prefix] url('...') or [optional prefix] url() or [optional prefix] url(unquoted)
|
|
887
887
|
// 2. [optional prefix] "..." or [optional prefix] '...'
|
|
888
888
|
// The prefix must be a valid CSS identifier (letters, digits, hyphens, underscores, starting with letter or underscore)
|
|
889
|
-
var re = /^(?:([a-zA-Z_][a-zA-Z0-9_-]*)\s+)?(?:url\(\s*(?:(['"])(.*?)\2\s
|
|
889
|
+
var re = /^(?:([a-zA-Z_][a-zA-Z0-9_-]*)\s+)?(?:url\(\s*(?:(['"])(.*?)\2\s*|([^)]*?))\s*\)|(['"])(.*?)\5)$/;
|
|
890
890
|
var match = text.match(re);
|
|
891
891
|
|
|
892
892
|
if (match) {
|
|
@@ -894,13 +894,17 @@ Object.defineProperty(CSSOM.CSSNamespaceRule.prototype, "cssText", {
|
|
|
894
894
|
if (match[1]) {
|
|
895
895
|
this.prefix = match[1];
|
|
896
896
|
}
|
|
897
|
-
// If url(...) form
|
|
897
|
+
// If url(...) form with quotes
|
|
898
898
|
if (typeof match[3] !== "undefined") {
|
|
899
899
|
this.namespaceURI = match[3];
|
|
900
900
|
}
|
|
901
|
+
// If url(...) form without quotes
|
|
902
|
+
else if (typeof match[4] !== "undefined") {
|
|
903
|
+
this.namespaceURI = match[4].trim();
|
|
904
|
+
}
|
|
901
905
|
// If quoted string form
|
|
902
|
-
else if (typeof match[
|
|
903
|
-
this.namespaceURI = match[
|
|
906
|
+
else if (typeof match[6] !== "undefined") {
|
|
907
|
+
this.namespaceURI = match[6];
|
|
904
908
|
}
|
|
905
909
|
} else {
|
|
906
910
|
throw new DOMException("Invalid @namespace rule", "InvalidStateError");
|
package/lib/CSSNamespaceRule.js
CHANGED
|
@@ -42,10 +42,10 @@ Object.defineProperty(CSSOM.CSSNamespaceRule.prototype, "cssText", {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// Regex to match valid namespace syntax:
|
|
45
|
-
// 1. [optional prefix] url("...") or [optional prefix] url('...') or [optional prefix] url()
|
|
45
|
+
// 1. [optional prefix] url("...") or [optional prefix] url('...') or [optional prefix] url() or [optional prefix] url(unquoted)
|
|
46
46
|
// 2. [optional prefix] "..." or [optional prefix] '...'
|
|
47
47
|
// The prefix must be a valid CSS identifier (letters, digits, hyphens, underscores, starting with letter or underscore)
|
|
48
|
-
var re = /^(?:([a-zA-Z_][a-zA-Z0-9_-]*)\s+)?(?:url\(\s*(?:(['"])(.*?)\2\s
|
|
48
|
+
var re = /^(?:([a-zA-Z_][a-zA-Z0-9_-]*)\s+)?(?:url\(\s*(?:(['"])(.*?)\2\s*|([^)]*?))\s*\)|(['"])(.*?)\5)$/;
|
|
49
49
|
var match = text.match(re);
|
|
50
50
|
|
|
51
51
|
if (match) {
|
|
@@ -53,13 +53,17 @@ Object.defineProperty(CSSOM.CSSNamespaceRule.prototype, "cssText", {
|
|
|
53
53
|
if (match[1]) {
|
|
54
54
|
this.prefix = match[1];
|
|
55
55
|
}
|
|
56
|
-
// If url(...) form
|
|
56
|
+
// If url(...) form with quotes
|
|
57
57
|
if (typeof match[3] !== "undefined") {
|
|
58
58
|
this.namespaceURI = match[3];
|
|
59
59
|
}
|
|
60
|
+
// If url(...) form without quotes
|
|
61
|
+
else if (typeof match[4] !== "undefined") {
|
|
62
|
+
this.namespaceURI = match[4].trim();
|
|
63
|
+
}
|
|
60
64
|
// If quoted string form
|
|
61
|
-
else if (typeof match[
|
|
62
|
-
this.namespaceURI = match[
|
|
65
|
+
else if (typeof match[6] !== "undefined") {
|
|
66
|
+
this.namespaceURI = match[6];
|
|
63
67
|
}
|
|
64
68
|
} else {
|
|
65
69
|
throw new DOMException("Invalid @namespace rule", "InvalidStateError");
|