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

Ticket #10626 (new enhancement)

Opened 5 months ago

Last modified 4 months ago

[PATCH] [TEST] Element.visible to respect ancestors' styles

Reported by: kangax Assigned to: sam
Priority: low Milestone: 2.x
Component: Prototype Version: edge
Severity: minor Keywords:
Cc:

Attachments

visible_patch.diff (490 bytes) - added by kangax on 12/27/07 22:06:35.
visible_patch.2.diff (490 bytes) - added by kangax on 12/27/07 22:07:25.
visible_tests.diff (1.3 kB) - added by kangax on 12/28/07 00:09:09.
visible_patch_alt.diff (0.6 kB) - added by kangax on 01/17/08 22:43:29.

Change History

12/27/07 22:06:35 changed by kangax

  • attachment visible_patch.diff added.

12/27/07 22:07:25 changed by kangax

  • attachment visible_patch.2.diff added.

12/27/07 22:08:35 changed by kangax

Sorry for double submission, trac is being feeling quirky lately.

12/28/07 00:09:09 changed by kangax

  • attachment visible_tests.diff added.

12/28/07 00:09:31 changed by kangax

  • summary changed from [PATCH] Element.visible to respect ancestors' styles to [PATCH] [TEST] Element.visible to respect ancestors' styles.

01/14/08 20:06:21 changed by Tobie

Afaik, you'll need to modify Element#toggle too, to take this in account.

01/17/08 22:43:00 changed by kangax

Yes Tobie, you are right - this is getting quite messy. Attaching alternative version - with check for optional argument:

Element.visible(element[, deep]);

// deep traversal
Element.visible(element, true); 

// same as original (only check for a style.display value)
Element.visible(element); 

This should also play safe in cases when Element.visible implicitly gets second argument (i.e. when used as iterator)

// second argument (index) which iterator receives should not interfere as we are checking for "true" explicitly
$$('*').reject(Element.visible);

After all this mess I'm not even sure if this is worth the trouble...

01/17/08 22:43:29 changed by kangax

  • attachment visible_patch_alt.diff added.