Curieux ça : pourquoi "Mi" ?
Normalement, la taille d'un "em" c'est la largeur d'un "M", non ?
Ou alors il y a une référence plus subtile..
On 1/26/08, fil@rezo.net <fil@rezo.net> wrote:
Author: fil@rezo.net
Date: Sat Jan 26 10:06:50 2008
New Revision: 18189Log:
comme MSIE ne sait pas toujours donner sa fontSize en pixels, on insere un <span> avec les lettres 'Mi', et on regarde la largeur du blocAdded:
_plugins_/_stable_/crayons/js/jquery.px.js
Modified:
_plugins_/_stable_/crayons/crayons.js.html
_plugins_/_stable_/crayons/js/crayons.jsModified: _plugins_/_stable_/crayons/crayons.js.html
--- _plugins_/_stable_/crayons/crayons.js.html (original)
+++ _plugins_/_stable_/crayons/crayons.js.html Sat Jan 26 10:06:50 2008
@@ -19,6 +19,8 @@[(#CHEMIN{js/jquery.form.js}|pack_cQuery)]
+[(#CHEMIN{js/jquery.px.js}|pack_cQuery)]
+
[(#CHEMIN{js/crayons.js}|pack_cQuery)][(#CHEMIN{js/resizehandle.js}|pack_cQuery)]
Modified: _plugins_/_stable_/crayons/js/crayons.js
--- _plugins_/_stable_/crayons/js/crayons.js (original)
+++ _plugins_/_stable_/crayons/js/crayons.js Sat Jan 26 10:06:50 2008
@@ -105,10 +105,10 @@
'w': $(this).width(),
'h': $(this).height(),
'wh': window.innerHeight,
- 'em': $(this).css('fontSize'),
+ 'em': $(this).px('fontSize'), // eviter un bug MSIE sur fontSize
'class': me.className,
'color': $(this).css('color'),
- 'font-size': $(this).css('fontSize'),
+ 'font-size': $(this).px('fontSize'),
'font-family': $(this).css('fontFamily'),
'font-weight': $(this).css('fontWeight'),
'line-height': $(this).css('lineHeight'),Added: _plugins_/_stable_/crayons/js/jquery.px.js
--- _plugins_/_stable_/crayons/js/jquery.px.js (added)
+++ _plugins_/_stable_/crayons/js/jquery.px.js Sat Jan 26 10:06:50 2008
@@ -0,0 +1,17 @@
+(function($){
+ $.fn.px = function(prop) {
+ var val;
+ if($.browser.msie) {
+ $('<span>Mi<\/span>')
+ .appendTo(this[0])
+ .each(function(){
+ val = parseInt($(this).width()) + 'px';
+ })
+ .remove();
+ } else {
+ val = this.css(prop);
+ }
+ return val;
+ };
+
+})(jQuery);_______________________________________________
Spip-zone-commit@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-zone-commit