lsd_rails 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/Packages/art/Source/ART.Path.js +1 -1
  2. data/Packages/art/Source/ART.SVG.js +4 -3
  3. data/Packages/art/Source/ART.VML.js +8 -2
  4. data/Packages/mootools-core/Docs/Browser/Browser.md +1 -1
  5. data/Packages/mootools-core/Docs/Core/Core.md +1 -1
  6. data/Packages/{mootools-more → mootools-core}/Docs/Element/Element.Delegation.md +58 -38
  7. data/Packages/mootools-core/Docs/Element/Element.md +5 -5
  8. data/Packages/mootools-core/Docs/Fx/Fx.Morph.md +5 -1
  9. data/Packages/mootools-core/Docs/Intro.md +3 -1
  10. data/Packages/mootools-core/Docs/Request/Request.HTML.md +3 -3
  11. data/Packages/mootools-core/Docs/Request/Request.JSON.md +1 -1
  12. data/Packages/mootools-core/Docs/Request/Request.md +12 -12
  13. data/Packages/mootools-core/Docs/Slick/Slick.md +318 -0
  14. data/Packages/mootools-core/Docs/Types/{Event.md → DOMEvent.md} +37 -27
  15. data/Packages/mootools-core/Docs/Types/Function.md +2 -2
  16. data/Packages/mootools-core/Docs/Types/String.md +4 -4
  17. data/Packages/mootools-core/Source/Class/Class.Extras.js +1 -1
  18. data/Packages/mootools-core/Source/Core/Core.js +3 -3
  19. data/Packages/mootools-core/Source/Element/Element.Delegation.js +198 -0
  20. data/Packages/mootools-core/Source/Element/Element.Dimensions.js +1 -2
  21. data/Packages/mootools-core/Source/Element/Element.Event.js +22 -7
  22. data/Packages/mootools-core/Source/Element/Element.Style.js +65 -50
  23. data/Packages/mootools-core/Source/Element/Element.js +289 -200
  24. data/Packages/mootools-core/Source/Fx/Fx.Tween.js +16 -10
  25. data/Packages/mootools-core/Source/Fx/Fx.js +6 -6
  26. data/Packages/mootools-core/Source/Request/Request.js +7 -7
  27. data/Packages/mootools-core/Source/Slick/Slick.Finder.js +23 -10
  28. data/Packages/mootools-core/Source/Types/Array.js +7 -7
  29. data/Packages/mootools-core/Source/Types/DOMEvent.js +125 -0
  30. data/Packages/mootools-core/Source/Types/Function.js +20 -10
  31. data/Packages/mootools-core/Source/Types/String.js +10 -10
  32. data/Packages/mootools-core/Source/Utilities/DOMReady.js +2 -2
  33. data/Packages/mootools-core/build +0 -2
  34. data/Packages/mootools-core/package.yml +2 -1
  35. data/Packages/mootools-more/Docs/Element/Element.Event.Pseudos.md +9 -9
  36. data/Packages/mootools-more/Docs/Forms/Form.Validator.md +20 -4
  37. data/Packages/mootools-more/Docs/Interface/HtmlTable.md +19 -0
  38. data/Packages/mootools-more/Docs/Interface/Tips.md +2 -2
  39. data/Packages/mootools-more/Docs/Types/Number.Format.md +10 -2
  40. data/Packages/mootools-more/Source/Class/Events.Pseudos.js +39 -62
  41. data/Packages/mootools-more/Source/Element/Element.Event.Pseudos.Keys.js +24 -25
  42. data/Packages/mootools-more/Source/Element/Element.Event.Pseudos.js +5 -5
  43. data/Packages/mootools-more/Source/Forms/Form.Validator.js +14 -2
  44. data/Packages/mootools-more/Source/Forms/OverText.js +0 -1
  45. data/Packages/mootools-more/Source/Interface/HtmlTable.js +21 -14
  46. data/Packages/mootools-more/Source/Locale/Locale.en-US.Form.Validator.js +1 -0
  47. data/Packages/mootools-more/Source/Locale/Locale.fr-FR.Form.Validator.js +1 -0
  48. data/Packages/mootools-more/Source/Locale/Locale.nl-NL.Form.Validator.js +1 -0
  49. data/Packages/mootools-more/Source/More/More.js +2 -2
  50. data/Packages/mootools-more/Source/Types/Date.js +2 -1
  51. data/Packages/mootools-more/Source/Types/Number.Format.js +6 -4
  52. data/Packages/mootools-more/Source/Utilities/Group.js +17 -23
  53. data/Packages/mootools-more/Tests/Interactive/Drag/Drag.Move_(container).html +2 -2
  54. data/Packages/mootools-more/Tests/Interactive/Element/Element.Event.Pseudos.html +10 -10
  55. data/Packages/mootools-more/Tests/Interactive/Interface/HtmlTable_(id).html +15 -4
  56. data/Packages/mootools-more/Tests/Interactive/Interface/HtmlTable_(zebra).html +4 -1
  57. data/Packages/mootools-more/Tests/Interactive/Interface/Keyboard_(nested).html +19 -26
  58. data/Packages/mootools-more/Tests/Interactive/Interface/Keyboard_(single).html +21 -24
  59. data/Packages/mootools-more/Tests/Specs/1.3/Class/Events.Pseudos.js +7 -154
  60. data/Packages/mootools-more/Tests/Specs/1.3/Element/Element.Delegation.js +2 -4
  61. data/Packages/mootools-more/Tests/Specs/1.3/Element/Element.Event.Pseudos.js +13 -21
  62. data/Packages/mootools-more/Tests/Specs/1.3/Forms/Form.Validator.js +14 -0
  63. data/Packages/mootools-more/Tests/Specs/1.3/Interface/HtmlTable.js +29 -14
  64. data/Packages/mootools-more/Tests/Specs/1.3/Types/Date.js +1 -0
  65. data/Packages/mootools-more/Tests/Specs/1.3/Types/Number.Format.js +4 -1
  66. data/Packages/mootools-more/Tests/Specs/Configuration.js +136 -4
  67. data/Packages/mootools-more/package.yml +0 -1
  68. data/lib/lsd/railtie.rb +2 -2
  69. data/lib/lsd/widget_generator.rb +1 -1
  70. metadata +32 -39
  71. data/Packages/mootools-core/Source/Types/Event.js +0 -135
  72. data/Packages/mootools-more/Source/Element/Element.Delegation.js +0 -140
