Simplify logic for checking if an element is a frame
This commit is contained in:
parent
12d729c3bc
commit
968367b042
@ -278,11 +278,14 @@ window._qutebrowser.webelem = (function() {
|
|||||||
// Check if elem is an iframe, and if so, return the result of func on it.
|
// Check if elem is an iframe, and if so, return the result of func on it.
|
||||||
// If no iframes match, return null
|
// If no iframes match, return null
|
||||||
function call_if_frame(elem, func) {
|
function call_if_frame(elem, func) {
|
||||||
const frame = elem.contentWindow;
|
|
||||||
// Check if elem is a frame, and if so, call func on the window
|
// Check if elem is a frame, and if so, call func on the window
|
||||||
if (frame && iframe_same_domain(frame) && frame.frameElement) {
|
if ("contentWindow" in elem) {
|
||||||
|
const frame = elem.contentWindow;
|
||||||
|
if (iframe_same_domain(frame) &&
|
||||||
|
"frameElement" in elem.contentWindow) {
|
||||||
return func(frame);
|
return func(frame);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user