Selector Mappings

Colin Clark colinbdclark at gmail.com
Wed Nov 25 21:53:21 UTC 2009


Hey Steve,

Yep, it's definitely something we're planning to address. We've also  
noticed that writing selector cutpoints for the Renderer is a source  
of common code repetition, so we've got a few ideas on the table. The  
first plan is to harmonize the creation of cutpoints arrays with the  
names and selectors that are already a part of every component's DOM  
Binder.

In the case of Pager, this is entirely your markup rather than the  
component's, so a DOM Binder probably isn't available to us. Given  
this, I think your idea of a default mapping scheme, converting IDs to  
selectors, makes a lot of sense. Off the top of my head, we could do  
something simple like take an array of IDs and have it assume class- 
based selectors: drop off any colons, add a dot in front, and you're  
good to go. Is that something along the lines of what you were thinking?

Colin

On 25-Nov-09, at 1:22 PM, Steven Githens wrote:

> While I'm digging back into this,  has there been any effort to  
> reduce or automate selector mappings?  These things.[1]
>
> I could probably shorten it to an array and then run it through a  
> processor function.  However, I'd really like to just use a naming  
> convention with ID's and attributes and not write any selector  
> mappings at all (except for the occasional special scenerio).
>
> I guess that would require traversing the component tree right  
> before (or during) rendering to check for the convention and add it  
> to the selector map if it matches, as one approach.
>
> Has anything like this baked into the framework already before I  
> fiddle with it too much?
>
> Cheers,
> Steve
>
>
> [1]
> asnn2subview.selectorMap = [
> { selector: ".row", id: "row:" },
> { selector: ".sub-table-header", id: "header:" },
> { selector: ".student-name", id: "student-name"},
> { selector: ".submitted-time", id: "submitted-time"},
> { selector: ".submission-status", id: "submission-status"},
> { selector: ".grade", id: "grade"},
> { selector: ".review-score", id: "review-score"},
> { selector: ".review-error", id: "review-error"},
> { selector: ".review-multiple", id: "review-multiple"},
> { selector: ".review-pending", id: "review-pending"},
> { selector: ".feedback-released", id: "feedback-released"},
> { selector: ".student-grade-link", id: "student-grade-link"},
> { selector: ".student-name-sort", id: "student-name-sort" },
> { selector: ".student-name-sort-img", id: "student-name-sort-img" },
> { selector: ".submitted-time-sort", id: "submitted-time-sort"},
> { selector: ".submitted-time-sort-img", id: "submitted-time-sort- 
> img"},
> { selector: ".submission-status-sort", id: "submission-status-sort"},
> { selector: ".submission-status-sort-img", id: "submission-status- 
> sort-img"},
> { selector: ".submission-report-sort", id: "submission-report-sort" },
> { selector: ".submission-report-sort-img", id: "submission-report- 
> sort-img" },
> { selector: ".feedback-released-sort", id: "feedback-released-sort" },
> { selector: ".feedback-released-sort-img", id: "feedback-released- 
> sort-img" },
> { selector: ".grade-sort", id: "grade-sort" },
> { selector: ".grade-sort-img", id: "grade-sort-img" },
> { selector: ".grade-col-header", id: "grade-col-header" },
> { selector: ".grade-td", id: "grade-td" },
> { selector: ".report-col-header", id: "report-col-header" }
> ];
> _______________________________________________________
> fluid-work mailing list - fluid-work at fluidproject.org
> To unsubscribe, change settings or access archives,
> see http://fluidproject.org/mailman/listinfo/fluid-work

---
Colin Clark
Technical Lead, Fluid Project
http://fluidproject.org




More information about the fluid-work mailing list