Skip to content

Commit

Permalink
MDL-40750 course: Remove usage of selector :not() for IE8
Browse files Browse the repository at this point in the history
  • Loading branch information
FMCorz committed Dec 18, 2013
1 parent 66de9b8 commit a556530
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
2 changes: 2 additions & 0 deletions course/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,7 @@ protected function coursecat_coursebox(coursecat_helper $chelper, $course, $addi
$classes = trim('coursebox clearfix '. $additionalclasses);
if ($chelper->get_show_courses() >= self::COURSECAT_SHOW_COURSES_EXPANDED) {
$nametag = 'h3';
$classes .= ' expanded';
} else {
$classes .= ' collapsed';
$nametag = 'div';
Expand Down Expand Up @@ -1470,6 +1471,7 @@ protected function coursecat_category(coursecat_helper $chelper, $coursecat, $de
$classes[] = 'loaded';
if (!empty($categorycontent)) {
$classes[] = 'with_children';
$classes[] = 'expanded';
}
}
$content = html_writer::start_tag('div', array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var CSS = {
LOADED: 'loaded',
NOTLOADED: 'notloaded',
SECTIONCOLLAPSED: 'collapsed',
SECTIONEXPANDED: 'expanded',
HASCHILDREN: 'with_children'
},
SELECTORS = {
Expand All @@ -30,7 +31,7 @@ var CSS = {
CATEGORYLISTENLINK: '.category .info .name',
CATEGORYSPINNERLOCATION: '.name',
CATEGORYWITHCOLLAPSEDLOADEDCHILDREN: '.category.with_children.loaded.collapsed',
CATEGORYWITHMAXIMISEDLOADEDCHILDREN: '.category.with_children.loaded:not(.collapsed)',
CATEGORYWITHMAXIMISEDLOADEDCHILDREN: '.category.with_children.loaded.expanded',
COLLAPSEEXPAND: '.collapseexpand',
COURSEBOX: '.coursebox',
COURSEBOXLISTENLINK: '.coursebox .moreinfo',
Expand Down Expand Up @@ -237,12 +238,14 @@ NS.run_expansion = function(categorynode) {
// To avoid a jump effect, we need to set the height of the children to 0 here before removing the SECTIONCOLLAPSED class.
categorychildren.setStyle('height', '0');
categorynode.removeClass(CSS.SECTIONCOLLAPSED);
categorynode.addClass(CSS.SECTIONEXPANDED);
categorynode.setAttribute('aria-expanded', 'true');
categorychildren.fx.set('reverse', false);
} else {
categorychildren.fx.set('reverse', true);
categorychildren.fx.once('end', function(e, categorynode) {
categorynode.addClass(CSS.SECTIONCOLLAPSED);
categorynode.removeClass(CSS.SECTIONEXPANDED);
categorynode.setAttribute('aria-expanded', 'false');
}, this, categorynode);
}
Expand Down Expand Up @@ -314,6 +317,7 @@ NS.expand_all = function(ancestor) {
if (c.ancestor(SELECTORS.CATEGORYWITHCOLLAPSEDLOADEDCHILDREN)) {
// Expand the hidden children first without animation.
c.removeClass(CSS.SECTIONCOLLAPSED);
c.addClass(CSS.SECTIONEXPANDED);
c.all(SELECTORS.LOADEDTREES).removeClass(CSS.SECTIONCOLLAPSED);
} else {
finalexpansions.push(c);
Expand Down Expand Up @@ -343,6 +347,7 @@ NS.collapse_all = function(ancestor) {
// Run the final collapses now that the these are hidden hidden.
Y.all(finalcollapses).each(function(c) {
c.addClass(CSS.SECTIONCOLLAPSED);
c.removeClass(CSS.SECTIONEXPANDED);
c.all(SELECTORS.LOADEDTREES).addClass(CSS.SECTIONCOLLAPSED);
}, this);
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var CSS = {
LOADED: 'loaded',
NOTLOADED: 'notloaded',
SECTIONCOLLAPSED: 'collapsed',
SECTIONEXPANDED: 'expanded',
HASCHILDREN: 'with_children'
},
SELECTORS = {
Expand All @@ -30,7 +31,7 @@ var CSS = {
CATEGORYLISTENLINK: '.category .info .name',
CATEGORYSPINNERLOCATION: '.name',
CATEGORYWITHCOLLAPSEDLOADEDCHILDREN: '.category.with_children.loaded.collapsed',
CATEGORYWITHMAXIMISEDLOADEDCHILDREN: '.category.with_children.loaded:not(.collapsed)',
CATEGORYWITHMAXIMISEDLOADEDCHILDREN: '.category.with_children.loaded.expanded',
COLLAPSEEXPAND: '.collapseexpand',
COURSEBOX: '.coursebox',
COURSEBOXLISTENLINK: '.coursebox .moreinfo',
Expand Down Expand Up @@ -236,12 +237,14 @@ NS.run_expansion = function(categorynode) {
// To avoid a jump effect, we need to set the height of the children to 0 here before removing the SECTIONCOLLAPSED class.
categorychildren.setStyle('height', '0');
categorynode.removeClass(CSS.SECTIONCOLLAPSED);
categorynode.addClass(CSS.SECTIONEXPANDED);
categorynode.setAttribute('aria-expanded', 'true');
categorychildren.fx.set('reverse', false);
} else {
categorychildren.fx.set('reverse', true);
categorychildren.fx.once('end', function(e, categorynode) {
categorynode.addClass(CSS.SECTIONCOLLAPSED);
categorynode.removeClass(CSS.SECTIONEXPANDED);
categorynode.setAttribute('aria-expanded', 'false');
}, this, categorynode);
}
Expand Down Expand Up @@ -313,6 +316,7 @@ NS.expand_all = function(ancestor) {
if (c.ancestor(SELECTORS.CATEGORYWITHCOLLAPSEDLOADEDCHILDREN)) {
// Expand the hidden children first without animation.
c.removeClass(CSS.SECTIONCOLLAPSED);
c.addClass(CSS.SECTIONEXPANDED);
c.all(SELECTORS.LOADEDTREES).removeClass(CSS.SECTIONCOLLAPSED);
} else {
finalexpansions.push(c);
Expand Down Expand Up @@ -342,6 +346,7 @@ NS.collapse_all = function(ancestor) {
// Run the final collapses now that the these are hidden hidden.
Y.all(finalcollapses).each(function(c) {
c.addClass(CSS.SECTIONCOLLAPSED);
c.removeClass(CSS.SECTIONEXPANDED);
c.all(SELECTORS.LOADEDTREES).addClass(CSS.SECTIONCOLLAPSED);
}, this);
};
Expand Down
7 changes: 6 additions & 1 deletion course/yui/src/categoryexpander/js/categoryexpander.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var CSS = {
LOADED: 'loaded',
NOTLOADED: 'notloaded',
SECTIONCOLLAPSED: 'collapsed',
SECTIONEXPANDED: 'expanded',
HASCHILDREN: 'with_children'
},
SELECTORS = {
Expand All @@ -28,7 +29,7 @@ var CSS = {
CATEGORYLISTENLINK: '.category .info .name',
CATEGORYSPINNERLOCATION: '.name',
CATEGORYWITHCOLLAPSEDLOADEDCHILDREN: '.category.with_children.loaded.collapsed',
CATEGORYWITHMAXIMISEDLOADEDCHILDREN: '.category.with_children.loaded:not(.collapsed)',
CATEGORYWITHMAXIMISEDLOADEDCHILDREN: '.category.with_children.loaded.expanded',
COLLAPSEEXPAND: '.collapseexpand',
COURSEBOX: '.coursebox',
COURSEBOXLISTENLINK: '.coursebox .moreinfo',
Expand Down Expand Up @@ -235,12 +236,14 @@ NS.run_expansion = function(categorynode) {
// To avoid a jump effect, we need to set the height of the children to 0 here before removing the SECTIONCOLLAPSED class.
categorychildren.setStyle('height', '0');
categorynode.removeClass(CSS.SECTIONCOLLAPSED);
categorynode.addClass(CSS.SECTIONEXPANDED);
categorynode.setAttribute('aria-expanded', 'true');
categorychildren.fx.set('reverse', false);
} else {
categorychildren.fx.set('reverse', true);
categorychildren.fx.once('end', function(e, categorynode) {
categorynode.addClass(CSS.SECTIONCOLLAPSED);
categorynode.removeClass(CSS.SECTIONEXPANDED);
categorynode.setAttribute('aria-expanded', 'false');
}, this, categorynode);
}
Expand Down Expand Up @@ -312,6 +315,7 @@ NS.expand_all = function(ancestor) {
if (c.ancestor(SELECTORS.CATEGORYWITHCOLLAPSEDLOADEDCHILDREN)) {
// Expand the hidden children first without animation.
c.removeClass(CSS.SECTIONCOLLAPSED);
c.addClass(CSS.SECTIONEXPANDED);
c.all(SELECTORS.LOADEDTREES).removeClass(CSS.SECTIONCOLLAPSED);
} else {
finalexpansions.push(c);
Expand Down Expand Up @@ -341,6 +345,7 @@ NS.collapse_all = function(ancestor) {
// Run the final collapses now that the these are hidden hidden.
Y.all(finalcollapses).each(function(c) {
c.addClass(CSS.SECTIONCOLLAPSED);
c.removeClass(CSS.SECTIONEXPANDED);
c.all(SELECTORS.LOADEDTREES).addClass(CSS.SECTIONCOLLAPSED);
}, this);
};
Expand Down

0 comments on commit a556530

Please sign in to comment.