joomla/joomla-cms — pull request #5257 by phproberto (2014-11-30 01:46:58+00:00)
Title: Remove jQuery dependency from core.js

This solves https://github.com/joomla/joomla-cms/issues/5254

## Issue description
I was checking `core.js` and noticed that we have added there some jQuery code in functions:

`Joomla.renderMessages`
and
`Joomla.removeMessages`

They are mainly used on install and overrider but also third part developers can be using them.

We officially support jQuery & Mootools even being migrating to jQuery. Adding that code causes that developers that want to use only Mootools are forced to load jQuery.

So we have to convert them to plain JS.

## How to test

As it's hard to test message rendering in installation & language overrides here is some code that you can use. **You have to add this code before applying the patch and test it before and after the patch to be sure that it's working the same**.

I will explain how to put testing code in the articles view ( `administrator/components/com_content/views/articles/tmpl/default.php`). Around [line 54](https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/views/articles/tmpl/default.php#L54) add:

```php
JText::script('ERROR');
JText::script('MESSAGE');
JFactory::getDocument()->addScriptDeclaration('
jQuery(document).ready(function() {
jQuery(".js-test").click(function(){
var messages = {
"message": ["Message one", "Message two"],
"error": ["Error one", "Error two"]
};
Joomla.renderMessages(messages);
});
jQuery(".js-test-clear").click(function(){
Joomla.removeMessages();
});

});
');
```

Then before [line 66](https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/views/articles/tmpl/default.php#L66) (after the main container tag) add the buttons that will trigger the actions:

```php
Render messages
Clear messages
```

You will see something like:
![buttons](https://cloud.githubusercontent.com/assets/1119272/5236456/95ea4a38-783a-11e4-9672-fce849f07b2e.png)

* Clicking on the `Render messages` button should display the messages.
* Clicking on the `Clear messages` button should remove the messages.