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

Changeset 8656

Show
Ignore:
Timestamp:
01/18/08 04:52:38 (9 months ago)
Author:
andrew
Message:

Fixed selector parsing so that "#foo [bar=baz]" is treated the same way as "#foo *[bar=baz]". Closes #10734. [jlukas, kangax, Andrew Dupont]

Files:

Legend:

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

    r8654 r8656  
    11*SVN* 
     2 
     3* Fixed selector parsing so that "#foo [bar=baz]" is treated the same way as "#foo *[bar=baz]". Closes #10734. [jlukas, kangax, Andrew Dupont] 
    24 
    35* Fix Element#descendantOf logic in IE. Closes #10413. [martymix, kamil.szot] 
  • spinoffs/prototype/trunk/src/selector.js

    r8580 r8656  
    242242   
    243243  criteria: { 
    244     tagName:      'n = h.tagName(n, r, "#{1}", c);   c = false;',   
    245     className:    'n = h.className(n, r, "#{1}", c); c = false;', 
    246     id:           'n = h.id(n, r, "#{1}", c);        c = false;', 
    247     attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;', 
     244    tagName:      'n = h.tagName(n, r, "#{1}", c);      c = false;',   
     245    className:    'n = h.className(n, r, "#{1}", c);    c = false;', 
     246    id:           'n = h.id(n, r, "#{1}", c);           c = false;', 
     247    attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;', 
    248248    attr: function(m) { 
    249249      m[3] = (m[5] || m[6]); 
    250       return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m); 
     250      return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m); 
    251251    }, 
    252252    pseudo: function(m) { 
     
    458458    },     
    459459     
    460     attrPresence: function(nodes, root, attr) { 
     460    attrPresence: function(nodes, root, attr, combinator) { 
    461461      if (!nodes) nodes = root.getElementsByTagName("*"); 
     462      if (nodes && combinator) nodes = this[combinator](nodes); 
    462463      var results = []; 
    463464      for (var i = 0, node; node = nodes[i]; i++) 
     
    466467    }, 
    467468     
    468     attr: function(nodes, root, attr, value, operator) { 
     469    attr: function(nodes, root, attr, value, operator, combinator) { 
    469470      if (!nodes) nodes = root.getElementsByTagName("*"); 
     471      if (nodes && combinator) nodes = this[combinator](nodes); 
    470472      var handler = Selector.operators[operator], results = []; 
    471473      for (var i = 0, node; node = nodes[i]; i++) { 
  • spinoffs/prototype/trunk/test/unit/selector.html

    r8580 r8656  
    185185      assertEnumEqual($$('*[type=checkbox]'), $$('[type=checkbox]')); 
    186186      assertEnumEqual($('with_title', 'commaParent'), $$('[title]')); 
     187      assertEnumEqual($$('#troubleForm *[type=radio]'), $$('#troubleForm [type=radio]')); 
     188      assertEnumEqual($$('#troubleForm *[type]'), $$('#troubleForm [type]')); 
    187189    }}, 
    188190