happy-dom 2.27.0 → 2.27.2
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.
Potentially problematic release.
This version of happy-dom might be problematic. Click here for more details.
@@ -8,6 +8,7 @@ import IHTMLStyleElement from './IHTMLStyleElement';
|
|
8
8
|
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLStyleElement.
|
9
9
|
*/
|
10
10
|
export default class HTMLStyleElement extends HTMLElement implements IHTMLStyleElement {
|
11
|
+
private _styleSheet;
|
11
12
|
/**
|
12
13
|
* Returns CSS style sheet.
|
13
14
|
*
|
@@ -29,7 +29,9 @@ var HTMLElement_1 = __importDefault(require("../html-element/HTMLElement"));
|
|
29
29
|
var HTMLStyleElement = /** @class */ (function (_super) {
|
30
30
|
__extends(HTMLStyleElement, _super);
|
31
31
|
function HTMLStyleElement() {
|
32
|
-
|
32
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
33
|
+
_this._styleSheet = null;
|
34
|
+
return _this;
|
33
35
|
}
|
34
36
|
Object.defineProperty(HTMLStyleElement.prototype, "sheet", {
|
35
37
|
/**
|
@@ -41,9 +43,11 @@ var HTMLStyleElement = /** @class */ (function (_super) {
|
|
41
43
|
if (!this.isConnected) {
|
42
44
|
return null;
|
43
45
|
}
|
44
|
-
|
45
|
-
|
46
|
-
|
46
|
+
if (!this._styleSheet) {
|
47
|
+
this._styleSheet = new CSSStyleSheet_1.default();
|
48
|
+
this._styleSheet.replaceSync(this.innerText);
|
49
|
+
}
|
50
|
+
return this._styleSheet;
|
47
51
|
},
|
48
52
|
enumerable: false,
|
49
53
|
configurable: true
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"HTMLStyleElement.js","sourceRoot":"","sources":["../../../src/nodes/html-style-element/HTMLStyleElement.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,0EAAoD;AACpD,4EAAsD;AAGtD;;;;;GAKG;AACH;IAA8C,oCAAW;IAAzD;;
|
1
|
+
{"version":3,"file":"HTMLStyleElement.js","sourceRoot":"","sources":["../../../src/nodes/html-style-element/HTMLStyleElement.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,0EAAoD;AACpD,4EAAsD;AAGtD;;;;;GAKG;AACH;IAA8C,oCAAW;IAAzD;QAAA,qEA4EC;QA3EQ,iBAAW,GAAyB,IAAI,CAAC;;IA2ElD,CAAC;IApEA,sBAAW,mCAAK;QALhB;;;;WAIG;aACH;YACC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;gBACtB,OAAO,IAAI,CAAC;aACZ;YACD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;gBACtB,IAAI,CAAC,WAAW,GAAG,IAAI,uBAAa,EAAE,CAAC;gBACvC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aAC7C;YACD,OAAO,IAAI,CAAC,WAAW,CAAC;QACzB,CAAC;;;OAAA;IAOD,sBAAW,mCAAK;QALhB;;;;WAIG;aACH;YACC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QACjD,CAAC;QAED;;;;WAIG;aACH,UAAiB,KAAa;YAC7B,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAC3C,CAAC;;;OATA;IAgBD,sBAAW,kCAAI;QALf;;;;WAIG;aACH;YACC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QAChD,CAAC;QAED;;;;WAIG;aACH,UAAgB,IAAY;YAC3B,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QACzC,CAAC;;;OATA;IAgBD,sBAAW,sCAAQ;QALnB;;;;WAIG;aACH;YACC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QACvD,CAAC;QAED;;;;WAIG;aACH,UAAoB,QAAiB;YACpC,IAAI,CAAC,QAAQ,EAAE;gBACd,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;aACzC;iBAAM;gBACN,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;aAC1C;QACF,CAAC;;;OAbA;IAcF,uBAAC;AAAD,CAAC,AA5ED,CAA8C,qBAAW,GA4ExD"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "happy-dom",
|
3
|
-
"version": "2.27.
|
3
|
+
"version": "2.27.2",
|
4
4
|
"license": "MIT",
|
5
5
|
"homepage": "https://github.com/capricorn86/happy-dom",
|
6
6
|
"repository": "https://github.com/capricorn86/happy-dom",
|
@@ -74,5 +74,5 @@
|
|
74
74
|
"ts-jest": "^26.5.6",
|
75
75
|
"typescript": "^4.2.4"
|
76
76
|
},
|
77
|
-
"gitHead": "
|
77
|
+
"gitHead": "92ab173f6dd04d6e42bc63e3dc943523f3fea607"
|
78
78
|
}
|
@@ -9,6 +9,8 @@ import IHTMLStyleElement from './IHTMLStyleElement';
|
|
9
9
|
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLStyleElement.
|
10
10
|
*/
|
11
11
|
export default class HTMLStyleElement extends HTMLElement implements IHTMLStyleElement {
|
12
|
+
private _styleSheet: CSSStyleSheet | null = null;
|
13
|
+
|
12
14
|
/**
|
13
15
|
* Returns CSS style sheet.
|
14
16
|
*
|
@@ -18,9 +20,11 @@ export default class HTMLStyleElement extends HTMLElement implements IHTMLStyleE
|
|
18
20
|
if (!this.isConnected) {
|
19
21
|
return null;
|
20
22
|
}
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
if (!this._styleSheet) {
|
24
|
+
this._styleSheet = new CSSStyleSheet();
|
25
|
+
this._styleSheet.replaceSync(this.innerText);
|
26
|
+
}
|
27
|
+
return this._styleSheet;
|
24
28
|
}
|
25
29
|
|
26
30
|
/**
|