-
Improvement
-
Resolution: Fixed
-
Minor
-
2.3
-
MOODLE_23_STABLE
-
MOODLE_24_STABLE
-
w33_
MDL-34741_m24_yui2in3 -
At present we have a homegrown YUI2 legacy support that loads YUI2 classes into the global scope (which means that YUI2 is available via global YAHOO object). The official recommended way is to use 2in3 http://yuilibrary.com/yui/docs/yui/yui-yui2.html which loads slightly modified YUI2 directly into the YUI3 instance property Y.YUI2.
This patch replaces our non-standard YUI2 hack with officially supported YUI 2in3.
Benefits:
1/ YUI2 Javascript classes and CSS are not loaded on each page - performance
2/ YUI2 files are loaded asynchronously - performance
3/ cleaner coding style with fewer bugs
Necessary code changes:
1/ YUI3 code using YUI2 widgets needs to use Y.YUI2.* instead of previous YAHOO.
2/ rewrite old legacy code that is still using deprecated $PAGE->requires->yui2_lib('xx') to use new moodle JS modules
3/ in the worst case wrap old code with YUI3 block and use yui2-* modules as dependencies
Example of YUI3 module using TreeView widget:
YUI.add('mod-mymodule-tree', function(Y) {
|
// ...
|
var tree = new Y.YUI2.widget.TreeView("elemid");
|
// ...
|
}, '@VERSION@', {requires:['base', 'node', 'yui2-treeview']});
|
Sample modification of YUI3 code without changing module dependencies:
YUI().use(function(Y) {
|
// Old code
|
// ...
|
Y().use('yui2-treeview', function(Y) {
|
var tree = new Y.YUI2.widget.TreeView("elemid");
|
// ...
|
});
|
// ...
|
Example of backwards compatibility hack in global scope:
YUI().use('yui2-dom', 'yui2-event', '...', function(Y) {
|
var YAHOO = Y.YUI2;
|
// Old code here
|
// ...
|
|
});
|
- caused a regression
-
MDL-35355 Embedded URL content loads then disappears
- Closed
-
MDL-34934 Delete unnecessary lib/editor/tinymce/extra/tools/.gitignore
- Closed
- Discovered while testing
-
MDL-34905 Error received when I click the "save the state of the flags" button
- Closed
- has a non-specific relationship to
-
MDL-43490 Remove deprecated lib/outputrequirements.php::yui2_lib
- Closed
-
MDL-34915 Provide SimpleYUI access in Moodle
- Closed
- is blocked by
-
MDL-34701 import YUI 3.6.0
- Closed
- Testing discovered
-
MDL-34907 JavaScript error in assignment upgrade tool
- Closed