Skip to content

Commit 644ccd8

Browse files
authored
Add some missing iframe attributes (#7813)
* Add some missing iframe attributes * Changelog + snapshot
1 parent ce7f09c commit 644ccd8

File tree

5 files changed

+30
-1
lines changed

5 files changed

+30
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
- Hint about partial application when missing required argument in function call. https://github.com/rescript-lang/rescript/pull/7807
3939
- More autocomplete improvements involving modules and module types. https://github.com/rescript-lang/rescript/pull/7795
4040
- Autocomplete `@react.componentWithProps` attribute. https://github.com/rescript-lang/rescript/pull/7812
41+
- Add some missing iframe attributes to `domProps`. https://github.com/rescript-lang/rescript/pull/7813
4142

4243
#### :house: Internal
4344

packages/@rescript/runtime/JsxDOM.res

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ type domProps = {
4040
key?: string,
4141
children?: Jsx.element,
4242
ref?: domRef,
43+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe#allow
44+
allow?: string,
4345
/* accessibility */
4446
/* https://www.w3.org/TR/wai-aria-1.1/ */
4547
/* https://accessibilityresources.org/<aria-tag> is a great resource for these */
@@ -203,6 +205,8 @@ type domProps = {
203205
formAction?: string /* uri */,
204206
formTarget?: string /* "_blank", "_self", etc. */,
205207
formMethod?: string /* "post", "get", "put" */,
208+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe#frameborder
209+
frameBorder?: int /* "0", "1" */,
206210
headers?: string,
207211
height?: string /* in html5 this can only be a number, but in html4 it can ba a percentage as well */,
208212
high?: int,
@@ -517,6 +521,8 @@ type domProps = {
517521
primitiveUnits?: string,
518522
r?: string,
519523
radius?: string,
524+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe#referrerpolicy
525+
referrerPolicy?: string,
520526
refX?: string,
521527
refY?: string,
522528
renderingIntent?: string,

tests/analysis_tests/tests/src/expected/Completion.res.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

tests/tests/src/jsx_preserve_test.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@ let _fragment = <Fragment>
214214
{"Hello, world!"}
215215
</Fragment>;
216216

217+
let _youtube_iframe = <iframe
218+
allow={"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"}
219+
allowFullScreen={true}
220+
frameBorder={0}
221+
height={"1075"}
222+
src={"https://www.youtube.com/embed/dQw4w9WgXcQ"}
223+
width={"1911"}
224+
referrerPolicy={"strict-origin-when-cross-origin"}
225+
/>;
226+
217227
export {
218228
Icon,
219229
_single_element_child,
@@ -242,5 +252,6 @@ export {
242252
_props_with_hyphen,
243253
React,
244254
_fragment,
255+
_youtube_iframe,
245256
}
246257
/* _single_element_child Not a pure module */

tests/tests/src/jsx_preserve_test.res

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,14 @@ module React = {
141141
}
142142

143143
let _fragment = <> {Jsx.string("Hello, world!")} </>
144+
145+
let _youtube_iframe =
146+
<iframe
147+
width="1911"
148+
height="1075"
149+
src="https://www.youtube.com/embed/dQw4w9WgXcQ"
150+
frameBorder={0}
151+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
152+
referrerPolicy="strict-origin-when-cross-origin"
153+
allowFullScreen={true}>
154+
</iframe>

0 commit comments

Comments
 (0)