scripts/wiki-lenny/static/additional/ie7/ie7-dhtml.js
Antoine Durand-Gasselin cdfb2b41c2 [wiki-lenny] on établit une séparation entre les ressources statiques upstream et les plugins du crans
* Il faudra faire une solution plus propre, c'est juste pour commiter des
   changes

darcs-hash:20090306075901-bd074-45690e201de838132f1a94901b4a625a50f8a31d.gz
2009-03-06 08:59:01 +01:00

57 lines
1.9 KiB
JavaScript

/*
IE7, version 0.9 (alpha) (2005-08-19)
Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
License: http://creativecommons.org/licenses/LGPL/2.1/
*/
IE7.addModule("ie7-dhtml", function() {
/* ---------------------------------------------------------------------
This module is still in development and should not be used.
--------------------------------------------------------------------- */
ie7CSS.specialize("recalc", function() {
this.inherit();
for (var i = 0; i < this.recalcs.length; i++) {
var $recalc = this.recalcs[i];
for (var j = 0; i < $recalc[3].length; i++) {
_addPropertyChangeHandler($recalc[3][j], _getPropertyName($recalc[2]), $recalc[1]);
}
}
});
// constants
var _PATTERNS = {
width: "(width|paddingLeft|paddingRight|borderLeftWidth|borderRightWidth|borderLeftStyle|borderRightStyle)",
height: "(height|paddingTop|paddingBottom|borderTopHeight|borderBottomHeight|borderTopStyle|borderBottomStyle)"
};
var _PROPERTY_NAMES = {
width: "fixedWidth",
height: "fixedHeight",
right: "width",
bottom: "height"
};
var _DASH_LETTER = /-(\w)/g;
var _PROPERTY_NAME = /\w+/;
function _addPropertyChangeHandler($element, $propertyName, $fix) {
addEventHandler($element, "onpropertychange", function() {
if (_getPattern($propertyName).test(event.propertyName)) {
_reset($element, $propertyName);
$fix($element);
}
});
};
function _upper($match, $letter) {return $letter.toUpperCase()};
function _getPropertyName($pattern) {
return String(String($pattern).toLowerCase().replace(_DASH_LETTER, _upper).match(_PROPERTY_NAME));
};
function _getPattern($propertyName) {
return eval("/^style." + (_PATTERNS[$propertyName] || $propertyName) + "$/");
};
function _reset($element, $propertyName) {
$element.runtimeStyle[$propertyName] = "";
$propertyName = _PROPERTY_NAMES[$propertyName]
if ($propertyName) $element.runtimeStyle[$propertyName] = "";
};
});