diff --git a/.changeset/khaki-brooms-sort.md b/.changeset/khaki-brooms-sort.md new file mode 100644 index 000000000..a55ed574f --- /dev/null +++ b/.changeset/khaki-brooms-sort.md @@ -0,0 +1,5 @@ +--- +'@emotion/react': patch +--- + +Remove hasOwnProperty from utils diff --git a/packages/react/src/emotion-element.js b/packages/react/src/emotion-element.js index d1f0deecb..0ae4c4b64 100644 --- a/packages/react/src/emotion-element.js +++ b/packages/react/src/emotion-element.js @@ -7,7 +7,7 @@ import { insertStyles, registerStyles } from '@emotion/utils' -import { hasOwnProperty, isBrowser } from './utils' +import { hasOwn, isBrowser } from './utils' import { serializeStyles } from '@emotion/serialize' import { getLabelFromStackTrace } from './get-label-from-stack-trace' import { useInsertionEffectAlwaysWithSyncFallback } from '@emotion/use-insertion-effect-with-fallbacks' @@ -31,7 +31,7 @@ export const createEmotionProps = (type: React.ElementType, props: Object) => { let newProps: any = {} for (let key in props) { - if (hasOwnProperty.call(props, key)) { + if (hasOwn.call(props, key)) { newProps[key] = props[key] } } @@ -133,7 +133,7 @@ let Emotion = /* #__PURE__ */ withEmotionCache( const newProps = {} for (let key in props) { if ( - hasOwnProperty.call(props, key) && + hasOwn.call(props, key) && key !== 'css' && key !== typePropName && (process.env.NODE_ENV === 'production' || key !== labelPropName) diff --git a/packages/react/src/jsx-dev-runtime.js b/packages/react/src/jsx-dev-runtime.js index 7bf748800..9b402438a 100644 --- a/packages/react/src/jsx-dev-runtime.js +++ b/packages/react/src/jsx-dev-runtime.js @@ -1,7 +1,7 @@ // @flow import * as ReactJSXRuntimeDev from 'react/jsx-dev-runtime' import Emotion, { createEmotionProps } from './emotion-element' -import { hasOwnProperty } from './utils' +import { hasOwn } from './utils' export const Fragment = ReactJSXRuntimeDev.Fragment @@ -13,7 +13,7 @@ export function jsxDEV( source: any, self: any ) { - if (!hasOwnProperty.call(props, 'css')) { + if (!hasOwn.call(props, 'css')) { return ReactJSXRuntimeDev.jsxDEV( type, props, diff --git a/packages/react/src/jsx-runtime.js b/packages/react/src/jsx-runtime.js index f4098ea42..d212d4b0f 100644 --- a/packages/react/src/jsx-runtime.js +++ b/packages/react/src/jsx-runtime.js @@ -1,12 +1,12 @@ // @flow import * as ReactJSXRuntime from 'react/jsx-runtime' import Emotion, { createEmotionProps } from './emotion-element' -import { hasOwnProperty } from './utils' +import { hasOwn } from './utils' export const Fragment = ReactJSXRuntime.Fragment export function jsx(type: any, props: any, key: any) { - if (!hasOwnProperty.call(props, 'css')) { + if (!hasOwn.call(props, 'css')) { return ReactJSXRuntime.jsx(type, props, key) } @@ -14,7 +14,7 @@ export function jsx(type: any, props: any, key: any) { } export function jsxs(type: any, props: any, key: any) { - if (!hasOwnProperty.call(props, 'css')) { + if (!hasOwn.call(props, 'css')) { return ReactJSXRuntime.jsxs(type, props, key) } diff --git a/packages/react/src/jsx.js b/packages/react/src/jsx.js index d1cabf9e6..7e27f84c4 100644 --- a/packages/react/src/jsx.js +++ b/packages/react/src/jsx.js @@ -1,7 +1,7 @@ // @flow import * as React from 'react' import Emotion, { createEmotionProps } from './emotion-element' -import { hasOwnProperty } from './utils' +import { hasOwn } from './utils' // $FlowFixMe export const jsx: typeof React.createElement = function ( @@ -10,7 +10,7 @@ export const jsx: typeof React.createElement = function ( ) { let args = arguments - if (props == null || !hasOwnProperty.call(props, 'css')) { + if (props == null || !hasOwn.call(props, 'css')) { // $FlowFixMe return React.createElement.apply(undefined, args) } diff --git a/packages/react/src/utils.js b/packages/react/src/utils.js index 8f03da492..305c0a1f6 100644 --- a/packages/react/src/utils.js +++ b/packages/react/src/utils.js @@ -1,4 +1,4 @@ // @flow export let isBrowser = typeof document !== 'undefined' -export const hasOwnProperty = {}.hasOwnProperty +export const hasOwn = {}.hasOwnProperty