Skip to content

Commit

Permalink
Don't call Object.prototype methods directly on objects
Browse files Browse the repository at this point in the history
  • Loading branch information
lederer committed Sep 26, 2024
1 parent 8d0d4e6 commit d7e4627
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Showtime.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default function Showtime({

// Attach existing refs on child, if any
const { ref } = child;
if (ref?.hasOwnProperty("current")) {
if (ref && Object.prototype.hasOwnProperty.call(ref, "current")) {
ref.current = node;
} else if (typeof ref === "function") {
ref(node);
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function addInlineStyles(element, styles) {
export function getInlineStyles(element) {
const styles = {};
for (const prop in element.style) {
if (element.style.hasOwnProperty(prop) && element.style[prop]) {
if (Object.prototype.hasOwnProperty.call(element.style, prop) && element.style[prop]) {
styles[prop] = element.style[prop];
}
}
Expand Down

0 comments on commit d7e4627

Please sign in to comment.