-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathi-frame-element.js
More file actions
61 lines (49 loc) · 1.82 KB
/
Copy pathi-frame-element.js
File metadata and controls
61 lines (49 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const assert = require('../assert.js').for('HTMLIframeElement');
const {parseHTML} = global[Symbol.for('linkedom')];
const {document} = parseHTML('<html><iframe src="./test.html"></html>');
const {firstElementChild: iframe} = document.documentElement;
assert(iframe.src, './test.html', 'Issue #82 - <iframe>.src');
{
const { document } = parseHTML("<html><body><iframe></iframe></body></html>");
const iframe = document.body.querySelector("iframe");
iframe.srcdoc = `<html><span style="color: red">Test</span></html>`;
assert(
document.body.innerHTML,
`<iframe srcdoc="<html><span style="color: red">Test</span></html>"></iframe>`
);
}
{
const { document } = parseHTML("<html><body><iframe></iframe></body></html>");
const iframe = document.body.querySelector("iframe");
iframe.allow = "geolocation";
iframe.name = "iframe-name";
iframe.referrerPolicy = "no-referrer";
iframe.loading = "lazy";
assert(
document.body.innerHTML,
`<iframe loading="lazy" referrerpolicy="no-referrer" name="iframe-name" allow="geolocation"></iframe>`
);
}
{
const { document } = parseHTML(
"<html><body><iframe allowfullscreen></iframe></body></html>"
);
const iframe = document.body.querySelector("iframe");
assert(iframe.allowFullscreen, true);
iframe.allowFullscreen = false;
assert(
document.body.innerHTML,
`<iframe></iframe>`
);
}
{
const { document } = parseHTML(
`<html><body><iframe loading="lazy" referrerpolicy="no-referrer" name="iframe-name" allow="geolocation"></iframe></body></html>`
);
const iframe = document.body.querySelector("iframe");
assert(iframe.allowFullscreen, false);
assert(iframe.loading, 'lazy');
assert(iframe.referrerPolicy, "no-referrer");
assert(iframe.name, "iframe-name");
assert(iframe.allow, "geolocation");
}