Skip to main content

Questions tagged [dom]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
25 votes
3 answers
2k views

force:navigateToComponent not loading component in Summer '17 | DOM repetition issue in Summer '17

I'm using force:navigateToComponent to navigate to a different component on click. On the first click, it navigates to the component and everything is successfully loaded. When pressing back button ...
SE_User's user avatar
  • 2,283
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
8 votes
2 answers
6k views

How to add a <meta>-Tag for an Lightning app

Is possible to add a <meta> tag for my Lightning application? Within the Salesforce1 mobile application my iPhone turns a custom-formatted date visualization into a hyperlink to create a native ...
Christian Menzinger's user avatar
7 votes
2 answers
1k views

DOM manipulation using External libraries in lightning component

As per the LC documentation and answers to the below questions: 1.Jquery selector is not working properly in subsequent loads in lightning component. 2.DOM modification feasibility in lightning. It'...
Praveen's user avatar
  • 10.1k
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
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
6 votes
2 answers
2k views

AfterRender on button in Lightning Component (DOM update)

I am trying to do something that sounds easy in JavaScript but that I have difficulty to do with Lightning component. The functionality is to highlight the currently pressed button as explained in ...
Dimitri B's user avatar
6 votes
1 answer
411 views

event propagation breaks with API v40 - FundExplorer Demo app

Szenario We want to refactor a dynamic created list by using only one click event listener on the surrounding <ul>-tag rather having one on each <li>-tag as recommended by Christophe ...
Christian Menzinger's user avatar
5 votes
2 answers
7k views

DOM manipulation on lightning:datatable

I want to add attributes or classes for rows/cells in lightning:datatable based on cell values (I want to customize styles based on values). Is it possible? How can this be achieved? P.S. I tried to ...
user39399's user avatar
  • 1,034
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
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
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
4 votes
1 answer
750 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
4 votes
1 answer
11k views

How to modify innerHTML/DOM of an HTML element in a lightning component?

I am trying to dynamically create a picklist in a lightning component which aligns with the lightning design system look and feel. The lightning design system says that we should create it as given in ...
Ayan Sengupta's user avatar
4 votes
2 answers
905 views

How to copy one XML Dom onto another?

I have a need to merge one XML document into another. I'm hoping for a more direct way than the one I've come up with. Given two documents where I want to put B inside A, I can convert B to a string,...
tggagne's user avatar
  • 466
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
4 votes
0 answers
839 views

How to Address DOM-based XSS from Security Review

I have a remoting function on my page that takes a list of contacts, and displays them in on Lightning Design styled page. It works fine, but the final innerHTML statement gets flagged in security ...
BritishBoyinDC's user avatar
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
3 votes
1 answer
2k views

getBoundingClientRect() does not work in lightning component?

Every example I am seeing about positioning a tooltip manually involves getting client boundaries, which you would get through getBoundingClientRect() on the element. I have a lightning component ...
Tyler Dahle's user avatar
  • 2,719
3 votes
1 answer
3k 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
3 votes
1 answer
3k views

Export a CSV using lightning Component without DOM modification

