Skip to content

Commit

Permalink
IE7 box model fixes (this is a little hacky)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmartin authored and tobes committed Sep 4, 2012
1 parent 8468d78 commit f66b3c1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ckan/public/base/javascript/main.js
Expand Up @@ -78,6 +78,15 @@ this.ckan = this.ckan || {};

})(this.ckan, this.jQuery);

// Forces this to redraw in Internet Explorer 7
// This is useful for when IE7 doesn't properly render parts of the page after
// some dom manipulation has happened
this.jQuery.fn.ie7redraw = function() {
if (jQuery.browser.msie && jQuery.browser.version == '7.0') {
jQuery(this).css('zoom', 1);
}
};

// Temporary banner to let users on IE7 know that it may not display as
// expected.
(function showIEBanner() {
Expand Down
14 changes: 14 additions & 0 deletions ckan/public/base/javascript/modules/slug-preview.js
Expand Up @@ -68,6 +68,20 @@ this.ckan.module('slug-preview-slug', function (jQuery, _) {
});

sandbox.publish('slug-preview-created', preview[0]);

// Horrible hack to make sure that IE7 rerenders the subsequent
// DOM children correctly now that we've render the slug preview element
// We should drop this horrible hack ASAP
if (jQuery.browser.msie && jQuery.browser.version == '7.0') {
jQuery('.btn').on('click', preview, function(){
jQuery('.controls').ie7redraw();
});
preview.hide();
setTimeout(function() {
preview.show();
jQuery('.controls').ie7redraw();
}, 10);
}
}

// Watch for updates to the target field and update the hidden slug field
Expand Down

0 comments on commit f66b3c1

Please sign in to comment.