Skip to main content

Questions tagged [dom]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
61 views

Sanitize input in Aura component

Checkermax report has identified Client DOM XSS issue for the input parameter whose value is in the format of !caselst.casenumber Here caselst is the variable for the list of cases. List of cases are ...
Pratikshya Satapathy's user avatar
0 votes
1 answer
59 views

Detect cursor in current tab outside of LWC

Hi Im trying to know if a user is idle in a record page tab, and to do it I have placed a LWC in the record page so it could maybe read the outsider events. I have tried using window.addEventListener('...
RProgrammer's user avatar
0 votes
0 answers
47 views

How do I traverse LWC DOM and find the email and phone links

I am trying to see how I am able to find email and phone links within the LWC DOM. I am well aware that it is shadow DOM so I did try to detect the shadow root inside my BFS implementation Here is the ...
Liu Hantao's user avatar
0 votes
1 answer
72 views

Is there a way to change the tel: and mailTo: links at the Contacts page using aura lightning component

I am trying to change the tel: and mailTo: links from the Salesforce contact page to some other behavior with onClick using aura lightning component. The expected behavior might be click on the phone ...
Liu Hantao's user avatar
2 votes
1 answer
459 views

LWC - Using lwc:dom="manual" to render text with innerHTML but it does not work

I'm using lwc:dom="manual" and querySelector to capture and display the text content but it does not work. HTML code <h2 class="slds-truncate" title={record.Name}> <a ...
Pam's user avatar
  • 107
1 vote
1 answer
120 views

JS in Salesforce DOM security review failure

I have just been sent back the security review report for our ISV partner app and one of the errors is 'JS in Salesforce DOM'. The file they have referenced is a .weblink file, the code snippet they'...
lhh13's user avatar
  • 41
0 votes
1 answer
97 views

Parse XML fails with NullPointerException when attribute is xlmns only

I got a sample XML like this: <?xml version="1.0" encoding="UTF-8"?> <RootNode> <Sample1 xmlns:key1="yyy"> <Sample11>ABC</Sample11&...
Poypoyan's user avatar
  • 151
1 vote
2 answers
77 views

Salesforce lightning Fight with DOM and document.write()

I am trying to duplicate the action created by the following code in the controller of a lightning component (aura). this is currently the code i have in place. let party = 'something'; ...
JM Luttrell's user avatar
3 votes
1 answer
4k views

Lightning Datatable CellAttributes Dynamic Styling is not applied on change of Data Rows

We have created an LWC which uses the LWC Component 'Lightning Datatable' component to display a table with dynamic columns & rows. We would like to apply dynamic styling of the rows based on its ...
Wesley Van Wijnsberghe's user avatar
0 votes
0 answers
39 views

LWC.CreateElement? [duplicate]

I was researching for document.createElement() and could not seem to find anything. Is there any way where I can use createElement in salesforce or any other Alternative as I need to create div ...
Seiger's user avatar
  • 1
0 votes
0 answers
679 views

select lightning input checkbox by name in aura

I want to select the lightning input checbox by name from my Aura component controller. How can I do that? <lightning:input type="checkbox" label="{!parentBenefit.Name}" name=&...
Akash's user avatar
  • 361
1 vote
0 answers
386 views

How to remove element in a closed lightning-accordion from a QuerySelectorAll

I have multiple lightning-accordion-section each containing a small form I would like to do a querySelector on all my lightning-inputs to make sure that the user filled them properly. If the user ...
Sacha Dieryck's user avatar
0 votes
1 answer
1k views

Access dom element from <head> in experience builder

I am trying to access a dom element from the in lightning experience by adding the script <script type="text/javascript"> document.addEventListener('DOMContentLoaded', ()=> { ...
mSinisa's user avatar
  • 51
0 votes
0 answers
97 views

aura render event: DOM update issue

This question relates to this post, where we got rid of the unescapedHtml tag to rather use render event for dynamic DOM manipulation. My new issue is the following: I'm listening to the aura "...
M.C's user avatar
  • 63
4 votes
1 answer
754 views

Can you know if a component's event is handled?

Component Billy can dispatch an event: this.dispatchEvent(new CustomEvent('stuffHappened')); Can Billy know if its parent provided a handler for that event? Can it know if it was called like this: &...
Bloke's user avatar
  • 217
1 vote
1 answer
2k views

How to Dynamically Change Text Based on User Input

I am fairly new to SF, and I am only moderately well-versed in JS in general. I am attempting to create a LWC that will display a URL based on user input. This URL will eventually be used to retrieve ...
William Mallady's user avatar
0 votes
2 answers
219 views

Salesforce Dom dynamic behaviour

Last week the structure is with li elements and now the HTML structure is changed. This is for Salesforce Contacts object.Please see the image. <div id="suggestionsList"> <ul&...
stdk's user avatar
  • 3
0 votes
1 answer
805 views

Unable to get all elements in List<Dom.XmlNode> [closed]

I'm trying to iterate through a List<Dom.XmlNode) in order to get all elements, but I am only able to get the first two (header - body) Here's my code: String xml='<soapenv:Envelope xmlns:...
robruf's user avatar
  • 372
1 vote
0 answers
326 views

Get DOM elements to hide an element from afterRender event in Lightning component

I am trying to access Page related DOM elements which are not part of aura component. I am trying to access elements with the help of afterRender. I am able to get the element but i can see only proxy ...
Salesforce developer's user avatar
6 votes
1 answer
2k views

LWCs cause 10-20 seconds of lag populating a small amount of elements on the page

I have an LWC template like this: <input list="counties"> <datalist id="counties"> <template for:each={counties} for:item="county"> <option key=...
Andy Ray's user avatar
  • 1,468
0 votes
1 answer
5k views

How to get the selected value of a picklist field in lightning combo box using template.getQuerySelector?

How to get the selected value of a picklist field in lightning combo box using template.getQuerySelector?. <lightning-combobox label={firstControllingFieldLabel} name=&...
Ajay's user avatar
  • 45
0 votes
1 answer
481 views

How to change dropdown and textbox values using javascript

My salesforce page has dropdown and textbox, but require a double click to enter Here is DOM for Ground snow load my thought was to change the value of dropdown by id document.getElementById('...
Thomas Pitera's user avatar
2 votes
1 answer
729 views

Distinguish between the Standard DOM event and the CustomEvent

How to distinguish between the Standard DOM event and the CustomEvent dispatched by LWC Component? Assume we have some 2 simple LWС Components <!--child.html--> <template> <input ...
user70363's user avatar
  • 435
2 votes
1 answer
2k views

Is the DOM oninput event supported in LWC?

This oninput Event documentation explains: The oninput event occurs when an element gets user input. This event occurs when the value of an or element is changed. Tip: This event is similar to the ...
Keith C's user avatar
  • 136k
3 votes
1 answer
588 views

DHTMLX Gantt in LWC

I'm implementing DHTMLX Gantt Chart in LWC. I'm trying to call an LWC method from the gantt library function but it is not working. Here is the code: <template> <input type="hidden&...
d_k's user avatar
  • 1,291
0 votes
1 answer
66 views

Pulling info from the DOM or API as an external script

My org is soon officially moving us all to Lightning from Classic and I've hit a bit of a snag. Myself and some others have utilized small scripts and bookmarklets to help automate certain quick ...
Freesnöw's user avatar
  • 103
0 votes
2 answers
2k views

dataLayer in Lightning component

Can someone tell me how can I access DOM dataLayer in lightning component controller? I'm using like this but its not pushing into DOM dataLayer window.dataLayer = window.dataLayer || []; ...
Rishabh Panwar's user avatar
1 vote
1 answer
256 views

How to store state and conditionally render UI of a VF component in JS

I am enhancing the app setup application to replicate Setup Assistant UI. To build the expandable setup UI. I need to store the state(Expanded/Collapsed) of the component. Normally in Aura/LWC, I ...
Anmol Kumar's user avatar
  • 3,631
4 votes
2 answers
8k views

DisconnectedCallback in LWC

I want to do some DML operation when my lwc is removed from the DOM, so can anyone please confirm if disconnected callback will run on all below scenario on close tab. on browser close. got ...
gs650x's user avatar
  • 2,680
2 votes
1 answer
9k views

How is the <template> tag used in lwc different from one used in web components?

According to usage of <template> in web components: The elements under template won't appear in your page until you grab a reference to it with JavaScript and then append it to the DOM For ...
Isha's user avatar
  • 163
0 votes
2 answers
729 views

Lwc- problem to get id as it changes with random no. inside external Js

Hi all I am trying to access the id of a div in lwc with the help external js(static resource) where code is like document.getElementById("createsulightning"); for <div id="createsulightning">&...
Sunil Chandel's user avatar
2 votes
2 answers
339 views

Can DOM matches logic be applied to an LWC LightingElement?

One problem stopping Mobiscroll calendar working inside a LWC? is described in the PS to that question. An equivalent of element.matches (AKA element.matchesSelector) needs to be implemented for an ...
Keith C's user avatar
  • 136k
0 votes
1 answer
322 views

LWC third party library DOM changes not applied

I'm trying to use Highcharts charting library in LWC. I have an empty div element, <div class="chart-target" lwc:dom="manual"></div> targeted by the chart. This works well. The problem is ...
ipavlic's user avatar
  • 3,736
2 votes
1 answer
14k views

Jest Test - element.shadowRoot.querySelector() not retrieving element when given an id

I am attempting to retrieve and make assertions about certain elements using querySelector() with the respective id of that element. But, querySelector() isn't returning any elements with a given id. ...
DylanR's user avatar
  • 107
1 vote
1 answer
10k views

Dynamically set the onclick function in LWC button

I'm trying to dynamically set the onclick function of lightning web component button but it's not working. I've tried both "click" and "onclick" JS: const navButton = this.template.querySelector('....
626's user avatar
  • 273
0 votes
1 answer
40 views

How to remove dom response from a loop

I have a dom class handler which I am calling from batch class. I am looping through the response to perform dml operations across certain objects. Since I have to use the response across different ...
user64977's user avatar
2 votes
1 answer
512 views

The key attribute, and docs on LWC Virtual DOM

Per the LWC docs we have the following: When a list changes, the framework uses the key to rerender only the item that changed. The key in the template is used for performance optimization and ...
Joe Flowers's user avatar
7 votes
2 answers
4k views

Clarification on what this.template.querySelectorAll lets you see in LWCs: want to modify field labels

I have a form rendered using just a lightning-record-form - very cool to get so much done by this single LWC (Lightning Web Component). But I'm trying to replace the labels with the inline help text ...
Keith C's user avatar
  • 136k
4 votes
1 answer
13k views

div innerHTML with standard lightning web components

I'm trying to display a custom format for my lightning web component via rendered and innerHTML of a div. <template> <div class="container" lwc:dom="manual"></div> </template&...
molinet's user avatar
  • 925
2 votes
1 answer
6k views

LWC: Using lwc:dom="manual" to reach and interact with a certain DOM element

I am trying to find a way to interact with the built-in chat widget. I need to simulate a click on it. I understand that the Locker Service is there to prevent any interaction outside of the DOM of ...
Arthlete's user avatar
  • 4,917
0 votes
1 answer
2k views

Dom Document generation by APEX code

I am writing APEX to generate DOM document. I want to generate <TOTALVOLUME units="m3">1.0</TOTALVOLUME>. Parent node for TOTALVOLUME is consignmentBody and I am trying Below code to ...
Anoop's user avatar
  • 47
1 vote
0 answers
528 views

I'm not able to access DOM element even in "afterRender"

I'm trying to create a canvas in my custom lightning component. This is a child component of another component. The canvas draws few charts, and the methods are called only after both the script(...
Krishnan Mishra's user avatar
4 votes
1 answer
5k views

How can I test the click of a button that calls an Apex method, and makes the component show a toast?

The component itself, when loaded, queries some data from the database. Then, depending on what it finds, loads the specific template. One of those has a button, which will call the server again, and ...
Renato Oliveira's user avatar
0 votes
1 answer
489 views

Lightning data locker restricting Javascript for CSS/HTML

I am trying to retrieve JavaScript Static resource in Community lightning component to override the numbering from Unescaped html. But the data locker service is blocking the script. Am trying to ...
rdredd's user avatar
  • 23
5 votes
0 answers
1k views

Lightning Web Components: Set scroll position on lightning-datatable based on 'key' field value

We are looking to auto-scroll the user to a specific point in a lightning-datatablewhen a button is clicked. Assuming we referenced the key-field attribute data-row-key-value in the dom then in HTML ...
Dan Nicholson's user avatar
1 vote
1 answer
934 views

Document.fullScreen API implementation in Lightning Web Components(LWC)

I was trying to achieve full screen on an element in Lightning Web Components but was unable to use Document.fullscreen API. I tried var elem = this.template.querySelector('svg'); if (elem....
Nishant Sharma's user avatar
8 votes
1 answer
42k views

Using this.template.querySelectorAll() to modify the DOM in Lightning Web Component

Currently, I am stuck in a situation to modify the DOM in LWC using the querySelectorAll function. Here the {team.item.Description__c} field having the DOM details and saved in string form into the ...
Tarique Shamim's user avatar
1 vote
1 answer
1k views

How to build an integration with rest API in apex using XML

Situation I need to build a connection from Salesforce to "post" to a rest api. The recipient has given me XDS schema files of the data to be sent over. My Current Plan Build a sObject to be the ...
Ryan Sherry's user avatar
1 vote
0 answers
165 views

Entire page appearing twice in the DOM in LEX?

So the two snippets in this screenshot are the same page loaded in Lightning. This is the "main div" as I can see it that holds the main contents of the page. I promise it is the same page, a standard ...
Simon Lawrence's user avatar
0 votes
2 answers
3k views

Document.getElementById().value returning Null in Lightning

I am getting null value from Lightning component from document.getElementById().value below is the case. I am showing already existed record as default(pricebookId) in the dropDown from total list. &...
AshSFcloud's user avatar