@@ -7,7 +7,7 @@ description: One of the most important items in MooTools. Contains the dollar fu
7
7
 
8
8
  license: MIT-style license.
9
9
 
10
- requires: [Window, Document, Array, String, Function, Number, Slick.Parser, Slick.Finder]
10
+ requires: [Window, Document, Array, String, Function, Object, Number, Slick.Parser, Slick.Finder]
11
11
 
12
12
  provides: [Element, Elements, $, $$, Iframe, Selectors]
13
13
 
@@ -180,9 +180,9 @@ var splice = Array.prototype.splice, object = {'0': 0, '1': 1, length: 2};
180
180
  splice.call(object, 1, 1);
181
181
  if (object[1] == 1) Elements.implement('splice', function(){
182
182
  var length = this.length;
183
- splice.apply(this, arguments);
183
+ var result = splice.apply(this, arguments);
184
184
  while (length >= this.length) delete this[length--];
185
- return this;
185
+ return result;
186
186
  }.protect());
187
187
 
188
188
  Elements.implement(Array.prototype);
@@ -302,8 +302,19 @@ Window.implement({
302
302
 
303
303
  });
304
304
 
305
+ var contains = {contains: function(element){
306
+ return Slick.contains(this, element);
307
+ }};
308
+
309
+ if (!document.contains) Document.implement(contains);
310
+ if (!document.createElement('div').contains) Element.implement(contains);
311
+
305
312
  //<1.2compat>
