NADAV: Behaviors are way cool, but my immediate thought is what of cross-browser compatibility. Since behaviors only work for IE, how would I actually use them in the real world? Would I have to conditionalize all my pages on the server? Wouldn't this create way more work for coders?
MICHAEL:We designed behaviors to be somewhat "downlevel friendly." Think about the flyin or mask behavior. Both of these can be applied in such a way that if a browser doesn't understand behaviors, they will simply be ignored.
If you want to conditionalize your pages, you can do that on the server like you mention, but we now also have conditional comments in IE that allow you to specify both uplevel and downlevel parts on a page.
In terms of making more work, well, if you want to have a page that works on all browsers and uses new features, using behaviors actually helps (vs. wanting to use new features and not using behaviors). If you argue that using new features and wanting to have things work everywhere means more work, then there is no argument. Adding features always equals more work.
NADAV: If my company started using behaviors, how would you see this affecting the work flow and work roles that currently exist between coders and designers and so on?
MICHAEL: One thing we were trying to do with behaviors was to make it easier for designers to use DHTML.
We looked at how people author content for the Web. What we found was that a lot of content authors and designers were not comfortable having script on their pages. We also found that engineers were repeatedly applying their skills to add dynamic functionality through script to individual pages.
By using behaviors, the process of authoring interactive and dynamic content becomes much more manageable. The engineer can create a library of reusable behaviors that are available for use in Web pages. The designers and content authors can then apply these behaviors to a page to achieve the desired dynamic behavior, such as mask, flyin content, or expanding/collapsing lists. In adding the behaviors to the page, the content authors and designers are using familiar concepts of HTML tags and CSS and have no need to learn script.
Behaviors also make the process of creating dynamic pages less expensive and less fragile because the engineer is not applying individual script to every page. So should the content need updating, there is much less likelihood of the dynamic functionality breaking or of the content and design of the page being upset.
Examples of Good Behaviors (IE Beta2 users only)
NADAV: Can you give an example of a DHTML behavior file (markup and scriptlet file)?
MICHAEL: Here are two: the flyin behavior, which uses XML, and the mask behavior, which shows attachment of behavior to HTML. Both will work with Beta2.
next page»