---
schema_version: "1"
id: ea92ca0860a18c0b57a19e981389c25840ae544f33a24192bbd2883e1ff6eb3d
title: Avoid Custom Properties on Standard JavaScript Objects
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/lwc/lightning-components-security/guides/lws/lws-standard-objects.md
canonical_url: https://developer.salesforce.com/docs/platform/lightning-components-security/guide/lws-standard-objects.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 6c2f4e204819660fd8b8d9cb94f5f2a7b276ff4840373c5ed8ad6dab0ceaaff4
products:
  - Security for Lightning Components
  - lwc
---
# Avoid Custom Properties on Standard JavaScript Objects

Adding custom properties directly to a [standard built-in JavaScript object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects) can cause issues when the object is serialized. When an object is passed across namespaces or into the global scope, Lightning Web Security (LWS) doesn’t reflect this kind of mutation for security reasons.

If you must add custom data to a DOM element, use the [dataset](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset) property of DOM elements instead of adding custom properties to the element object.

**See Also**

- [Avoid Mutating Objects](https://developer.salesforce.com/docs/platform/lightning-components-security/guide/lws-mutation-alternatives.md)
