mootools-rails 1.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,9 @@ web build:
8
8
  packager build:
9
9
  - packager build Core/Core Core/Array Core/String Core/Number Core/Function Core/Object Core/Event Core/Browser Core/Class Core/Class.Extras Core/Slick.Parser Core/Slick.Finder Core/Element Core/Element.Style Core/Element.Event Core/Element.Delegation Core/Element.Dimensions Core/Fx Core/Fx.CSS Core/Fx.Tween Core/Fx.Morph Core/Fx.Transitions Core/Request Core/Request.HTML Core/Request.JSON Core/Cookie Core/JSON Core/DOMReady Core/Swiff
10
10
 
11
+ ...
12
+ */
13
+
11
14
  /*
12
15
  ---
13
16
 
@@ -17,7 +20,7 @@ description: The heart of MooTools.
17
20
 
18
21
  license: MIT-style license.
19
22
 
20
- copyright: Copyright (c) 2006-2010 [Valerio Proietti](http://mad4milk.net/).
23
+ copyright: Copyright (c) 2006-2012 [Valerio Proietti](http://mad4milk.net/).
21
24
 
22
25
  authors: The MooTools production team (http://mootools.net/developers/)
23
26
 
@@ -33,15 +36,15 @@ provides: [Core, MooTools, Type, typeOf, instanceOf, Native]
33
36
  (function(){
34
37
 
35
38
  this.MooTools = {
36
- version: '1.4.1',
37
- build: 'd1fb25710e3c5482a219ab9dc675a4e0ad2176b6'
39
+ version: '1.4.5',
40
+ build: 'ab8ea8824dc3b24b6666867a2c4ed58ebb762cf0'
38
41
  };
39
42
 
40
43
  // typeOf, instanceOf
41
44
 
42
45
  var typeOf = this.typeOf = function(item){
43
46
  if (item == null) return 'null';
44
- if (item.$family) return item.$family();
47
+ if (item.$family != null) return item.$family();
45
48
 
46
49
  if (item.nodeName){
47
50
  if (item.nodeType == 1) return 'element';
@@ -61,6 +64,9 @@ var instanceOf = this.instanceOf = function(item, object){
61
64
  if (constructor === object) return true;
62
65
  constructor = constructor.parent;
63
66
  }
67
+ /*<ltIE8>*/
68
+ if (!item.hasOwnProperty) return false;
69
+ /*</ltIE8>*/
64
70
  return item instanceof object;
65
71
  };
66
72
 
