Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8580

Show
Ignore:
Timestamp:
01/06/08 21:49:16 (9 months ago)
Author:
tobie
Message:

prototype: Fix Selector.matchElements to allow for coma-separated selectors in Element#up/next/previous and Event#findElement.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spinoffs/prototype/trunk/CHANGELOG

    r8572 r8580  
    11*SVN* 
     2* Fix Selector.matchElements to allow for coma-separated selectors in Element#up/next/previous and Event#findElement. [Samuel Lebeau, Tobie Langel] 
    23 
    34* Test.Unit refactoring. Allow running multiple instances of Test.Unit.Runner on the same page. Allow rake to run specific testcases (e.g.: rake test BROWSERS=firefox TESTS=array TESTCASES=testUniq,test$w). Closes #10704, #10705, #10706. [nicwilliams, Tobie Langel] 
  • spinoffs/prototype/trunk/src/selector.js

    r8449 r8580  
    619619 
    620620  matchElements: function(elements, expression) { 
    621     var matches = new Selector(expression).findElements(), h = Selector.handlers; 
     621    var matches = $$(expression), h = Selector.handlers; 
    622622    h.mark(matches); 
    623623    for (var i = 0, results = [], element; element = elements[i]; i++) 
  • spinoffs/prototype/trunk/test/lib/unittest.js

    r8574 r8580  
    446446  initialize: function(name, test, setup, teardown) { 
    447447    this.name           = name; 
    448     this.test           = test || Prototype.emptyFunction; 
    449     this.setup          = setup || Prototype.emptyFunction; 
     448    this.test           = test     || Prototype.emptyFunction; 
     449    this.setup          = setup    || Prototype.emptyFunction; 
    450450    this.teardown       = teardown || Prototype.emptyFunction; 
    451451    this.messages       = []; 
  • spinoffs/prototype/trunk/test/unit/dom.html

    r8572 r8580  
    943943      assertEqual(undefined, element.up('garbage')); 
    944944      assertEqual(undefined, element.up(6)); 
     945      assertElementMatches(element.up('.non-existant, ul'), 'ul'); 
    945946       
    946947      var dummy = $(document.createElement('DIV')); 
     
    956957      assertElementMatches(element.down('li', 5), 'li.last'); 
    957958      assertElementMatches(element.down('ul').down('li', 1), 'li#navigation_test_f'); 
     959      assertElementMatches(element.down('.non-existant, .first'), 'li.first'); 
    958960       
    959961      var dummy = $(document.createElement('DIV')); 
     
    969971      assertEqual(undefined, element.previous(3)); 
    970972      assertEqual(undefined, $('navigation_test').down().previous()); 
     973      assertElementMatches(element.previous('.non-existant, .first'), 'li.first'); 
    971974       
    972975      var dummy = $(document.createElement('DIV')); 
     
    983986      assertEqual(undefined, element.next(3)); 
    984987      assertEqual(undefined, element.next(2).next()); 
     988      assertElementMatches(element.next('.non-existant, .last'), 'li.last'); 
    985989       
    986990      var dummy = $(document.createElement('DIV')); 
  • spinoffs/prototype/trunk/test/unit/event.html

    r8572 r8580  
    236236      var span = $("span"), event; 
    237237      event = span.fire("test:somethingHappened"); 
    238       assertEqual(span, event.findElement()); 
    239       assertEqual(span, event.findElement('span')); 
    240       assertEqual($("inner"), event.findElement('p')); 
     238      assertElementMatches(event.findElement(), 'span#span'); 
     239      assertElementMatches(event.findElement('span'), 'span#span'); 
     240      assertElementMatches(event.findElement('p'), 'p#inner'); 
    241241      assertEqual(null, event.findElement('div.does_not_exist')); 
     242      assertElementMatches(event.findElement('.does_not_exist, span'), 'span#span'); 
    242243    }} 
    243      
    244      
    245244  }); 
    246245 
  • spinoffs/prototype/trunk/test/unit/selector.html

    r8572 r8580  
    216216      assertElementsMatch(Selector.matchElements($('fixtures').descendants(), 'a.internal'), '#link_1', '#link_2'); 
    217217      assertEnumEqual([], Selector.matchElements($('fixtures').descendants(), 'p.last')); 
     218      assertElementsMatch(Selector.matchElements($('fixtures').descendants(), '.inexistant, a.internal'), '#link_1', '#link_2'); 
    218219    }}, 
    219220