Skip to content

Commit

Permalink
Merge branch 'master' into fix-effect-ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock authored Jan 26, 2022
2 parents 77d6ae4 + 98fb678 commit cf0d401
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 2 additions & 3 deletions compat/src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ options.vnode = vnode => {
if (IS_DOM && i === 'children' && type === 'noscript') {
// Emulate React's behavior of not rendering the contents of noscript tags on the client.
continue;
}
else if (i === 'value' && 'defaultValue' in props && value == null) {
} else if (i === 'value' && 'defaultValue' in props && value == null) {
// Skip applying value if it is null/undefined and we already set
// a default value
continue;
Expand Down Expand Up @@ -154,7 +153,7 @@ options.vnode = vnode => {
i = 'onfocusin';
} else if (/^onblur$/i.test(i)) {
i = 'onfocusout';
} else if (/^on(Ani|Tra|Tou|BeforeInp)/.test(i)) {
} else if (/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(i)) {
i = i.toLowerCase();
} else if (nonCustomElement && CAMEL_PROPS.test(i)) {
i = i.replace(/[A-Z0-9]/, '-$&').toLowerCase();
Expand Down
7 changes: 7 additions & 0 deletions compat/test/browser/events.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,4 +275,11 @@ describe('preact/compat events', () => {
scratch.firstChild.dispatchEvent(createEvent('beforeinput'));
expect(spy).to.be.calledOnce;
});

it('should normalize compositionstart event listener', () => {
let spy = sinon.spy();
render(<input onCompositionStart={spy} />, scratch);
scratch.firstChild.dispatchEvent(createEvent('compositionstart'));
expect(spy).to.be.calledOnce;
});
});
2 changes: 1 addition & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export function cloneElement<P>(
// -----------------------------------

// TODO: Revisit what the public type of this is...
export const Fragment: ComponentClass<{}, {}>;
export const Fragment: FunctionComponent<{}>;

//
// Preact options
Expand Down

0 comments on commit cf0d401

Please sign in to comment.