Lightning Controller getData : function(component, file, fileContents) { var action = component.get("c.data"); action.setCallback(this, function(response) { var state = ...
Saravanan Baskar's user avatar
3 votes
2 answers
2k views

Map one xml to List of SObject?

I am quite new in Xml parsing. i am having a XMl <company> <account> <id>8c98a6be</id> <label>4356</label> <reference>4356</reference> </...
Kuldeep Parihar's user avatar
3 votes
2 answers
489 views

How to remove prefix of apex:form from elements?

I amworking on a Visualforce Project where I need to access elements from a form via jQuery. The problem is that the elements always get a prefix like j_id0:j_id4: in the ID. Therefore I can't access ...
Timo Patolla's user avatar
3 votes
0 answers
2k views

What is all that <!--render facet: 5:0--> thing in Lightning Pages about?

I know it's a "who cares" question, but somehow I care and I wanted to have this documented somewhere in the WWW :) In Lightning Pages the whole DOM is full of <!--render facet: 5:0--> ...
itsmebasti's user avatar
  • 6,467
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
2 votes
1 answer
187 views

What is the benefit in using the $Component selector?

Reading through a topic - Best Practices for Accessing Component IDs, I learned that: Use the $Component global variable to simplify referencing the DOM ID that is generated for a Visualforce ...
Arnold's user avatar
  • 439
2 votes
1 answer
726 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
2 answers
2k views

How to get all buttons in my page from a controller javascript function(component, event, helper)?

I know how to enable the clicked button. Lets say I want to enable all buttons on the click of a button. The button is in a Lightning component as: <aura:component implements="flexipage:...
Hugues Lavoie's user avatar
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
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
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
2 votes
1 answer
418 views

Parse XML fails with null object dereference

I have below code that fails to execute in developer console, I receive the following error: Attempt to de-reference a null object. Can someone please help here? Apex class: public class ...
Testing_SFDC's user avatar
  • 2,950
2 votes
2 answers
337 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
2 votes
1 answer
1k views

getBodyDocument returns null

I'm trying to write tests using httpCalloutMock in a fashion similar to global class MyHttpMock implements HttpCalloutMock { global HTTPResponse respond(HTTPRequest httpRequest){ ...
user2610036's user avatar
  • 1,039
2 votes
1 answer
1k views

VF Page on-click events for HTML elements

I have a checkbox on my VF page, with the label in a <TD> element of the table, and the checkbox in a <TD> element next to it like this: <tr> <td class="LeftColumnTop W50" ...
Our Man in Bananas's user avatar
2 votes
1 answer
2k views

How to form SOAP XML request to update Salesforce dara

Is anyone has some idea how can i use DOM or XmlStreamWriter to generate SOAP XML request for Salesforce? Can we use these classes to generate SOAP XML request or not? I tried following code but ...
Pramod Kumar's user avatar
  • 5,300
2 votes
1 answer
6k views

Error converting HttpResponse to Dom.Document

I am calling the Tooling API from Apex in order to find out if a Custom Field has been created. Here is my code: HttpRequest req = new HttpRequest(); req.setHeader('Authorization', '...
George S.'s user avatar
  • 2,740
2 votes
1 answer
449 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
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
2 votes
1 answer
382 views

How to prevent DOM XSS Vulnerability for this script -

{!tableData} is Server variable. <script> $('.content').html("{!tableData}"); ... </script> "{!tableData}" is having HTML data.
Kavita Beniwal's user avatar
2 votes
1 answer
266 views

How do i empty the value in lightning without violating DOM Modification

Component <input onchange="{! c.readCSV}" accept=".csv" type="file" id="file-upload" aura:id="file-upload"/> Controller readCSV : function(component, event, helper){ var file = component....
Saravanan Baskar's user avatar
2 votes
1 answer
769 views

Visualforce 'onChange' DOM event not firing when dependent picklist changes to default value

I have a VF page where several field's required attribute is dynamically tied to the value selected on a picklist: <apex:outputPanel id="idAccountField"> <apex:inputfield value="{!...
smohyee's user avatar
  • 3,846
1 vote
1 answer
930 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
1 vote
1 answer
4k views

Onclick handler doesn't fire in dynamically-added dom element

The interface for my Lightning component is a very dynamic table that must be built according to data that is retrieved from a remote source. To create this table, inside of my helper class, I'm using ...
Cory Newey's user avatar
1 vote
1 answer
5k views

What is the use DOM in Salesforce where we can use that?

I have understood the abbrevation of DOM,but i am not understanding what is use of that in salesforce. Is there any link between xml and DOM.
mahesh's user avatar
  • 171
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
1 vote
2 answers
4k views

Retrieve elements created with Aura:Iteration

I'm trying to retrieve elements using document.getElementsByClassName("") within the afterRender function. This works as expected with normal elements. However, I can't seem to retrieve elements being ...
Aubrey Walts's user avatar
1 vote
1 answer
46 views

JavaScript reading visualforce binded variables

I need some help understand how JavaScript and Visualforce interact. I have a eventListener that works perfectly when the DOM is loaded: window.addEventListener('DOMContentLoaded', function() { if (...
Olivia's user avatar
  • 3,471
1 vote
1 answer
119 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
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