@@ -93,8 +99,9 @@ Function.prototype.overloadGetter = function(usePlural){
93
99
  var self = this;
94
100
  return function(a){
95
101
  var args, result;
96
- if (usePlural || typeof a != 'string') args = a;
102
+ if (typeof a != 'string') args = a;
97
103
  else if (arguments.length > 1) args = arguments;
104
+ else if (usePlural) args = [a];
98
105
  if (args){
99
106
  result = {};
100
107
  for (var i = 0; i < args.length; i++) result[args[i]] = self.call(this, args[i]);
@@ -251,14 +258,18 @@ var force = function(name, object, methods){
251
258
  proto = prototype[key];
252
259
 
253
260
  if (generic) generic.protect();
254
-
255
- if (isType && proto){
256
- delete prototype[key];
257
- prototype[key] = proto.protect();
258
- }
261
+ if (isType && proto) object.implement(key, proto.protect());
259
262
  }
260
263
 
261
- if (isType) object.implement(prototype);
264
+ if (isType){
265
+ var methodsEnumerable = prototype.propertyIsEnumerable(methods[0]);
266
+ object.forEachMethod = function(fn){
267
+ if (!methodsEnumerable) for (var i = 0, l = methods.length; i < l; i++){
268
+ fn.call(prototype, prototype[methods[i]], methods[i]);
269
+ }
270
+ for (var key in prototype) fn.call(prototype, prototype[key], key)
271
+ };
272
+ }
262
273
 
263
274
  return force;
264
275
  };
@@ -429,8 +440,9 @@ Array.implement({
429
440
 
430
441
  filter: function(fn, bind){
431
442
  var results = [];
432
- for (var i = 0, l = this.length >>> 0; i < l; i++){
433
- if ((i in this) && fn.call(bind, this[i], i, this)) results.push(this[i]);
443
+ for (var value, i = 0, l = this.length >>> 0; i < l; i++) if (i in this){
444
+ value = this[i];
445
+ if (fn.call(bind, value, i, this)) results.push(value);
434
446
  }
435
447
  return results;
436
448
  },
@@ -936,17 +948,6 @@ provides: [Browser, Window, Document]
936
948
  var document = this.document;
937
949
  var window = document.window = this;
938
950
 
939
- var UID = 1;
940
-
941
- this.$uid = (window.ActiveXObject) ? function(item){
942
- return (item.uid || (item.uid = [UID++]))[0];
943
- } : function(item){
944
- return item.uid || (item.uid = UID++);
945
- };
946
-
947
- $uid(window);
948
- $uid(document);
949
-
950
951
  var ua = navigator.userAgent.toLowerCase(),
951
952
  platform = navigator.platform.toLowerCase(),
952
953
  UA = ua.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/) || [null, 'unknown', 0],
@@ -1918,8 +1919,14 @@ local.setDocument = function(document){
1918
1919
 
1919
1920
  // contains
1920
1921
  // FIXME: Add specs: local.contains should be different for xml and html documents?
1921
- features.contains = (root && this.isNativeCode(root.contains)) ? function(context, node){
1922
+ var nativeRootContains = root && this.isNativeCode(root.contains),
1923
+ nativeDocumentContains = document && this.isNativeCode(document.contains);
1924
+
1925
+ features.contains = (nativeRootContains && nativeDocumentContains) ? function(context, node){
1922
1926
  return context.contains(node);
1927
+ } : (nativeRootContains && !nativeDocumentContains) ? function(context, node){
1928
+ // IE8 does not have .contains on document.
1929
+ return context === node || ((context === document) ? document.documentElement : context).contains(node);
1923
1930
  } : (root && root.compareDocumentPosition) ? function(context, node){
1924
1931
  return context === node || !!(context.compareDocumentPosition(node) & 16);
1925
1932
  } : function(context, node){
@@ -2314,7 +2321,7 @@ local.matchSelector = function(node, tag, id, classes, attributes, pseudos){
2314
2321
 
2315
2322
  var i, part, cls;
2316
2323
  if (classes) for (i = classes.length; i--;){
2317
- cls = node.getAttribute('class') || node.className;
2324
+ cls = this.getAttribute(node, 'class');
2318
2325
  if (!(cls && classes[i].regexp.test(cls))) return false;
2319
2326
  }
2320
2327
  if (attributes) for (i = attributes.length; i--;){
@@ -2500,7 +2507,7 @@ var pseudos = {
2500
2507
  'nth-last-of-type': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHTypeLast', true),
2501
2508
 
2502
2509
  'index': function(node, index){
2503
- return this['pseudo:nth-child'](node, '' + index + 1);
2510
+ return this['pseudo:nth-child'](node, '' + (index + 1));
2504
2511
  },
2505
2512
 
2506
2513
  'even': function(node){
@@ -2572,10 +2579,6 @@ for (var p in pseudos) local['pseudo:' + p] = pseudos[p];
2572
2579
 
2573
2580
  var attributeGetters = local.attributeGetters = {
2574
2581
 
2575
- 'class': function(){
2576
- return this.getAttribute('class') || this.className;
2577
- },
2578
-
2579
2582
  'for': function(){
2580
2583
  return ('htmlFor' in this) ? this.htmlFor : this.getAttribute('for');
2581
2584
  },
@@ -2610,7 +2613,7 @@ attributeGetters.MAXLENGTH = attributeGetters.maxLength = attributeGetters.maxle
2610
2613
 
2611
2614
  var Slick = local.Slick = (this.Slick || {});
2612
2615
 
2613
- Slick.version = '1.1.6';
2616
+ Slick.version = '1.1.7';
2614
2617
 
2615
2618
  // Slick finder
2616
2619
 
@@ -2739,7 +2742,16 @@ var Element = function(tag, props){
2739
2742
  return document.newElement(tag, props);
2740
2743
  };
2741
2744
 
2742
- if (Browser.Element) Element.prototype = Browser.Element.prototype;
2745
+
2746
+ if (Browser.Element){
2747
+ Element.prototype = Browser.Element.prototype;
2748
+ // IE8 and IE9 require the wrapping.
2749
+ Element.prototype._fireEvent = (function(fireEvent){
2750
+ return function(type, event){
2751
+ return fireEvent.call(this, type, event);
2752
+ };
2753
+ })(Element.prototype.fireEvent);
2754
+ }
2743
2755
 
2744
2756
  new Type('Element', Element).mirror(function(name){
2745
2757
  if (Array.prototype[name]) return;
@@ -2760,7 +2772,10 @@ new Type('Element', Element).mirror(function(name){
2760
2772
  if (!Browser.Element){
2761
2773
  Element.parent = Object;
2762
2774
 
2763
- Element.Prototype = {'$family': Function.from('element').hide()};
2775
+ Element.Prototype = {
2776
+ '$constructor': Element,
2777
+ '$family': Function.from('element').hide()
2778
+ };
2764
2779
 
2765
2780
  Element.mirror(function(name, method){
2766
2781
  Element.Prototype[name] = method;
@@ -2875,16 +2890,17 @@ if (object[1] == 1) Elements.implement('splice', function(){
2875
2890
  return result;
2876
2891
  }.protect());
2877
2892
 
2878
- Elements.implement(Array.prototype);
2893
+ Array.forEachMethod(function(method, name){
2894
+ Elements.implement(name, method);
2895
+ });
2879
2896
 
2880
2897
  Array.mirror(Elements);
2881
2898
 
2882
2899
  /*<ltIE8>*/
2883
2900
  var createElementAcceptsHTML;
2884
2901
  try {
2885
- var x = document.createElement('<input name=x>');
2886
- createElementAcceptsHTML = (x.name == 'x');
2887
- } catch(e){}
2902
+ createElementAcceptsHTML = (document.createElement('<input name=x>').name == 'x');
2903
+ } catch (e){}
2888
2904
 
2889
2905
  var escapeQuotes = function(html){
2890
2906
  return ('' + html).replace(/&/g, '&amp;').replace(/"/g, '&quot;');
@@ -2912,6 +2928,11 @@ Document.implement({
2912
2928
 
2913
2929
  })();
2914
2930
 
2931
+ (function(){
2932
+
2933
+ Slick.uidOf(window);
2934
+ Slick.uidOf(document);
2935
+
2915
2936
  Document.implement({
2916
2937
 
2917
2938
  newTextNode: function(text){
@@ -2936,8 +2957,13 @@ Document.implement({
2936
2957
  },
2937
2958
 
2938
2959
  element: function(el, nocash){
2939
- $uid(el);
2960
+ Slick.uidOf(el);
2940
2961
  if (!nocash && !el.$family && !(/^(?:object|embed)$/i).test(el.tagName)){
2962
+ var fireEvent = el.fireEvent;
2963
+ // wrapping needed in IE7, or else crash
2964
+ el._fireEvent = function(type, event){
2965
+ return fireEvent(type, event);
2966
+ };
2941
2967
  Object.append(el, Element.Prototype);
2942
2968
  }
2943
2969
  return el;
@@ -2955,7 +2981,7 @@ Document.implement({
2955
2981
  };
2956
2982
 
2957
2983
  return function(el, nocash, doc){
2958
- if (el && el.$family && el.uid) return el;
2984
+ if (el && el.$family && el.uniqueNumber) return el;
2959
2985
  var type = typeOf(el);
2960
2986
  return (types[type]) ? types[type](el, nocash, doc || document) : null;
2961
2987
  };
@@ -3075,8 +3101,6 @@ if (window.$$ == null) Window.implement('$$', function(selector){
3075
3101
  return new Elements(arguments);
3076
3102
  });
3077
3103
 
3078
- (function(){
3079
-
3080
3104
  // Inserters
3081
3105
 
3082
3106
  var inserters = {
@@ -3114,18 +3138,13 @@ var propertyGetters = {}, propertySetters = {};
3114
3138
  var properties = {};
3115
3139
  Array.forEach([
3116
3140
  'type', 'value', 'defaultValue', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan',
3117
- 'frameBorder', 'readOnly', 'rowSpan', 'tabIndex', 'useMap'
3141
+ 'frameBorder', 'rowSpan', 'tabIndex', 'useMap'
3118
3142
  ], function(property){
3119
3143
  properties[property.toLowerCase()] = property;
3120
3144
  });
3121
3145
 
3122
- Object.append(properties, {
3123
- 'html': 'innerHTML',
3124
- 'text': (function(){
3125
- var temp = document.createElement('div');
3126
- return (temp.textContent == null) ? 'innerText': 'textContent';
3127
- })()
3128
- });
3146
+ properties.html = 'innerHTML';
3147
+ properties.text = (document.createElement('div').textContent == null) ? 'innerText': 'textContent';
3129
3148
 
3130
3149
  Object.forEach(properties, function(real, key){
3131
3150
  propertySetters[key] = function(node, value){
@@ -3162,7 +3181,7 @@ Array.forEach(bools, function(bool){
3162
3181
  Object.append(propertySetters, {
3163
3182
 
3164
3183
  'class': function(node, value){
3165
- ('className' in node) ? node.className = value : node.setAttribute('class', value);
3184
+ ('className' in node) ? node.className = (value || '') : node.setAttribute('class', value);
3166
3185
  },
3167
3186
 
3168
3187
  'for': function(node, value){
@@ -3171,26 +3190,73 @@ Object.append(propertySetters, {
3171
3190
 
3172
3191
  'style': function(node, value){
3173
3192
  (node.style) ? node.style.cssText = value : node.setAttribute('style', value);
3193
+ },
3194
+
3195
+ 'value': function(node, value){
3196
+ node.value = (value != null) ? value : '';
3174
3197
  }
3175
3198
 
3176
3199
  });
3177
3200
 
3201
+ propertyGetters['class'] = function(node){
3202
+ return ('className' in node) ? node.className || null : node.getAttribute('class');
3203
+ };
3204
+
3205
+ /* <webkit> */
3206
+ var el = document.createElement('button');
3207
+ // IE sets type as readonly and throws
3208
+ try { el.type = 'button'; } catch(e){}
3209
+ if (el.type != 'button') propertySetters.type = function(node, value){
3210
+ node.setAttribute('type', value);
3211
+ };
3212
+ el = null;
3213
+ /* </webkit> */
3214
+
3215
+ /*<IE>*/
3216
+ var input = document.createElement('input');
3217
+ input.value = 't';
3218
+ input.type = 'submit';
3219
+ if (input.value != 't') propertySetters.type = function(node, type){
3220
+ var value = node.value;
3221
+ node.type = type;
3222
+ node.value = value;
3223
+ };
3224
+ input = null;
3225
+ /*</IE>*/
3226
+
3178
3227
  /* getProperty, setProperty */
3179
3228
 
3229
+ /* <ltIE9> */
3230
+ var pollutesGetAttribute = (function(div){
3231
+ div.random = 'attribute';
3232
+ return (div.getAttribute('random') == 'attribute');
3233
+ })(document.createElement('div'));
3234
+
3235
+ /* <ltIE9> */
3236
+
3180
3237
  Element.implement({
3181
3238
 
3182
3239
  setProperty: function(name, value){
3183
- var lower = name.toLowerCase();
3184
- if (value == null){
3185
- if (!booleans[lower]){
3240
+ var setter = propertySetters[name.toLowerCase()];
3241
+ if (setter){
3242
+ setter(this, value);
3243
+ } else {
3244
+ /* <ltIE9> */
3245
+ if (pollutesGetAttribute) var attributeWhiteList = this.retrieve('$attributeWhiteList', {});
3246
+ /* </ltIE9> */
3247
+
3248
+ if (value == null){
3186
3249
  this.removeAttribute(name);
3187
- return this;
3250
+ /* <ltIE9> */
3251
+ if (pollutesGetAttribute) delete attributeWhiteList[name];
3252
+ /* </ltIE9> */
3253
+ } else {
3254
+ this.setAttribute(name, '' + value);
3255
+ /* <ltIE9> */
3256
+ if (pollutesGetAttribute) attributeWhiteList[name] = true;
3257
+ /* </ltIE9> */
3188
3258
  }
3189
- value = false;
3190
3259
  }
3191
- var setter = propertySetters[lower];
3192
- if (setter) setter(this, value);
3193
- else this.setAttribute(name, value);
3194
3260
  return this;
3195
3261
  },
3196
3262
 
@@ -3202,6 +3268,18 @@ Element.implement({
3202
3268
  getProperty: function(name){
3203
3269
  var getter = propertyGetters[name.toLowerCase()];
3204
3270
  if (getter) return getter(this);
3271
+ /* <ltIE9> */
3272
+ if (pollutesGetAttribute){
3273
+ var attr = this.getAttributeNode(name), attributeWhiteList = this.retrieve('$attributeWhiteList', {});
3274
+ if (!attr) return null;
3275
+ if (attr.expando && !attributeWhiteList[name]){
3276
+ var outer = this.outerHTML;
3277
+ // segment by the opening tag and find mention of attribute name
3278
+ if (outer.substr(0, outer.search(/\/?['"]?>(?![^<]*<['"])/)).indexOf(name) < 0) return null;
3279
+ attributeWhiteList[name] = true;
3280
+ }
3281
+ }
3282
+ /* </ltIE9> */
3205
3283
  var result = Slick.getAttribute(this, name);
3206
3284
  return (!result && !Slick.hasAttribute(this, name)) ? null : result;
3207
3285
  },
@@ -3328,7 +3406,7 @@ var get = function(uid){
3328
3406
  };
3329
3407
 
3330
3408
  var clean = function(item){
3331
- var uid = item.uid;
3409
+ var uid = item.uniqueNumber;
3332
3410
  if (item.removeEvents) item.removeEvents();
3333
3411
  if (item.clearAttributes) item.clearAttributes();
3334
3412
  if (uid != null){
@@ -3374,7 +3452,7 @@ Element.implement({
3374
3452
  if (node.clearAttributes){
3375
3453
  node.clearAttributes();
3376
3454
  node.mergeAttributes(element);
3377
- node.removeAttribute('uid');
3455
+ node.removeAttribute('uniqueNumber');
3378
3456
  if (node.options){
3379
3457
  var no = node.options, eo = element.options;
3380
3458
  for (var j = no.length; j--;) no[j].selected = eo[j].selected;
@@ -3406,7 +3484,7 @@ Element.implement({
3406
3484
  old();
3407
3485
  };
3408
3486
  } else {
3409
- collected[$uid(this)] = this;
3487
+ collected[Slick.uidOf(this)] = this;
3410
3488
  }
3411
3489
  if (this.addEventListener) this.addEventListener(type, fn, !!arguments[2]);
3412
3490
  else this.attachEvent('on' + type, fn);
@@ -3420,19 +3498,19 @@ Element.implement({
3420
3498
  },
3421
3499
 
3422
3500
  retrieve: function(property, dflt){
3423
- var storage = get($uid(this)), prop = storage[property];
3501
+ var storage = get(Slick.uidOf(this)), prop = storage[property];
3424
3502
  if (dflt != null && prop == null) prop = storage[property] = dflt;
3425
3503
  return prop != null ? prop : null;
3426
3504
  },
3427
3505
 
3428
3506
  store: function(property, value){
3429
- var storage = get($uid(this));
3507
+ var storage = get(Slick.uidOf(this));
3430
3508
  storage[property] = value;
3431
3509
  return this;
3432
3510
  },
3433
3511
 
3434
3512
  eliminate: function(property){
3435
- var storage = get($uid(this));
3513
+ var storage = get(Slick.uidOf(this));
3436
3514
  delete storage[property];
3437
3515
  return this;
3438
3516
  }
@@ -3474,60 +3552,77 @@ Element.Properties.tag = {
3474
3552
 
3475
3553
  };
3476
3554
 
3477
- /*<!webkit>*/
3478
- Element.Properties.html = (function(){
3479
-
3480
- var tableTest = Function.attempt(function(){
3481
- var table = document.createElement('table');
3482
- table.innerHTML = '<tr><td></td></tr>';
3483
- });
3555
+ Element.Properties.html = {
3484
3556
 
3485
- var wrapper = document.createElement('div');
3557
+ set: function(html){
3558
+ if (html == null) html = '';
3559
+ else if (typeOf(html) == 'array') html = html.join('');
3560
+ this.innerHTML = html;
3561
+ },
3486
3562
 
3487
- var translations = {
3488
- table: [1, '<table>', '</table>'],
3489
- select: [1, '<select>', '</select>'],
3490
- tbody: [2, '<table><tbody>', '</tbody></table>'],
3491
- tr: [3, '<table><tbody><tr>', '</tr></tbody></table>']
3492
- };
3493
- translations.thead = translations.tfoot = translations.tbody;
3494
-
3495
- /*<ltIE9>*/
3496
- // technique by jdbarlett - http://jdbartlett.com/innershiv/
3497
- wrapper.innerHTML = '<nav></nav>';
3498
- var HTML5Test = wrapper.childNodes.length == 1;
3499
- if (!HTML5Test){
3500
- var tags = 'abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' '),
3501
- fragment = document.createDocumentFragment(), l = tags.length;
3502
- while (l--) fragment.createElement(tags[l]);
3503
- fragment.appendChild(wrapper);
3563
+ erase: function(){
3564
+ this.innerHTML = '';
3504
3565
  }
3505
- /*</ltIE9>*/
3506
3566
 
3507
- var html = {
3508
- set: function(html){
3509
- if (typeOf(html) == 'array') html = html.join('');
3567
+ };
3510
3568
 
3511
- var wrap = (!tableTest && translations[this.get('tag')]);
3512
- /*<ltIE9>*/
3513
- if (!wrap && !HTML5Test) wrap = [0, '', ''];
3514
- /*</ltIE9>*/
3515
- if (wrap){
3516
- var first = wrapper;
3517
- first.innerHTML = wrap[1] + html + wrap[2];
3518
- for (var i = wrap[0]; i--;) first = first.firstChild;
3519
- this.empty().adopt(first.childNodes);
3520
- } else {
3521
- this.innerHTML = html;
3522
- }
3523
- }
3524
- };
3569
+ /*<ltIE9>*/
3570
+ // technique by jdbarlett - http://jdbartlett.com/innershiv/
3571
+ var div = document.createElement('div');
3572
+ div.innerHTML = '<nav></nav>';
3573
+ var supportsHTML5Elements = (div.childNodes.length == 1);
3574
+ if (!supportsHTML5Elements){
3575
+ var tags = 'abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' '),
3576
+ fragment = document.createDocumentFragment(), l = tags.length;
3577
+ while (l--) fragment.createElement(tags[l]);
3578
+ }
3579
+ div = null;
3580
+ /*</ltIE9>*/
3581
+
3582
+ /*<IE>*/
3583
+ var supportsTableInnerHTML = Function.attempt(function(){
3584
+ var table = document.createElement('table');
3585
+ table.innerHTML = '<tr><td></td></tr>';
3586
+ return true;
3587
+ });
3525
3588
 
3526
- html.erase = html.set;
3589
+ /*<ltFF4>*/
3590
+ var tr = document.createElement('tr'), html = '<td></td>';
3591
+ tr.innerHTML = html;
3592
+ var supportsTRInnerHTML = (tr.innerHTML == html);
3593
+ tr = null;
3594
+ /*</ltFF4>*/
3527
3595
 
3528
- return html;
3529
- })();
3530
- /*</!webkit>*/
3596
+ if (!supportsTableInnerHTML || !supportsTRInnerHTML || !supportsHTML5Elements){
3597
+
3598
+ Element.Properties.html.set = (function(set){
3599
+
3600
+ var translations = {
3601
+ table: [1, '<table>', '</table>'],
3602
+ select: [1, '<select>', '</select>'],
3603
+ tbody: [2, '<table><tbody>', '</tbody></table>'],
3604
+ tr: [3, '<table><tbody><tr>', '</tr></tbody></table>']
3605
+ };
3606
+
3607
+ translations.thead = translations.tfoot = translations.tbody;
3608
+
3609
+ return function(html){
3610
+ var wrap = translations[this.get('tag')];
3611
+ if (!wrap && !supportsHTML5Elements) wrap = [0, '', ''];
3612
+ if (!wrap) return set.call(this, html);
3613
+
3614
+ var level = wrap[0], wrapper = document.createElement('div'), target = wrapper;
3615
+ if (!supportsHTML5Elements) fragment.appendChild(wrapper);
3616
+ wrapper.innerHTML = [wrap[1], html, wrap[2]].flatten().join('');
3617
+ while (level--) target = target.firstChild;
3618
+ this.empty().adopt(target.childNodes);
3619
+ if (!supportsHTML5Elements) fragment.removeChild(wrapper);
3620
+ wrapper = null;
3621
+ };
3622
+
3623
+ })(Element.Properties.html.set);
3624
+ }
3625
+ /*</IE>*/
3531
3626
 
3532
3627
  /*<ltIE9>*/
3533
3628
  var testForm = document.createElement('form');
@@ -3559,8 +3654,23 @@ if (testForm.firstChild.value != 's') Element.Properties.value = {
3559
3654
  }
3560
3655
 
3561
3656
  };
3657
+ testForm = null;
3562
3658
  /*</ltIE9>*/
3563
3659
 
3660
+ /*<IE>*/
3661
+ if (document.createElement('div').getAttributeNode('id')) Element.Properties.id = {
3662
+ set: function(id){
3663
+ this.id = this.getAttributeNode('id').value = id;
3664
+ },
3665
+ get: function(){
3666
+ return this.id || null;
3667
+ },
3668
+ erase: function(){
3669
+ this.id = this.getAttributeNode('id').value = '';
3670
+ }
3671
+ };
3672
+ /*</IE>*/
3673
+
3564
3674
  })();
3565
3675
 
3566
3676
 
@@ -3584,6 +3694,15 @@ provides: Element.Style
3584
3694
 
3585
3695
  var html = document.html;
3586
3696
 
3697
+ //<ltIE9>
3698
+ // Check for oldIE, which does not remove styles when they're set to null
3699
+ var el = document.createElement('div');
3700
+ el.style.color = 'red';
3701
+ el.style.color = null;
3702
+ var doesNotRemoveStyles = el.style.color == 'red';
3703
+ el = null;
3704
+ //</ltIE9>
3705
+
3587
3706
  Element.Properties.styles = {set: function(styles){
3588
3707
  this.setStyles(styles);
3589
3708
  }};
@@ -3594,17 +3713,19 @@ var hasOpacity = (html.style.opacity != null),
3594
3713
 
3595
3714
  var setVisibility = function(element, opacity){
3596
3715
  element.store('$opacity', opacity);
3597
- element.style.visibility = opacity > 0 ? 'visible' : 'hidden';
3716
+ element.style.visibility = opacity > 0 || opacity == null ? 'visible' : 'hidden';
3598
3717
  };
3599
3718
 
3600
3719
  var setOpacity = (hasOpacity ? function(element, opacity){
3601
3720
  element.style.opacity = opacity;
3602
3721
  } : (hasFilter ? function(element, opacity){
3603
- if (!element.currentStyle || !element.currentStyle.hasLayout) element.style.zoom = 1;
3604
- opacity = (opacity * 100).limit(0, 100).round();
3605
- opacity = (opacity == 100) ? '' : 'alpha(opacity=' + opacity + ')';
3606
- var filter = element.style.filter || element.getComputedStyle('filter') || '';
3607
- element.style.filter = reAlpha.test(filter) ? filter.replace(reAlpha, opacity) : filter + opacity;
3722
+ var style = element.style;
3723
+ if (!element.currentStyle || !element.currentStyle.hasLayout) style.zoom = 1;
3724
+ if (opacity == null || opacity == 1) opacity = '';
3725
+ else opacity = 'alpha(opacity=' + (opacity * 100).limit(0, 100).round() + ')';
3726
+ var filter = style.filter || element.getComputedStyle('filter') || '';
3727
+ style.filter = reAlpha.test(filter) ? filter.replace(reAlpha, opacity) : filter + opacity;
3728
+ if (!style.filter) style.removeAttribute('filter');
3608
3729
  } : setVisibility));
3609
3730
 
3610
3731
  var getOpacity = (hasOpacity ? function(element){
@@ -3634,7 +3755,8 @@ Element.implement({
3634
3755
 
3635
3756
  setStyle: function(property, value){
3636
3757
  if (property == 'opacity'){
3637
- setOpacity(this, parseFloat(value));
3758
+ if (value != null) value = parseFloat(value);
3759
+ setOpacity(this, value);
3638
3760
  return this;
3639
3761
  }
3640
3762
  property = (property == 'float' ? floatName : property).camelCase();
@@ -3648,6 +3770,11 @@ Element.implement({
3648
3770
  value = Math.round(value);
3649
3771
  }
3650
3772
  this.style[property] = value;
3773
+ //<ltIE9>
3774
+ if ((value == '' || value == null) && doesNotRemoveStyles && this.style.removeAttribute){
3775
+ this.style.removeAttribute(property);
3776
+ }
3777
+ //</ltIE9>
3651
3778
  return this;
3652
3779
  },
3653
3780
 
@@ -3669,16 +3796,17 @@ Element.implement({
3669
3796
  var color = result.match(/rgba?\([\d\s,]+\)/);
3670
3797
  if (color) result = result.replace(color[0], color[0].rgbToHex());
3671
3798
  }
3672
- if (Browser.opera || (Browser.ie && isNaN(parseFloat(result)))){
3673
- if ((/^(height|width)$/).test(property)){
3799
+ if (Browser.opera || Browser.ie){
3800
+ if ((/^(height|width)$/).test(property) && !(/px$/.test(result))){
3674
3801
  var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0;
3675
3802
  values.each(function(value){
3676
3803
  size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt();
3677
3804
  }, this);
3678
3805
  return this['offset' + property.capitalize()] - size + 'px';
3679
3806
  }
3680
- if (Browser.opera && String(result).indexOf('px') != -1) return result;
3681
- if ((/^border(.+)Width|margin|padding/).test(property)) return '0px';
3807
+ if (Browser.ie && (/^border(.+)Width|margin|padding/).test(property) && isNaN(parseFloat(result))){
3808
+ return '0px';
3809
+ }
3682
3810
  }
3683
3811
  return result;
3684
3812
  },
@@ -3738,7 +3866,7 @@ Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, bor
3738
3866
 
3739
3867
  name: Element.Event
3740
3868
 
3741
- description: Contains Element methods for dealing with events. This file also includes mouseenter and mouseleave custom Element Events.
3869
+ description: Contains Element methods for dealing with events. This file also includes mouseenter and mouseleave custom Element Events, if necessary.
3742
3870
 
3743
3871
  license: MIT-style license.
3744
3872
 
@@ -3876,30 +4004,30 @@ Element.NativeEvents = {
3876
4004
  error: 1, abort: 1, scroll: 1 //misc
3877
4005
  };
3878
4006
 
3879
- var check = function(event){
3880
- var related = event.relatedTarget;
3881
- if (related == null) return true;
3882
- if (!related) return false;
3883
- return (related != this && related.prefix != 'xul' && typeOf(this) != 'document' && !this.contains(related));
3884
- };
4007
+ Element.Events = {mousewheel: {
4008
+ base: (Browser.firefox) ? 'DOMMouseScroll' : 'mousewheel'
4009
+ }};
3885
4010
 
3886
- Element.Events = {
4011
+ if ('onmouseenter' in document.documentElement){
4012
+ Element.NativeEvents.mouseenter = Element.NativeEvents.mouseleave = 2;
4013
+ } else {
4014
+ var check = function(event){
4015
+ var related = event.relatedTarget;
4016
+ if (related == null) return true;
4017
+ if (!related) return false;
4018
+ return (related != this && related.prefix != 'xul' && typeOf(this) != 'document' && !this.contains(related));
4019
+ };
3887
4020
 
3888
- mouseenter: {
4021
+ Element.Events.mouseenter = {
3889
4022
  base: 'mouseover',
3890
4023
  condition: check
3891
- },
4024
+ };
3892
4025
 
3893
- mouseleave: {
4026
+ Element.Events.mouseleave = {
3894
4027
  base: 'mouseout',
3895
4028
  condition: check
3896
- },
3897
-
3898
- mousewheel: {
3899
- base: (Browser.firefox) ? 'DOMMouseScroll' : 'mousewheel'
3900
- }
3901
-
3902
- };
4029
+ };
4030
+ }
3903
4031
 
3904
4032
  /*<ltIE9>*/
3905
4033
  if (!window.addEventListener){
@@ -3910,7 +4038,7 @@ if (!window.addEventListener){
3910
4038
  return (this.get('tag') == 'input' && (type == 'radio' || type == 'checkbox')) ? 'propertychange' : 'change'
3911
4039
  },
3912
4040
  condition: function(event){
3913
- return !!(this.type != 'radio' || this.checked);
4041
+ return this.type != 'radio' || (event.event.propertyName == 'checked' && this.checked);
3914
4042
  }
3915
4043
  }
3916
4044
  }
@@ -4611,12 +4739,31 @@ Fx.CSS = new Class({
4611
4739
 
4612
4740
  prepare: function(element, property, values){
4613
4741
  values = Array.from(values);
4614
- if (values[1] == null){
4615
- values[1] = values[0];
4616
- values[0] = element.getStyle(property);
4742
+ var from = values[0], to = values[1];
4743
+ if (to == null){
4744
+ to = from;
4745
+ from = element.getStyle(property);
4746
+ var unit = this.options.unit;
4747
+ // adapted from: https://github.com/ryanmorr/fx/blob/master/fx.js#L299
4748
+ if (unit && from.slice(-unit.length) != unit && parseFloat(from) != 0){
4749
+ element.setStyle(property, to + unit);
4750
+ var value = element.getComputedStyle(property);
4751
+ // IE and Opera support pixelLeft or pixelWidth
4752
+ if (!(/px$/.test(value))){
4753
+ value = element.style[('pixel-' + property).camelCase()];
4754
+ if (value == null){
4755
+ // adapted from Dean Edwards' http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
4756
+ var left = element.style.left;
4757
+ element.style.left = to + unit;
4758
+ value = element.style.pixelLeft;
4759
+ element.style.left = left;
4760
+ }
4761
+ }
4762
+ from = (to || 1) / (parseFloat(value) || 1) * (parseFloat(from) || 0);
4763
+ element.setStyle(property, from + unit);
4764
+ }
4617
4765
  }
4618
- var parsed = values.map(this.parse);
4619
- return {from: parsed[0], to: parsed[1]};
4766
+ return {from: this.parse(from), to: this.parse(to)};
4620
4767
  },
4621
4768
 
4622
4769
  //parses a value into an array
@@ -4804,27 +4951,29 @@ Element.implement({
4804
4951
  },
4805
4952
 
4806
4953
  fade: function(how){
4807
- var fade = this.get('tween'), method, to, toggle;
4808
- if (how == null) how = 'toggle';
4809
- switch (how){
4810
- case 'in': method = 'start'; to = 1; break;
4811
- case 'out': method = 'start'; to = 0; break;
4812
- case 'show': method = 'set'; to = 1; break;
4813
- case 'hide': method = 'set'; to = 0; break;
4954
+ var fade = this.get('tween'), method, args = ['opacity'].append(arguments), toggle;
4955
+ if (args[1] == null) args[1] = 'toggle';
4956
+ switch (args[1]){
4957
+ case 'in': method = 'start'; args[1] = 1; break;
4958
+ case 'out': method = 'start'; args[1] = 0; break;
4959
+ case 'show': method = 'set'; args[1] = 1; break;
4960
+ case 'hide': method = 'set'; args[1] = 0; break;
4814
4961
  case 'toggle':
4815
4962
  var flag = this.retrieve('fade:flag', this.getStyle('opacity') == 1);
4816
4963
  method = 'start';
4817
- to = flag ? 0 : 1;
4964
+ args[1] = flag ? 0 : 1;
4818
4965
  this.store('fade:flag', !flag);
4819
4966
  toggle = true;
4820
4967
  break;
4821
- default: method = 'start'; to = how;
4968
+ default: method = 'start';
4822
4969
  }
4823
4970
  if (!toggle) this.eliminate('fade:flag');
4824
- fade[method]('opacity', to);
4971
+ fade[method].apply(fade, args);
4972
+ var to = args[args.length - 1];
4825
4973
  if (method == 'set' || to != 0) this.setStyle('visibility', to == 0 ? 'hidden' : 'visible');
4826
4974
  else fade.chain(function(){
4827
4975
  this.element.setStyle('visibility', 'hidden');
4976
+ this.callChain();
4828
4977
  });
4829
4978
  return this;
4830
4979
  },
@@ -5249,7 +5398,7 @@ var Request = this.Request = new Class({
5249
5398
  this.fireEvent('request');
5250
5399
  xhr.send(data);
5251
5400
  if (!this.options.async) this.onStateChange();
5252
- if (this.options.timeout) this.timer = this.timeout.delay(this.options.timeout, this);
5401
+ else if (this.options.timeout) this.timer = this.timeout.delay(this.options.timeout, this);
5253
5402
  return this;
5254
5403
  },
5255
5404
 
@@ -5314,6 +5463,7 @@ Element.implement({
5314
5463
 
5315
5464
  })();
5316
5465
 
5466
+
5317
5467
  /*
5318
5468
  ---
5319
5469
 
@@ -5824,3 +5974,4 @@ Swiff.remote = function(obj, fn){
5824
5974
  };
5825
5975
 
5826
5976
  })();
5977
+