Skip to content

Commit

Permalink
Merge branch 'main' into test-out-comment-markers
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Aug 30, 2024
2 parents b58d831 + 1a6bd4d commit 8a931f5
Show file tree
Hide file tree
Showing 16 changed files with 170 additions and 144 deletions.
3 changes: 0 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
test/fixtures
test/ts/
*.ts
dist
benchmarks
34 changes: 18 additions & 16 deletions compat/src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const CAMEL_PROPS =
/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;
const ON_ANI = /^on(Ani|Tra|Tou|BeforeInp|Compo)/;
const CAMEL_REPLACE = /[A-Z0-9]/g;

const IS_DOM = typeof document !== 'undefined';

// Input types for which onchange should not be converted to oninput.
Expand Down Expand Up @@ -135,6 +134,7 @@ function handleDomVNode(vnode) {
type = vnode.type,
normalizedProps = {};

let isNonDashedType = type.indexOf('-') === -1;
for (let i in props) {
let value = props[i];

Expand Down Expand Up @@ -164,21 +164,23 @@ function handleDomVNode(vnode) {
value = '';
} else if (lowerCased === 'translate' && value === 'no') {
value = false;
} else if (lowerCased === 'ondoubleclick') {
i = 'ondblclick';
} else if (
lowerCased === 'onchange' &&
(type === 'input' || type === 'textarea') &&
!onChangeInputType(props.type)
) {
lowerCased = i = 'oninput';
} else if (lowerCased === 'onfocus') {
i = 'onfocusin';
} else if (lowerCased === 'onblur') {
i = 'onfocusout';
} else if (ON_ANI.test(i)) {
i = lowerCased;
} else if (type.indexOf('-') === -1 && CAMEL_PROPS.test(i)) {
} else if (lowerCased[0] === 'o' && lowerCased[1] === 'n') {
if (lowerCased === 'ondoubleclick') {
i = 'ondblclick';
} else if (
lowerCased === 'onchange' &&
(type === 'input' || type === 'textarea') &&
!onChangeInputType(props.type)
) {
lowerCased = i = 'oninput';
} else if (lowerCased === 'onfocus') {
i = 'onfocusin';
} else if (lowerCased === 'onblur') {
i = 'onfocusout';
} else if (ON_ANI.test(i)) {
i = lowerCased;
}
} else if (isNonDashedType && CAMEL_PROPS.test(i)) {
i = i.replace(CAMEL_REPLACE, '-$&').toLowerCase();
} else if (value === null) {
value = undefined;
Expand Down
1 change: 0 additions & 1 deletion compat/test/browser/memo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import React, {
memo,
useState
} from 'preact/compat';
import { li, ol } from '../../../test/_util/dom';

const h = React.createElement;

Expand Down
4 changes: 2 additions & 2 deletions compat/test/ts/suspense.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const componentPromise = new Promise<{ default: typeof IsLazyFunctional }>(
const IsLazyFunc = React.lazy(() => componentPromise);

// Suspense using lazy component
class SuspensefulFunc extends React.Component {
class ReactSuspensefulFunc extends React.Component {
render() {
return (
<React.Suspense fallback={<FallBack />}>
Expand All @@ -38,7 +38,7 @@ class SuspensefulFunc extends React.Component {
}

//SuspenseList using lazy components
function SuspenseListTester(props: any) {
function ReactSuspenseListTester(_props: any) {
return (
<React.SuspenseList revealOrder="together">
<React.Suspense fallback={<FallBack />}>
Expand Down
4 changes: 2 additions & 2 deletions debug/src/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ function getDomChildren(vnode) {
function getClosestDomNodeParentName(parent) {
if (!parent) return '';
if (typeof parent.type == 'function') {
if (parent._parent === null) {
if (parent._dom !== null && parent._dom.parentNode !== null) {
if (parent._parent == null) {
if (parent._dom != null && parent._dom.parentNode != null) {
return parent._dom.parentNode.localName;
}
return '';
Expand Down
2 changes: 1 addition & 1 deletion devtools/src/devtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function initDevTools() {
globalVar !== undefined &&
globalVar.__PREACT_DEVTOOLS__
) {
globalVar.__PREACT_DEVTOOLS__.attachPreact('10.22.1', options, {
globalVar.__PREACT_DEVTOOLS__.attachPreact('10.23.2', options, {
Fragment,
Component
});
Expand Down
3 changes: 2 additions & 1 deletion oxlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
2,
{
"args": "none",
"varsIgnorePattern": "^h|React$"
"caughtErrors": "none",
"varsIgnorePattern": "^h|React|createElement|Fragment$"
}
],
"typescript/no-namespace": 0,
Expand Down
76 changes: 38 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "preact",
"amdName": "preact",
"version": "10.22.1",
"version": "10.23.2",
"private": false,
"description": "Fast 3kb React-compatible Virtual DOM library.",
"main": "dist/preact.js",
Expand Down Expand Up @@ -135,7 +135,7 @@
"benchmark": "npm run test:karma:bench -- no-single-run",
"lint": "run-s oxlint tsc",
"tsc": "tsc -p jsconfig-lint.json",
"oxlint": "oxlint src test debug compat hooks test-utils -c oxlint.json",
"oxlint": "oxlint -c oxlint.json src test/browser test/node test/shared debug compat hooks test-utils",
"format": "biome format --write .",
"format:check": "biome format ."
},
Expand Down Expand Up @@ -240,7 +240,7 @@
"mocha": "^9.0.0",
"npm-merge-driver-install": "^3.0.0",
"npm-run-all": "^4.1.5",
"oxlint": "^0.5.2",
"oxlint": "^0.7.0",
"preact-render-to-string": "^6.5.0",
"prop-types": "^15.8.1",
"sade": "^1.8.1",
Expand Down
Loading

0 comments on commit 8a931f5

Please sign in to comment.