Skip to content

Commit

Permalink
refactor: revert the change from Object.hasOwn(obj, prop) with `Obj…
Browse files Browse the repository at this point in the history
…ect.prototype.hasOwnProperty.call(obj, prop)` to resolve compatibility issue in certain environments (#776)

refactor: replace `Object.hasOwn(obj, prop)` with `Object.prototype.hasOwnProperty.call(obj, prop)` to resolve compatibility issue in certain environments
  • Loading branch information
cheton authored Jun 24, 2023
1 parent 0fc733c commit 0926f36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/react/src/box/Box.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const shouldForwardProp = (() => {

const transformCSSPseudoSelectors = (props) => {
const entries = Object.entries(ensurePlainObject(props))
.filter(([name, value]) => Object.hasOwn(pseudoClassSelector, name) || Object.hasOwn(pseudoElementSelector, name));
.filter(([name, value]) => {
return Object.prototype.hasOwnProperty.call(pseudoClassSelector, name) || Object.prototype.hasOwnProperty.call(pseudoElementSelector, name);
});

return sx(Object.fromEntries(entries));
};
Expand Down
2 changes: 1 addition & 1 deletion packages/styled-system/src/sx.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const sx = (valueOrFn) => (props = {}) => {

let result = {};
for (const key in resolvedStyleProps) {
if (!Object.hasOwn(resolvedStyleProps, key)) {
if (!Object.prototype.hasOwnProperty.call(resolvedStyleProps, key)) {
continue;
}

Expand Down

0 comments on commit 0926f36

Please sign in to comment.