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

Ticket #8957 (new defect)

Opened 10 months ago

Last modified 1 month ago

[TEST] some selector issues

Reported by: mila76 Assigned to: sam
Priority: normal Milestone: 2.x
Component: Prototype Version: edge
Severity: minor Keywords: $$, selector
Cc:

Description

Today i'm playing with slickspeed and prototype and i have found this issue with nonXpath selectors (IE??)

some selector is slow. all slow trouble is related to extend function like:
unique: results.push(Element.extend(n));
use of Element.nextElementSiblings, Element.descendantOf, Element.hasAttribute, Element.readAttribute..
I agree not all is "elegant" fixable but someone affect some important selector like: * and div[class]

nth-child selector is all bugged (i'm not sure for fix)

h.mark(nodes);
for (var i = 0, node; node = nodes[i]; i++) {
 if (!node.parentNode._counted) {
   h.index(node.parentNode, reverse, ofType);
   indexed.push(node.parentNode);
 }
}

first mark all nodes with _counted "flag" and later check if is false?? (only first parentNode is false)...
commentend mark funcition fix returned count element (but slow down)

div ~ div selector is sloow :( (i can't understand why... i think too many not unique result?)

Attachments

selector_tests_updated.diff (3.2 kB) - added by jdalton on 04/01/08 18:01:48.
Updated selector tests with current git repo revision (1c00700 git is ridiculous)
odd_even.patch (2.7 kB) - added by mila76 on 04/02/08 16:19:49.
unit test for even/odd/contains and some other selectors

Change History

07/11/07 21:55:56 changed by mila76

with fix on extend function on my test: * 172 ms -> 8 ms div ~ div 567 ms -> 328 ms div[class] 86 ms -> 27 ms

Total: 2357 ms -> 1791 ms

my test version XPath is disabled, so i can view bugs in firefox too

07/12/07 06:50:46 changed by mila76

i'm wrong on unique function... element.extend is necessary
i fixed test version

01/18/08 23:06:50 changed by mila76

  • severity changed from normal to minor.
  • summary changed from some Selector issue to some Selector issues.

forget my brainstorming on speed...

I'have added a patch for the unit test: add nth-child(even) and nth-child(odd) tests Run ok on firefox (Xpath) error on IE

Plus another test on 'contains()'

01/23/08 21:22:22 changed by mila76

  • keywords set to $$, selector.
  • summary changed from some Selector issues to [TEST] some selector issues.

01/30/08 03:58:38 changed by Tobie

There seems to be a lot of different issues mixed up here. Would you mind opening tickets on a per issue basis against the lates trunk ? that would be really helpful. Thanks!

01/30/08 13:00:49 changed by mila76

nth problem already have another ticket #10010 the problem with "span.1" too #10315 the problem with #p > #p too #10008

i add this bugs on my test patch for contains problem i'm not sure is a my test fault or prototype one

04/01/08 18:01:48 changed by jdalton

  • attachment selector_tests_updated.diff added.

Updated selector tests with current git repo revision (1c00700 git is ridiculous)

04/01/08 20:09:27 changed by kangax

Are any of the new tests failing?

04/02/08 16:19:49 changed by mila76

  • attachment odd_even.patch added.

unit test for even/odd/contains and some other selectors

04/02/08 16:23:27 changed by mila76

2 fails on Firefox: testSelectorWithId and testSelectorWithContains 8 on IE6: testSelectorWithId, testSelectorWithContains and testSelectorWithFirstLastOnlyNthNthLastChild