A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on Chat (such as one of these permanent autoconfirmed members).

Component Model Aspect-oriented Components Brainstorming

From WHATWG Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Example

component declaration:

 <template name="x-base">
     <template name="top">
         <content select="X"></content>
     </template>
     <template name="center">
         <content select="Y"></content>
     </template>
     <template name="bottom">
         <content select="Z"></content>
     </template>
     <template> 
         <use name="top"></use>
         <use name="center"></use>
         <use name="bottom"></use>
         <content select="W"></content>        
     </template>
   </template>

derived component overriding main template. Pattern derived components will use most often.

 <template name="x-derived1" base="x-base">
     <template>
         <content select="Z"></content>        
         <use name="top"></use>
         <use name="center"></use>
         <use name="bottom"></use>
     </template>
 </template>

derived component overriding a part template. All <use> elements referring to "top" in the finalized component will now render below structure instead. Pattern decorators will use most often

 <template name="x-derived2" base="x-base">
     <template name="top">
         <content select="X"></content>
         <content select="Z"></content>        
     </template>
 </template>

combination: derived component overriding main template and a part template, and adding a new template, all at once. Pattern derived components will use often.

 <template name="x-derived1" base="x-base">
     <template name="bottom">
         <hr>
         <content select="Z"></content>
     </template>
     <template name="left">
         <content select="Y"></content>
     </template>
     <template>
         <use name="top"></use>
         <use name="bottom"></use>
     </template>
 </template>

Issues

  • Splitting scripting among parts - how to "re-route" scripting to overriding parts? probably not possible -> rely on heavy messaging instead?
  • Overriding parts again requires a certain knowledge of a components internals - at least which parts exist and what they do (then again, this is also the point)
  • How to best apply & remove "decorators"?
  • It's not possible to extend a template or part (adding or wrapping the base part, but also rendering it) - it's either leave the original or replace it completely. The ability to extend seems desirable in some cases, but would then re-raise the XBL inheritance questions. How to best reconcile this? (or ignore it?)
  • In some sense all this creates a mother-of-all-flattened-trees
  • Can this work if some parts are being isolated?