Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 2 additions & 1 deletion src/renderers/dom/shared/DOMProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ var DOMProperty = {
}
if (
(name[0] === 'o' || name[0] === 'O') &&
(name[1] === 'n' || name[1] === 'N')
(name[1] === 'n' || name[1] === 'N') &&
name.toLowerCase() !== 'on'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just check name.length instead?

) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,11 @@ describe('ReactDOMServerIntegration', () => {
);
expect(e.getAttribute('onunknownevent')).toBe(null);
});

itRenders('custom attribute named `on`', async render => {
const e = await render(<div on="tap:do-something" />);
expect(e.getAttribute('on')).toEqual('tap:do-something');
});
});

describe('elements and children', function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ if (__DEV__) {
return true;
}

if (lowerCasedName.indexOf('on') === 0) {
if (lowerCasedName.indexOf('on') === 0 && lowerCasedName !== 'on') {
warning(
false,
'Unknown event handler property `%s`. It will be ignored.%s',
Expand Down