Parabellum1905y / ufd

Automatically exported from code.google.com/p/ufd
GNU General Public License v2.0
0 stars 0 forks source link

Add custom class to specific list either by udf() option or select element custom attribute #87

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Apologies if there's already a method to achieve this, but I've yet to find 
evidence of it trawling this issue queue so far.

UFD is impossibly difficult to test with something like Selenium WebDriver as 
there appears to be no way to add custom specific classes, when there are 
multiple UFDs on the page, and even more so when UFDs are dynamically added to 
the page.

The only way is using xpath indexes or nth-child() selectors, however this goes 
from convoluted to impossible once you start adding UFD elements after AJAX 
calls as the #ufd-container children are emptied and appended, making the 
indexes unpredictable.

I would propose either a udf() option such as ufd({listClass: 
'customer-salutation'}) which would then leave the following selector:

#ufd-container > div.plain > div.list-wrapper > div.list-scroll > 
ul.customer-salutation

Alternatively, this value could be set as an attribute on the originating 
select, for instance:

<select id="customer-salutation" data-ufd-class="customer-salutation">

And then calling $('select').ufd(); would apply the correct class for each 
select element it finds.

Original issue reported on code.google.com by dhel...@gmail.com on 22 Apr 2014 at 8:45

GoogleCodeExporter commented 8 years ago
OK I found a potential workaround, by adding an additional class to the 
css:listScroll value, e.g.:

$('select').ufd( {css: {listScroll: 'list-scroll customer-salutation'} } );

A custom attribute would be most ideal, but at least I can test reliably now :)

Original comment by dhel...@gmail.com on 22 Apr 2014 at 9:13