Skip to content

Commit

Permalink
fix(core): don't extend html elements (#4691)
Browse files Browse the repository at this point in the history
* fix(core): dont extend html elements

Co-authored-by: Vladimir Kharlampidi <[email protected]>
  • Loading branch information
vltansky and nolimits4web authored Jun 21, 2021
1 parent 0d578b0 commit 32ae99b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,15 @@ function isObject(o) {
function extend(...args) {
const to = Object(args[0]);
const noExtend = ['__proto__', 'constructor', 'prototype'];
// eslint-disable-next-line
const HTMLElement = typeof window !== 'undefined' ? window.HTMLElement : undefined;
for (let i = 1; i < args.length; i += 1) {
const nextSource = args[i];
if (nextSource !== undefined && nextSource !== null) {
if (
nextSource !== undefined &&
nextSource !== null &&
!(HTMLElement && nextSource instanceof HTMLElement)
) {
const keysArray = Object.keys(Object(nextSource)).filter((key) => noExtend.indexOf(key) < 0);
for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
const nextKey = keysArray[nextIndex];
Expand Down

0 comments on commit 32ae99b

Please sign in to comment.