question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: can I change reference element at runtime?

See original GitHub issue

Hi. Can I change reference element at runtime?

My usecase is I have an SVG map, rendered with d3. I want to implement tooltips with information about user sees on the map, and show them when user hovers a particular svg path. I figured that I’d rather change reference element from mouse over / mouse out events rather than create a popper.js instance for every path (there are a lot).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

2reactions
atomikscommented, Mar 24, 2020

@cihad please note that scrollParents detection is done on create/update, so if the reference is is inside a different scrolling container that will cause problems. I recommend destroying the previous instance and creating a new one instead in that case. For performance optimization then dynamically setting it as you’re doing it is fine.

2reactions
cihadcommented, Mar 19, 2020

Yes it is possible:

popperInstance.state.elements.reference = newReferenceDom
popperInstance.update()

https://codepen.io/cihad/pen/yLNpveX

Is it possible on version 2? I want to change popper instance’s reference element.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Question: can I change reference element at runtime? #538
Set reference to the new element, then call Popper#update ? 2
Read more >
aurelia - Change element type at runtime - Stack Overflow
I've asked this question on the Aurelia Gitter where Erik Lieben suggested to use a @processContent(function) decorator, replace the content ...
Read more >
Getting a direct reference or pointer to a visual element in ...
Hi, Right now I am using "rootvisualelement.Query("nameOfElementIWant")" to get a reference to a visual element in runtime code.
Read more >
Linked List vs Array - GeeksforGeeks
Both Arrays and Linked List can be used to store linear data of similar types, but they both have some advantages and disadvantages....
Read more >
Manipulating documents - Learn web development | MDN
Now we have the element reference stored in a variable, we can start to manipulate it using properties and methods available to it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found