Axioms
Here are the sort of axioms, or underlying rules that we use inside Dijit to assure speed, themeability, A11Y, etc.
1) No computedStyle calls (ie, dojo.html) or layout code during widget initialization, except for layout widgets. Widgets must never do style calls while they are hidden.
2) No special code paths for high-contrast mode or RTL support. The base code must work correctly in all modes. Differences are handled via CSS rules.
3) Theming is controlled completely via CSS; widgets don't have any style related parameters and never set style in the code. No image references in the code, except for ColorPalette.
4) Dynamic size: most widgets size to their contents, rather than setting a fixed size. True for TitlePane, Dialog, etc. This is a general pattern that's good to follow for A11Y reasons and just to make things easier on the user.
5) A11Y:
- No fixed font sizes or width/heights in dijit.css/tundra.css for stuff with text, because high-contrast mode or ctrl-+ may change sizes unexpectedly
- All icons are specified via background-image but they have corresponding character that show up in high contrast mode
6) I18N:
- no left/right dependent characters for high contrast mode; icons switch based on browser's RTL setting
- avoid float:left / float: right. use inline styles instead.
7) standard API across widgets (such as onChange() event)
8) parser and _Widget separation of concerns: Widget code should never read parameters directly from srcNodeRef because it breaks programmatic creation and prevents alternate parser implementations.
9) dojo.data: rely on dojo.data for data caching, sorting, paging, etc.
10) no such thing as a "popup widget". you can popup any widget, and it's the parent's job to make it display correctly (using dijit.popup.open() etc) and to make it disappear.
11) strict control on what new features/enhancements are added.
12) IE is our most important platform. Adding something like rounded corners or drop shadows that only affects FF or Safari doesn't have much value. If a feature is worth having, it's worth making it work on IE, and hopefully on IE6.
13) Don't use try/catch when an if() statement can do the same job.
- Printer-friendly version
- Login or register to post comments
- Subscribe post
