Remove Joomla namespace from sidebar script#5259
Remove Joomla namespace from sidebar script#5259roland-d merged 3 commits intojoomla:stagingfrom dgrammatiko:__sidebar_joomla_undefined
Conversation
|
How about you just load core.js where the namespace is defined? I think it's a bit strange when we start defining the same namespace in various places. |
|
@Bakual The question here is: do we really need to define the function as |
|
The Joomla.toggleSidebar function has been removed in the latest sidebar PR. |
|
@phproberto I am afraid it is still there! The problem is that right now is not in core.js but is also dependent on core.js, which is not optimal. Take a look here: |
|
@phproberto The problem is that whenever a |
|
@phproberto it was just moved from |
Imho, it's better without the Joomla namespace because it's template specific 😄 |
There was a problem hiding this comment.
not safe function definition 😄 ...
Javascript Best Practices say: always use var prefix for define a new variable 😏
But for current case I would recommend use:
window.toggleSidebar = function(force)to be sure that toggleSidebar in the right scope 😉
|
@test |
|
@JoomliC can you test this one? |
|
@DGT41 yes i can, but it could be better in think to change Joomla.toggleSidebar into JtoggleSidebar, so that, no undefined namespace as @Bakual suggested :
...
@phproberto i thought core.js was always loaded in backend... so i've not changed it. But we can! @DGT41 EDIT : yes, didn't view files before... |
|
@JoomliC Hehe I already did this, take a look at https://github.com/joomla/joomla-cms/pull/5259/files |
|
@JoomliC Yes, thats the weird thing core.js is called in |
|
@test works! |
Remove Joomla namespace from sidebar script


This prevents error if core.js is not loaded by defining the Joomla namespace
Solves #5258