Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@ function setProp(
case 'async':
case 'autoPlay':
case 'controls':
case 'credentialless':
case 'default':
case 'defer':
case 'disabled':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,7 @@ function pushAttribute(
case 'async':
case 'autoPlay':
case 'controls':
case 'credentialless':
case 'default':
case 'defer':
case 'disabled':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ function validateProperty(tagName, name, value, eventRegistry) {
case 'async':
case 'autoPlay':
case 'controls':
case 'credentialless':
case 'default':
case 'defer':
case 'disabled':
Expand Down Expand Up @@ -287,6 +288,7 @@ function validateProperty(tagName, name, value, eventRegistry) {
case 'async':
case 'autoPlay':
case 'controls':
case 'credentialless':
case 'default':
case 'defer':
case 'disabled':
Expand Down
28 changes: 28 additions & 0 deletions packages/react-dom/src/__tests__/DOMPropertyOperations-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,34 @@ describe('DOMPropertyOperations', () => {
expect(container.firstChild.hasAttribute('allowFullScreen')).toBe(false);
});

it('should set credentialless boolean attribute on iframes', async () => {
const container = document.createElement('div');
const root = ReactDOMClient.createRoot(container);
await act(() => {
root.render(<iframe credentialless={true} />);
});
expect(container.firstChild.getAttribute('credentialless')).toBe('');
await act(() => {
root.render(<iframe credentialless={false} />);
});
expect(container.firstChild.hasAttribute('credentialless')).toBe(false);
});

it('should set credentialless attribute when passed a string and warn', async () => {
const container = document.createElement('div');
const root = ReactDOMClient.createRoot(container);
await act(() => {
root.render(<iframe credentialless="true" />);
});
assertConsoleErrorDev([
'Received the string `true` for the boolean attribute `credentialless`. ' +
'Although this works, it will not work as expected if you pass the string "false". ' +
'Did you mean credentialless={true}?\n' +
' in iframe (at **)',
]);
expect(container.firstChild.getAttribute('credentialless')).toBe('');
});

it('should remove when setting custom attr to null', async () => {
const container = document.createElement('div');
const root = ReactDOMClient.createRoot(container);
Expand Down
Loading