1 |
/* |
1 |
/* |
2 |
IE7, version 0.9 (alpha) (2005-08-19) |
2 |
IE7, version 0.9 (alpha) (2005-08-19) |
3 |
Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/) |
3 |
Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/) |
4 |
License: http://creativecommons.org/licenses/LGPL/2.1/ |
4 |
License: http://creativecommons.org/licenses/LGPL/2.1/ |
5 |
*/ |
5 |
*/ |
6 |
IE7.addModule("ie7-dhtml", function() { |
6 |
IE7.addModule("ie7-dhtml", function() { |
7 |
|
7 |
|
8 |
/* --------------------------------------------------------------------- |
8 |
/* --------------------------------------------------------------------- |
9 |
This module is still in development and should not be used. |
9 |
This module is still in development and should not be used. |
10 |
--------------------------------------------------------------------- */ |
10 |
--------------------------------------------------------------------- */ |
11 |
|
11 |
|
12 |
ie7CSS.specialize("recalc", function() { |
12 |
ie7CSS.specialize("recalc", function() { |
13 |
this.inherit(); |
13 |
this.inherit(); |
14 |
for (var i = 0; i < this.recalcs.length; i++) { |
14 |
for (var i = 0; i < this.recalcs.length; i++) { |
15 |
var $recalc = this.recalcs[i]; |
15 |
var $recalc = this.recalcs[i]; |
16 |
for (var j = 0; i < $recalc[3].length; i++) { |
16 |
for (var j = 0; i < $recalc[3].length; i++) { |
17 |
_addPropertyChangeHandler($recalc[3][j], _getPropertyName($recalc[2]), $recalc[1]); |
17 |
_addPropertyChangeHandler($recalc[3][j], _getPropertyName($recalc[2]), $recalc[1]); |
18 |
} |
18 |
} |
19 |
} |
19 |
} |
20 |
}); |
20 |
}); |
21 |
|
21 |
|
22 |
// constants |
22 |
// constants |
23 |
var _PATTERNS = { |
23 |
var _PATTERNS = { |
24 |
width: "(width|paddingLeft|paddingRight|borderLeftWidth|borderRightWidth|borderLeftStyle|borderRightStyle)", |
24 |
width: "(width|paddingLeft|paddingRight|borderLeftWidth|borderRightWidth|borderLeftStyle|borderRightStyle)", |
25 |
height: "(height|paddingTop|paddingBottom|borderTopHeight|borderBottomHeight|borderTopStyle|borderBottomStyle)" |
25 |
height: "(height|paddingTop|paddingBottom|borderTopHeight|borderBottomHeight|borderTopStyle|borderBottomStyle)" |
26 |
}; |
26 |
}; |
27 |
var _PROPERTY_NAMES = { |
27 |
var _PROPERTY_NAMES = { |
28 |
width: "fixedWidth", |
28 |
width: "fixedWidth", |
29 |
height: "fixedHeight", |
29 |
height: "fixedHeight", |
30 |
right: "width", |
30 |
right: "width", |
31 |
bottom: "height" |
31 |
bottom: "height" |
32 |
}; |
32 |
}; |
33 |
var _DASH_LETTER = /-(\w)/g; |
33 |
var _DASH_LETTER = /-(\w)/g; |
34 |
var _PROPERTY_NAME = /\w+/; |
34 |
var _PROPERTY_NAME = /\w+/; |
35 |
|
35 |
|
36 |
function _addPropertyChangeHandler($element, $propertyName, $fix) { |
36 |
function _addPropertyChangeHandler($element, $propertyName, $fix) { |
37 |
addEventHandler($element, "onpropertychange", function() { |
37 |
addEventHandler($element, "onpropertychange", function() { |
38 |
if (_getPattern($propertyName).test(event.propertyName)) { |
38 |
if (_getPattern($propertyName).test(event.propertyName)) { |
39 |
_reset($element, $propertyName); |
39 |
_reset($element, $propertyName); |
40 |
$fix($element); |
40 |
$fix($element); |
41 |
} |
41 |
} |
42 |
}); |
42 |
}); |
43 |
}; |
43 |
}; |
44 |
function _upper($match, $letter) {return $letter.toUpperCase()}; |
44 |
function _upper($match, $letter) {return $letter.toUpperCase()}; |
45 |
function _getPropertyName($pattern) { |
45 |
function _getPropertyName($pattern) { |
46 |
return String(String($pattern).toLowerCase().replace(_DASH_LETTER, _upper).match(_PROPERTY_NAME)); |
46 |
return String(String($pattern).toLowerCase().replace(_DASH_LETTER, _upper).match(_PROPERTY_NAME)); |
47 |
}; |
47 |
}; |
48 |
function _getPattern($propertyName) { |
48 |
function _getPattern($propertyName) { |
49 |
return eval("/^style." + (_PATTERNS[$propertyName] || $propertyName) + "$/"); |
49 |
return eval("/^style." + (_PATTERNS[$propertyName] || $propertyName) + "$/"); |
50 |
}; |
50 |
}; |
51 |
function _reset($element, $propertyName) { |
51 |
function _reset($element, $propertyName) { |
52 |
$element.runtimeStyle[$propertyName] = ""; |
52 |
$element.runtimeStyle[$propertyName] = ""; |
53 |
$propertyName = _PROPERTY_NAMES[$propertyName] |
53 |
$propertyName = _PROPERTY_NAMES[$propertyName] |
54 |
if ($propertyName) $element.runtimeStyle[$propertyName] = ""; |
54 |
if ($propertyName) $element.runtimeStyle[$propertyName] = ""; |
55 |
}; |
55 |
}; |
56 |
|
56 |
|
57 |
}); |
57 |
}); |