Skip to content

Commit 17996d3

Browse files
morcharddomenic
authored andcommitted
Implement frameElement for Window
This does not perform proper cross-origin security checks, since that is not possible in jsdom's current setup.
1 parent a56b11d commit 17996d3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/jsdom/browser/Window.js

+4
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ function Window(options) {
6161
// Set up the window as if it's a top level window.
6262
// If it's not, then references will be corrected by frame/iframe code.
6363
this._parent = this._top = this._globalProxy;
64+
this._frameElement = null;
6465

6566
// List options explicitly to be clear which are passed through
6667
this._document = Document.create([], {
@@ -122,6 +123,9 @@ function Window(options) {
122123
get window() {
123124
return window._globalProxy;
124125
},
126+
get frameElement() {
127+
return window._frameElement;
128+
},
125129
get frames() {
126130
return window._globalProxy;
127131
},

lib/jsdom/living/nodes/HTMLFrameElement-impl.js

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ function loadFrame(frame) {
5858
const contentWindow = contentDoc._defaultView;
5959
contentWindow._parent = parent;
6060
contentWindow._top = parent.top;
61+
contentWindow._frameElement = frame;
6162
contentWindow._virtualConsole = parent._virtualConsole;
6263

6364
// Handle about:blank with a simulated load of an empty document.

0 commit comments

Comments
 (0)