Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BUG Fix side-by-side initial icon display issue in IE8.

The new 'liszt:ready' handler is called late enough to trigger the
update, whereas the redraw is called to early for IE8 to pick up the
class change. The class property is changed correcly though, it looks
like an IE8 rendering issue.

http://open.silverstripe.org/ticket/8095
  • Loading branch information...
commit bf5590d8734c8cc35f1b324a393b544caf467673 1 parent 8455686
@mateusz mateusz authored
Showing with 15 additions and 16 deletions.
  1. +15 −16 admin/javascript/LeftAndMain.Preview.js
View
31 admin/javascript/LeftAndMain.Preview.js
@@ -424,6 +424,7 @@
* Reacts to the user changing the preview mode.
*/
onchange: function(e) {
+ this._super(e);
e.preventDefault();
var targetStateName = $(this).val();
@@ -523,38 +524,36 @@
'onliszt:showing_dropdown': function() {
this.siblings().find('.chzn-drop').addClass('open')._alignRight();
},
+
'onliszt:hiding_dropdown': function() {
this.siblings().find('.chzn-drop').removeClass('open')._removeRightAlign();
- },
+ },
+
+ /**
+ * Trigger additional initial icon update when the control is fully loaded.
+ * Solves an IE8 timing issue.
+ */
+ 'onliszt:ready': function() {
+ this._super();
+ this._addIcon();
+ },
+
_addIcon: function(){
var selected = this.find(':selected');
var iconClass = selected.attr('data-icon');
var target = this.parent().find('.chzn-container a.chzn-single');
var oldIcon = target.attr('data-icon');
- if(oldIcon != undefined){
+ if(typeof oldIcon !== 'undefined'){
target.removeClass(oldIcon);
}
target.addClass(iconClass);
target.attr('data-icon', iconClass);
- }
- });
- /*
- * When chzn initiated run select addIcon
- * Apply description text if applicable
- */
- $('.preview-selector a.chzn-single').entwine({
- onmatch: function() {
- this.closest('.preview-selector').find('select')._addIcon();
- this._super();
- },
- onunmatch: function() {
- this._super();
+ return this;
}
});
-
$('.preview-selector .chzn-drop').entwine({
_alignRight: function(){
var that = this;
Please sign in to comment.
Something went wrong with that request. Please try again.