onContentLoad() is called twice on every page
|Assigned To:||Tomer Brisker|
|Target version:||Team Daniel - iteration 6|
|Found in release:||Pull request:||https://github.com/theforeman/foreman/pull/4080|
|Velocity based estimate||-|
From the jQuery docs:
when calling .trigger() with an event name matches the name of a property on the object, prefixed by on (e.g. triggering click on window that has a non null onclick method), jQuery will attempt to invoke that property as a method.
When the document loads we trigger a `ContentLoad` event, which causes jQuery to execute the function called `onContentLoad` by default. In addition, we attach a listener to the document that catches the `ContentLoad` event and executes the function as well.
We need to either rename the function or remove the extra listener.
Fixes #17570 - Only execute `onContentLoad` once per page
When an event is triggered, jQuery attempts to execute the on<name>
method if it exists for event <name>. We were also manually triggering
the `onContentLoad` every time the `ContentLoad` event was triggered,
leading to the function executing twice on every page.
This commit removes the explicit event listener so that the function
will only execute once.