happy-dom 9.3.0 → 9.3.1
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,14 @@ export default class Location extends URL {
|
|
8
8
|
* Constructor.
|
9
9
|
*/
|
10
10
|
constructor();
|
11
|
+
/**
|
12
|
+
* Override set href.
|
13
|
+
*/
|
14
|
+
set href(value: string);
|
15
|
+
/**
|
16
|
+
* Override set href.
|
17
|
+
*/
|
18
|
+
get href(): string;
|
11
19
|
/**
|
12
20
|
* Replaces the current resource with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session History, meaning the user won't be able to use the back button to navigate to it.
|
13
21
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Location.d.ts","sourceRoot":"","sources":["../../src/location/Location.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;
|
1
|
+
{"version":3,"file":"Location.d.ts","sourceRoot":"","sources":["../../src/location/Location.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAI1B;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,GAAG;IACxC;;OAEG;;IAKH;;OAEG;IAEH,IAAW,IAAI,CAAC,KAAK,EAAE,MAAM,EAgB5B;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;;OAIG;IACI,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIjC;;;;;;;OAOG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIhC;;;;OAIG;IACI,MAAM,IAAI,IAAI;CAGrB"}
|
package/lib/location/Location.js
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
const url_1 = require("url");
|
7
|
+
const DOMException_1 = __importDefault(require("../exception/DOMException"));
|
8
|
+
const DOMExceptionNameEnum_1 = __importDefault(require("../exception/DOMExceptionNameEnum"));
|
4
9
|
/**
|
5
10
|
*
|
6
11
|
*/
|
@@ -11,6 +16,29 @@ class Location extends url_1.URL {
|
|
11
16
|
constructor() {
|
12
17
|
super('about:blank');
|
13
18
|
}
|
19
|
+
/**
|
20
|
+
* Override set href.
|
21
|
+
*/
|
22
|
+
// @ts-ignore
|
23
|
+
set href(value) {
|
24
|
+
try {
|
25
|
+
super.href = this.hostname ? new url_1.URL(value, this).href : value;
|
26
|
+
}
|
27
|
+
catch (e) {
|
28
|
+
if (this.hostname) {
|
29
|
+
throw new DOMException_1.default(`Failed to construct URL from string "${value}".`, DOMExceptionNameEnum_1.default.uriMismatchError);
|
30
|
+
}
|
31
|
+
else {
|
32
|
+
throw new DOMException_1.default(`Failed to construct URL from string "${value}" relative to URL "${super.href}".`, DOMExceptionNameEnum_1.default.uriMismatchError);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
/**
|
37
|
+
* Override set href.
|
38
|
+
*/
|
39
|
+
get href() {
|
40
|
+
return super.href;
|
41
|
+
}
|
14
42
|
/**
|
15
43
|
* Replaces the current resource with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session History, meaning the user won't be able to use the back button to navigate to it.
|
16
44
|
*
|
@@ -28,7 +56,7 @@ class Location extends url_1.URL {
|
|
28
56
|
* @see this.replace()
|
29
57
|
*/
|
30
58
|
assign(url) {
|
31
|
-
this.
|
59
|
+
this.href = url;
|
32
60
|
}
|
33
61
|
/**
|
34
62
|
* Reloads the resource from the current URL.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Location.js","sourceRoot":"","sources":["../../src/location/Location.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"Location.js","sourceRoot":"","sources":["../../src/location/Location.ts"],"names":[],"mappings":";;;;;AAAA,6BAA0B;AAC1B,6EAAqD;AACrD,6FAAqE;AAErE;;GAEG;AACH,MAAqB,QAAS,SAAQ,SAAG;IACxC;;OAEG;IACH;QACC,KAAK,CAAC,aAAa,CAAC,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,aAAa;IACb,IAAW,IAAI,CAAC,KAAa;QAC5B,IAAI;YACH,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,SAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;SAC/D;QAAC,OAAO,CAAC,EAAE;YACX,IAAI,IAAI,CAAC,QAAQ,EAAE;gBAClB,MAAM,IAAI,sBAAY,CACrB,wCAAwC,KAAK,IAAI,EACjD,8BAAoB,CAAC,gBAAgB,CACrC,CAAC;aACF;iBAAM;gBACN,MAAM,IAAI,sBAAY,CACrB,wCAAwC,KAAK,sBAAsB,KAAK,CAAC,IAAI,IAAI,EACjF,8BAAoB,CAAC,gBAAgB,CACrC,CAAC;aACF;SACD;IACF,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,KAAK,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,GAAW;QACzB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IACjB,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,GAAW;QACxB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACI,MAAM;QACZ,aAAa;IACd,CAAC;CACD;AAlED,2BAkEC"}
|
package/package.json
CHANGED
package/src/location/Location.ts
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
import { URL } from 'url';
|
2
|
+
import DOMException from '../exception/DOMException';
|
3
|
+
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum';
|
2
4
|
|
3
5
|
/**
|
4
6
|
*
|
@@ -11,6 +13,35 @@ export default class Location extends URL {
|
|
11
13
|
super('about:blank');
|
12
14
|
}
|
13
15
|
|
16
|
+
/**
|
17
|
+
* Override set href.
|
18
|
+
*/
|
19
|
+
// @ts-ignore
|
20
|
+
public set href(value: string) {
|
21
|
+
try {
|
22
|
+
super.href = this.hostname ? new URL(value, this).href : value;
|
23
|
+
} catch (e) {
|
24
|
+
if (this.hostname) {
|
25
|
+
throw new DOMException(
|
26
|
+
`Failed to construct URL from string "${value}".`,
|
27
|
+
DOMExceptionNameEnum.uriMismatchError
|
28
|
+
);
|
29
|
+
} else {
|
30
|
+
throw new DOMException(
|
31
|
+
`Failed to construct URL from string "${value}" relative to URL "${super.href}".`,
|
32
|
+
DOMExceptionNameEnum.uriMismatchError
|
33
|
+
);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Override set href.
|
40
|
+
*/
|
41
|
+
public get href(): string {
|
42
|
+
return super.href;
|
43
|
+
}
|
44
|
+
|
14
45
|
/**
|
15
46
|
* Replaces the current resource with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session History, meaning the user won't be able to use the back button to navigate to it.
|
16
47
|
*
|
@@ -29,7 +60,7 @@ export default class Location extends URL {
|
|
29
60
|
* @see this.replace()
|
30
61
|
*/
|
31
62
|
public assign(url: string): void {
|
32
|
-
this.
|
63
|
+
this.href = url;
|
33
64
|
}
|
34
65
|
|
35
66
|
/**
|