Overriding Share Client Side Javascript

You are here

3 posts / 0 new
Last post
Overriding Share Client Side Javascript [Solved]

I'm trying to override the Share client side javascript for the people-finder.

The client side javascript resource for this declared in: people-finder.get.html.ftl.

I have a share extension module that overrides the people-finder.get.html.ftl with the following:

<@markup id="new-js" action="replace" target="js">
      <#-- JavaScript Dependencies -->
      <@script src="${url.context}/res/components/people-finder/people-finder-ext.js" group="people-finder"/>

My new people-finder client code is found in people-finder-ext.js.

My When the page loads, I can see that both the original people-finder.js and the people-finder-ext.js are loaded. Why is that? Shouldn't my @markup with action="replace" be overriding the original reference to people-finder.js?

Setting breakpoints in firebug shows that the people-finder.js is receiving/servicing the events and not people-finder-ext.js.



a @markup directive allows you to replace the content it generates / renders. Unfortunately, a @script tag inside the @markup does not render any content - it adds the path to the JS file to a runtime model which is later used to generate content in another @markup.
In effect, it is not possible to remove / replace a @script or @link within a @markup by targeting that @markup.

See this JIRA comment by David Draper which outlines the @markup behavior. In Short, you could replace the script if you were to use script without the leading @.


Axel Faust
Senior IT-Consultant / Software Architect
Frankfurt am Main, Germany

Even with subscriptions in the forum, it can be hard to keep track of all topics I participate in. If you feel you are waiting too long for me to answer, please send me a short PM. "Too long" means at least more than a day, preferably a couple of days - please don't abuse this offer. After all, I participate in this forum purely on my own time.



Excellent response. Thank you for the clarification.

Topic locked
forums index