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