# Markdown Javascript mountPath into self instead of root object

**URL:** <https://forum.inductiveautomation.com/t/markdown-javascript-mountpath-into-self-instead-of-root-object/83102>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 13, 2023, 6:03pm UTC](https://forum.inductiveautomation.com/t/markdown-javascript-mountpath-into-self-instead-of-root-object/83102 "2023-12-13T18:03:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ToMakPo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tomakpo/32/23875_2.png) [@ToMakPo](https://forum.inductiveautomation.com/u/ToMakPo)\
**Post date:** [December 13, 2023, 6:03pm UTC](https://forum.inductiveautomation.com/t/markdown-javascript-mountpath-into-self-instead-of-root-object/83102/1 "2023-12-13T18:03:13Z")

</div>

I have a markdown object with a binding script that looks like this:

```auto
return """<div 
        onmousemove="
            view = [...window.__client.page.views._data.values()].find(view => view.value.mountPath == this.parentNode.parentNode.parentNode.parentNode.getAttributeNode('data-component-path').value.split('.')[0]).value;
            rect = this.getBoundingClientRect();
            
            view.params.write('fromTop', event.clientY - rect.top);
            view.params.write('fromBottom', rect.bottom - event.clientY);
            view.params.write('fromLeft', event.clientX - rect.left);
            view.params.write('fromRight', rect.right - event.clientX);
            view.params.write('width', rect.width);
            view.params.write('height', rect.height);
        "
        style="display: block; position: fixed; inset: 0;"> 
    </div>""".replace("\n", " ").replace("\t", "")

```

I found that `view = ...` line on a different project that I scavenge for this. In the designer, on the view itself, this seems to work fine, but when I try to embed the view into another, it writes to that view's `view.params` instead. I don't want that. I want it to only write to the `view.params` of the view that it is in. I don't know anything about this 'view.value.mountPath' thing, but when I try to not include the `.split('.')[0]` part at the end, it throws an error.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [December 13, 2023, 7:12pm UTC](https://forum.inductiveautomation.com/t/markdown-javascript-mountpath-into-self-instead-of-root-object/83102/2 "2023-12-13T19:12:01Z")

</div>

Since you're injecting Javascript, I would say you're probably largely on your own from a support aspect.

Perhaps @victordcq knows something?

I wonder if perhaps the `this.parentNode....` doesn't actually get to node you think it should? Maybe it needs an additional parentNode now?

---

<div class="post-metadata">

**Author:** ![ToMakPo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tomakpo/32/23875_2.png) [@ToMakPo](https://forum.inductiveautomation.com/u/ToMakPo)\
**Post date:** [December 13, 2023, 7:32pm UTC](https://forum.inductiveautomation.com/t/markdown-javascript-mountpath-into-self-instead-of-root-object/83102/3 "2023-12-13T19:32:50Z")

</div>

No. It seems like I actually had too many parentNodes, but I think that fixed the problem. I will have to play with it more to check.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [December 14, 2023, 7:42am UTC](https://forum.inductiveautomation.com/t/markdown-javascript-mountpath-into-self-instead-of-root-object/83102/4 "2023-12-14T07:42:19Z")

</div>

I dont understand, could you rephrase it by naming the views parent and child, so i know which you want?

> [@ToMakPo](#):
>
> to embed the view into another, it writes to that view's `view.params` instead. I don't want that. I want it to only write to the `view.params` of the view that it is in.

Also what are you trying to do with this? tracking the mouse movements seems rather weird to sent to ignition