306
313
 
314
+ Element.implement('hasChild', function(element){
315
+ return this !== element && this.contains(element);
316
+ });
317
+
307
318
  (function(search, find, match){
308
319
 
309
320
  this.Selectors = {};
@@ -333,6 +344,74 @@ Window.implement({
333
344
 
334
345
  })(Slick.search, Slick.find, Slick.match);
335
346
 
347
+ //</1.2compat>
348
+
349
+ // tree walking
350
+
351
+ var injectCombinator = function(expression, combinator){
352
+ if (!expression) return combinator;
353
+
354
+ expression = Object.clone(Slick.parse(expression));
355
+
356
+ var expressions = expression.expressions;
357
+ for (var i = expressions.length; i--;)
358
+ expressions[i][0].combinator = combinator;
359
+
360
+ return expression;
361
+ };
362
+
363
+ Object.forEach({
364
+ getNext: '~',
365
+ getPrevious: '!~',
366
+ getParent: '!'
367
+ }, function(combinator, method){
368
+ Element.implement(method, function(expression){
369
+ return this.getElement(injectCombinator(expression, combinator));
370
+ });
371
+ });
372
+
373
+ Object.forEach({
374
+ getAllNext: '~',
375
+ getAllPrevious: '!~',
376
+ getSiblings: '~~',
377
+ getChildren: '>',
378
+ getParents: '!'
379
+ }, function(combinator, method){
380
+ Element.implement(method, function(expression){
381
+ return this.getElements(injectCombinator(expression, combinator));
382
+ });
383
+ });
384
+
385
+ Element.implement({
386
+
387
+ getFirst: function(expression){
388
+ return document.id(Slick.search(this, injectCombinator(expression, '>'))[0]);
389
+ },
390
+
391
+ getLast: function(expression){
392
+ return document.id(Slick.search(this, injectCombinator(expression, '>')).getLast());
393
+ },
394
+
395
+ getWindow: function(){
396
+ return this.ownerDocument.window;
397
+ },
398
+
399
+ getDocument: function(){
400
+ return this.ownerDocument;
401
+ },
402
+
403
+ getElementById: function(id){
404
+ return document.id(Slick.find(this, '#' + ('' + id).replace(/(\W)/g, '\\$1')));
405
+ },
406
+
407
+ match: function(expression){
408
+ return !expression || Slick.match(this, expression);
409
+ }
410
+
411
+ });
412
+
413
+ //<1.2compat>
414
+
336
415
  if (window.$$ == null) Window.implement('$$', function(selector){
337
416
  var elements = new Elements;
338
417
  if (arguments.length == 1 && typeof selector == 'string') return Slick.search(this.document, selector, elements);
@@ -359,48 +438,7 @@ if (window.$$ == null) Window.implement('$$', function(selector){
359
438
 
360
439
  (function(){
361
440
 
362
- var collected = {}, storage = {};
363
- var formProps = {input: 'checked', option: 'selected', textarea: 'value'};
364
-
365
- var get = function(uid){
366
- return (storage[uid] || (storage[uid] = {}));
367
- };
368
-
369
- var clean = function(item){
370
- var uid = item.uid;
371
- if (item.removeEvents) item.removeEvents();
372
- if (item.clearAttributes) item.clearAttributes();
373
- if (uid != null){
374
- delete collected[uid];
375
- delete storage[uid];
376
- }
377
- return item;
378
- };
379
-
380
- var camels = ['defaultValue', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan', 'frameBorder', 'maxLength', 'readOnly',
381
- 'rowSpan', 'tabIndex', 'useMap'
382
- ];
383
- var bools = ['compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked', 'disabled', 'readOnly', 'multiple', 'selected',
384
- 'noresize', 'defer', 'defaultChecked'
385
- ];
386
- var attributes = {
387
- 'html': 'innerHTML',
388
- 'class': 'className',
389
- 'for': 'htmlFor',
390
- 'text': (function(){
391
- var temp = document.createElement('div');
392
- return (temp.textContent == null) ? 'innerText' : 'textContent';
393
- })()
394
- };
395
- var readOnly = ['type'];
396
- var expandos = ['value', 'defaultValue'];
397
- var uriAttrs = /^(?:href|src|usemap)$/i;
398
-
399
- bools = bools.associate(bools);
400
- camels = camels.associate(camels.map(String.toLowerCase));
401
- readOnly = readOnly.associate(readOnly);
402
-
403
- Object.append(attributes, expandos.associate(expandos));
441
+ // Inserters
404
442
 
405
443
  var inserters = {
406
444
 
@@ -450,42 +488,92 @@ Object.each(inserters, function(inserter, where){
450
488
 
451
489
  //</1.2compat>
452
490
 
453
- var injectCombinator = function(expression, combinator){
454
- if (!expression) return combinator;
491
+ // getProperty / setProperty
455
492
 
456
- expression = Object.clone(Slick.parse(expression));
493
+ var propertyGetters = {}, propertySetters = {};
457
494
 
458
- var expressions = expression.expressions;
459
- for (var i = expressions.length; i--;)
460
- expressions[i][0].combinator = combinator;
495
+ // properties
461
496
 
462
- return expression;
463
- };
497
+ var properties = {};
498
+ Array.forEach([
499
+ 'type', 'value', 'defaultValue', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan',
500
+ 'frameBorder', 'readOnly', 'rowSpan', 'tabIndex', 'useMap'
501
+ ], function(property){
502
+ properties[property.toLowerCase()] = property;
503
+ });
464
504
 
465
- Element.implement({
505
+ Object.append(properties, {
506
+ 'html': 'innerHTML',
507
+ 'text': (function(){
508
+ var temp = document.createElement('div');
509
+ return (temp.textContent == null) ? 'innerText': 'textContent';
510
+ })()
511
+ });
466
512
 
467
- set: function(prop, value){
468
- var property = Element.Properties[prop];
469
- (property && property.set) ? property.set.call(this, value) : this.setProperty(prop, value);
470
- }.overloadSetter(),
513
+ Object.forEach(properties, function(real, key){
514
+ propertySetters[key] = function(node, value){
515
+ node[real] = value;
516
+ };
517
+ propertyGetters[key] = function(node){
518
+ return node[real];
519
+ };
520
+ });
471
521
 
472
- get: function(prop){
473
- var property = Element.Properties[prop];
474
- return (property && property.get) ? property.get.apply(this) : this.getProperty(prop);
475
- }.overloadGetter(),
522
+ // Booleans
476
523
 
477
- erase: function(prop){
478
- var property = Element.Properties[prop];
479
- (property && property.erase) ? property.erase.apply(this) : this.removeProperty(prop);
480
- return this;
524
+ var bools = [
525
+ 'compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked',
526
+ 'disabled', 'readOnly', 'multiple', 'selected', 'noresize',
527
+ 'defer', 'defaultChecked', 'autofocus', 'controls', 'autoplay',
528
+ 'loop'
529
+ ];
530
+
531
+ var booleans = {};
532
+ Array.forEach(bools, function(bool){
533
+ var lower = bool.toLowerCase();
534
+ booleans[lower] = bool;
535
+ propertySetters[lower] = function(node, value){
536
+ node[bool] = !!value;
537
+ };
538
+ propertyGetters[lower] = function(node){
539
+ return !!node[bool];
540
+ };
541
+ });
542
+
543
+ // Special cases
544
+
545
+ Object.append(propertySetters, {
546
+
547
+ 'class': function(node, value){
548
+ ('className' in node) ? node.className = value : node.setAttribute('class', value);
481
549
  },
482
550
 
483
- setProperty: function(attribute, value){
484
- attribute = camels[attribute] || attribute;
485
- if (value == null) return this.removeProperty(attribute);
486
- var key = attributes[attribute];
487
- (key) ? this[key] = value :
488
- (bools[attribute]) ? this[attribute] = !!value : this.setAttribute(attribute, '' + value);
551
+ 'for': function(node, value){
552
+ ('htmlFor' in node) ? node.htmlFor = value : node.setAttribute('for', value);
553
+ },
554
+
555
+ 'style': function(node, value){
556
+ (node.style) ? node.style.cssText = value : node.setAttribute('style', value);
557
+ }
558
+
559
+ });
560
+
561
+ /* getProperty, setProperty */
562
+
563
+ Element.implement({
564
+
565
+ setProperty: function(name, value){
566
+ var lower = name.toLowerCase();
567
+ if (value == null){
568
+ if (!booleans[lower]){
569
+ this.removeAttribute(name);
570
+ return this;
571
+ }
572
+ value = false;
573
+ }
574
+ var setter = propertySetters[lower];
575
+ if (setter) setter(this, value);
576
+ else this.setAttribute(name, value);
489
577
  return this;
490
578
  },
491
579
 
@@ -494,13 +582,11 @@ Element.implement({
494
582
  return this;
495
583
  },
496
584
 
497
- getProperty: function(attribute){
498
- attribute = camels[attribute] || attribute;
499
- var key = attributes[attribute] || readOnly[attribute];
500
- return (key) ? this[key] :
501
- (bools[attribute]) ? !!this[attribute] :
502
- (uriAttrs.test(attribute) ? this.getAttribute(attribute, 2) :
503
- (key = this.getAttributeNode(attribute)) ? key.nodeValue : null) || null;
585
+ getProperty: function(name){
586
+ var getter = propertyGetters[name.toLowerCase()];
587
+ if (getter) return getter(this);
588
+ var result = Slick.getAttribute(this, name);
589
+ return (!result && !Slick.hasAttribute(this, name)) ? null : result;
504
590
  },
505
591
 
506
592
  getProperties: function(){
@@ -508,12 +594,8 @@ Element.implement({
508
594
  return args.map(this.getProperty, this).associate(args);
509
595
  },
510
596
 
511
- removeProperty: function(attribute){
512
- attribute = camels[attribute] || attribute;
513
- var key = attributes[attribute];
514
- (key) ? this[key] = '' :
515
- (bools[attribute]) ? this[attribute] = false : this.removeAttribute(attribute);
516
- return this;
597
+ removeProperty: function(name){
598
+ return this.setProperty(name, null);
517
599
  },
518
600
 
519
601
  removeProperties: function(){
@@ -521,6 +603,22 @@ Element.implement({
521
603
  return this;
522
604
  },
523
605
 
606
+ set: function(prop, value){
607
+ var property = Element.Properties[prop];
608
+ (property && property.set) ? property.set.call(this, value) : this.setProperty(prop, value);
609
+ }.overloadSetter(),
610
+
611
+ get: function(prop){
612
+ var property = Element.Properties[prop];
613
+ return (property && property.get) ? property.get.apply(this) : this.getProperty(prop);
614
+ }.overloadGetter(),
615
+
616
+ erase: function(prop){
617
+ var property = Element.Properties[prop];
618
+ (property && property.erase) ? property.erase.apply(this) : this.removeProperty(prop);
619
+ return this;
620
+ },
621
+
524
622
  hasClass: function(className){
525
623
  return this.className.clean().contains(className, ' ');
526
624
  },
@@ -579,58 +677,6 @@ Element.implement({
579
677
  return this.replaces(el).grab(el, where);
580
678
  },
581
679
 
582
- getPrevious: function(expression){
583
- return document.id(Slick.find(this, injectCombinator(expression, '!~')));
584
- },
585
-
586
- getAllPrevious: function(expression){
587
- return Slick.search(this, injectCombinator(expression, '!~'), new Elements);
588
- },
589
-
590
- getNext: function(expression){
591
- return document.id(Slick.find(this, injectCombinator(expression, '~')));
592
- },
593
-
594
- getAllNext: function(expression){
595
- return Slick.search(this, injectCombinator(expression, '~'), new Elements);
596
- },
597
-
598
- getFirst: function(expression){
599
- return document.id(Slick.search(this, injectCombinator(expression, '>'))[0]);
600
- },
601
-
602
- getLast: function(expression){
603
- return document.id(Slick.search(this, injectCombinator(expression, '>')).getLast());
604
- },
605
-
606
- getParent: function(expression){
607
- return document.id(Slick.find(this, injectCombinator(expression, '!')));
608
- },
609
-
610
- getParents: function(expression){
611
- return Slick.search(this, injectCombinator(expression, '!'), new Elements);
612
- },
613
-
614
- getSiblings: function(expression){
615
- return Slick.search(this, injectCombinator(expression, '~~'), new Elements);
616
- },
617
-
618
- getChildren: function(expression){
619
- return Slick.search(this, injectCombinator(expression, '>'), new Elements);
620
- },
621
-
622
- getWindow: function(){
623
- return this.ownerDocument.window;
624
- },
625
-
626
- getDocument: function(){
627
- return this.ownerDocument;
628
- },
629
-
630
- getElementById: function(id){
631
- return document.id(Slick.find(this, '#' + ('' + id).replace(/(\W)/g, '\\$1')));
632
- },
633
-
634
680
  getSelected: function(){
635
681
  this.selectedIndex; // Safari 3.2.1
636
682
  return new Elements(Array.from(this.options).filter(function(option){
@@ -654,7 +700,30 @@ Element.implement({
654
700
  });
655
701
  });
656
702
  return queryString.join('&');
657
- },
703
+ }
704
+
705
+ });
706
+
707
+ var collected = {}, storage = {};
708
+
709
+ var get = function(uid){
710
+ return (storage[uid] || (storage[uid] = {}));
711
+ };
712
+
713
+ var clean = function(item){
714
+ var uid = item.uid;
715
+ if (item.removeEvents) item.removeEvents();
716
+ if (item.clearAttributes) item.clearAttributes();
717
+ if (uid != null){
718
+ delete collected[uid];
719
+ delete storage[uid];
720
+ }
721
+ return item;
722
+ };
723
+
724
+ var formProps = {input: 'checked', option: 'selected', textarea: 'value'};
725
+
726
+ Element.implement({
658
727
 
659
728
  destroy: function(){
660
729
  var children = clean(this).getElementsByTagName('*');
@@ -672,61 +741,44 @@ Element.implement({
672
741
  return (this.parentNode) ? this.parentNode.removeChild(this) : this;
673
742
  },
674
743
 
675
- match: function(expression){
676
- return !expression || Slick.match(this, expression);
677
- }
678
-
679
- });
744
+ clone: function(contents, keepid){
745
+ contents = contents !== false;
746
+ var clone = this.cloneNode(contents), ce = [clone], te = [this], i;
680
747
 
681
- var cleanClone = function(node, element, keepid){
682
- if (!keepid) node.setAttributeNode(document.createAttribute('id'));
683
- if (node.clearAttributes){
684
- node.clearAttributes();
685
- node.mergeAttributes(element);
686
- node.removeAttribute('uid');
687
- if (node.options){
688
- var no = node.options, eo = element.options;
689
- for (var i = no.length; i--;) no[i].selected = eo[i].selected;
748
+ if (contents){
749
+ ce.append(Array.from(clone.getElementsByTagName('*')));
750
+ te.append(Array.from(this.getElementsByTagName('*')));
690
751
  }
691
- }
692
752
 
693
- var prop = formProps[element.tagName.toLowerCase()];
694
- if (prop && element[prop]) node[prop] = element[prop];
695
- };
696
-
697
- Element.implement('clone', function(contents, keepid){
698
- contents = contents !== false;
699
- var clone = this.cloneNode(contents), i;
753
+ for (i = ce.length; i--;){
754
+ var node = ce[i], element = te[i];
755
+ if (!keepid) node.removeAttribute('id');
756
+ /*<ltIE9>*/
757
+ if (node.clearAttributes){
758
+ node.clearAttributes();
759
+ node.mergeAttributes(element);
760
+ node.removeAttribute('uid');
761
+ if (node.options){
762
+ var no = node.options, eo = element.options;
763
+ for (var j = no.length; j--;) no[j].selected = eo[j].selected;
764
+ }
765
+ }
766
+ /*</ltIE9>*/
767
+ var prop = formProps[element.tagName.toLowerCase()];
768
+ if (prop && element[prop]) node[prop] = element[prop];
769
+ }
700
770
 
701
- if (contents){
702
- var ce = clone.getElementsByTagName('*'), te = this.getElementsByTagName('*');
703
- for (i = ce.length; i--;) cleanClone(ce[i], te[i], keepid);
771
+ /*<ltIE9>*/
772
+ if (Browser.ie){
773
+ var co = clone.getElementsByTagName('object'), to = this.getElementsByTagName('object');
774
+ for (i = co.length; i--;) co[i].outerHTML = to[i].outerHTML;
775
+ }
776
+ /*</ltIE9>*/
777
+ return document.id(clone);
704
778
  }
705
779
 
706
- cleanClone(clone, this, keepid);
707
-
708
- if (Browser.ie){
709
- var co = clone.getElementsByTagName('object'), to = this.getElementsByTagName('object');
710
- for (i = co.length; i--;) co[i].outerHTML = to[i].outerHTML;
711
- }
712
- return document.id(clone);
713
780
  });
714
781
 
715
- var contains = {contains: function(element){
716
- return Slick.contains(this, element);
717
- }};
718
-
719
- if (!document.contains) Document.implement(contains);
720
- if (!document.createElement('div').contains) Element.implement(contains);
721
-
722
- //<1.2compat>
723
-
724
- Element.implement('hasChild', function(element){
725
- return this !== element && this.contains(element);
726
- });
727
-
728
- //</1.2compat>
729
-
730
782
  [Element, Window, Document].invoke('implement', {
731
783
 
732
784
  addListener: function(type, fn){
@@ -777,8 +829,6 @@ if (window.attachEvent && !window.addEventListener) window.addListener('unload',
777
829
  });
778
830
  /*</ltIE9>*/
779
831
 
780
- })();
781
-
782
832
  Element.Properties = {};
783
833
 
784
834
  //<1.2compat>
@@ -811,17 +861,6 @@ Element.Properties.tag = {
811
861
 
812
862
  };
813
863
 
814
- /*<ltIE9>*/
815
- (function(maxLength){
816
- if (maxLength != null) Element.Properties.maxlength = Element.Properties.maxLength = {
817
- get: function(){
818
- var maxlength = this.getAttribute('maxLength');
819
- return maxlength == maxLength ? null : maxlength;
820
- }
821
- };
822
- })(document.createElement('input').getAttribute('maxLength'));
823
- /*</ltIE9>*/
824
-
825
864
  /*<!webkit>*/
826
865
  Element.Properties.html = (function(){
827
866
 
@@ -840,10 +879,26 @@ Element.Properties.html = (function(){
840
879
  };
841
880
  translations.thead = translations.tfoot = translations.tbody;
842
881
 
882
+ /*<ltIE9>*/
883
+ // technique by jdbarlett - http://jdbartlett.com/innershiv/
884
+ wrapper.innerHTML = '<nav></nav>';
885
+ var HTML5Test = wrapper.childNodes.length == 1;
886
+ if (!HTML5Test){
887
+ var tags = 'abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' '),
888
+ fragment = document.createDocumentFragment(), l = tags.length;
889
+ while (l--) fragment.createElement(tags[l]);
890
+ fragment.appendChild(wrapper);
891
+ }
892
+ /*</ltIE9>*/
893
+
843
894
  var html = {
844
- set: function(){
845
- var html = Array.flatten(arguments).join('');
895
+ set: function(html){
896
+ if (typeOf(html) == 'array') html = html.join('');
897
+
846
898
  var wrap = (!tableTest && translations[this.get('tag')]);
899
+ /*<ltIE9>*/
900
+ if (!wrap && !HTML5Test) wrap = [0, '', ''];
901
+ /*</ltIE9>*/
847
902
  if (wrap){
848
903
  var first = wrapper;
849
904
  first.innerHTML = wrap[1] + html + wrap[2];
@@ -860,3 +915,37 @@ Element.Properties.html = (function(){
860
915
  return html;
861
916
  })();
862
917
  /*</!webkit>*/
918
+
919
+ /*<ltIE9>*/
920
+ var testForm = document.createElement('form');
921
+ testForm.innerHTML = '<select><option>s</option></select>';
922
+
923
+ if (testForm.firstChild.value != 's') Element.Properties.value = {
924
+
925
+ set: function(value){
926
+ var tag = this.get('tag');
927
+ if (tag != 'select') return this.setProperty('value', value);
928
+ var options = this.getElements('option');
929
+ for (var i = 0; i < options.length; i++){
930
+ var option = options[i],
931
+ attr = option.getAttributeNode('value'),
932
+ optionValue = (attr && attr.specified) ? option.value : option.get('text');
933
+ if (optionValue == value) return option.selected = true;
934
+ }
935
+ },
936
+
937
+ get: function(){
938
+ var option = this, tag = option.get('tag');
939
+
940
+ if (tag != 'select' && tag != 'option') return this.getProperty('value');
941
+
942
+ if (tag == 'select' && !(option = option.getSelected()[0])) return '';
943
+
944
+ var attr = option.getAttributeNode('value');
945
+ return (attr && attr.specified) ? option.value : option.get('text');
946
+ }
947
+
948
+ };
949
+ /*</ltIE9>*/
950
+
951
+ })();
@@ -63,27 +63,33 @@ Element.Properties.tween = {
63
63
  Element.implement({
64
64
 
65
65
  tween: function(property, from, to){
66
- this.get('tween').start(arguments);
66
+ this.get('tween').start(property, from, to);
67
67
  return this;
68
68
  },
69
69
 
70
70
  fade: function(how){
71
- var fade = this.get('tween'), o = 'opacity', toggle;
72
- how = [how, 'toggle'].pick();
71
+ var fade = this.get('tween'), method, to, toggle;
72
+ if (how == null) how = 'toggle';
73
73
  switch (how){
74
- case 'in': fade.start(o, 1); break;
75
- case 'out': fade.start(o, 0); break;
76
- case 'show': fade.set(o, 1); break;
77
- case 'hide': fade.set(o, 0); break;
74
+ case 'in': method = 'start'; to = 1; break;
75
+ case 'out': method = 'start'; to = 0; break;
76
+ case 'show': method = 'set'; to = 1; break;
77
+ case 'hide': method = 'set'; to = 0; break;
78
78
  case 'toggle':
79
- var flag = this.retrieve('fade:flag', this.get('opacity') == 1);
80
- fade.start(o, (flag) ? 0 : 1);
79
+ var flag = this.retrieve('fade:flag', this.getStyle('opacity') == 1);
80
+ method = 'start';
81
+ to = flag ? 0 : 1;
81
82
  this.store('fade:flag', !flag);
82
83
  toggle = true;
83
84
  break;
84
- default: fade.start(o, arguments);
85
+ default: method = 'start'; to = how;
85
86
  }
86
87
  if (!toggle) this.eliminate('fade:flag');
88
+ fade[method]('opacity', to);
89
+ if (method == 'set' || to != 0) this.setStyle('visibility', to == 0 ? 'hidden' : 'visible');
90
+ else fade.chain(function(){
91
+ this.element.setStyle('visibility', 'hidden');
92
+ });
87
93
  return this;
88
94
  },
89
95