[whatwg] [WA1] Idea for Calendar Markup

Matthew Raymond mattraymond at earthlink.net
Wed Feb 2 08:00:21 PST 2005


    I like the idea of a calendar in Web Applications 1.0, but I really 
hate the way they're currently implemented. For one thing, if the 
|class| attribute contains the name of a calendar attribute, how do you 
style the element? What happens if you use |class| to style something, 
and the class happens to be the name of a calendar attribute? Does it 
style that attribute.

    Nope, I prefer to stick with good old-fashioned elements. Here's an 
example of what I'd like to see, minus the fallback content:

| <calendar>
|   <cevent id="e036f260-39b4-11d9-ad3f-fc68600c1802">
|     <csummary value="That thing we did that was so fun."></csummary>
|     <cattr type="status" value="CONFIRMED"></cattr>
|     <cattr type="class" value="PRIVATE"></cattr>
|     <cattr type="categories" value="Work"></cattr>
|     <cattr type="x-mozilla-alarm-default-length" value="0"></cattr>
|     <cattr type="dtstamp" value="2005-02-02T21:00Z"></cattr>
|     <cdatetime start="2005-02-30T19:00Z" end="2005-02-30T21:00Z">
|     </cdatetime>
|   </cevent>
| </calendar>

    Basic stuff like the summary and the start and end dates are defined 
specifically. The rest of the calendar event attributes are defined with 
<cattr type="attribute-name">. A WA1-compliant UA would then assign the 
|value| attribute as the value of the calendar event attribute. If 
|value| is not specified, the child contents are used. The <cdatetime> 
element is a special case in that it requires <datetime> elements to be 
in the child contents if |value| is undefined.

    All contents inside <calendar> that are not calendar-related 
elements or the contents of calendar-related elements are ignored. As a 
result, the following would provide proper fallback content:

| <calendar>
|   <table>
|     <caption>Upcoming Events</caption>
|     <tr>
|       <th>Summary</th>
|       <th>Status</th>
|       <th>Class</th>
|       <th>Categories</th>
|       <th>Start Date</th>
|       <th>End Date</th>
|     </tr>
|     <cevent id="e036f260-39b4-11d9-ad3f-fc68600c1802">
|     <tr>
|       <td><csummary>
|         That thing we did that was so fun.
|       </calsummary></td>
|       <td><cattr type="status">CONFIRMED</cattr></td>
|       <td><cattr type="class">PRIVATE</cattr></td>
|       <td><cattr type="categories">Work</cattr></td>
|       <cattr type="x-mozilla-alarm-default-length" value="0"></cattr>
|       <cattr type="dtstamp">
|         <datetime value="2005-02-02T21:00Z"></datetime>
|       </cattr>
|       <cdatetime>
|         <td><datetime value="2005-02-30T21:00Z">
|           02/30/05 7:00 PM
|         </datetime></td>
|         <td><datetime value="2005-02-30T21:00Z">
|           02/30/05 9:00 PM
|         </datetime></td>
|       </cdatetime>
|     </tr>
|     </cevent>
|   </table>
| </calendar>

    The above should render in legacy user agents as a table, with 
values unimportant to presentation not rendered. Yet, for a WA1 UA, it 
yields the same calendar as the first example.

    Note that in both examples, if the |type| of a <cattr> element is 
unknown to the user agent, the value can simply be ignored. The <cattr> 
would have a set of standardized |type| values that all user agents 
would support, then individual user agent vendors could implement 
extensions, with the recommended nomenclature being something like this:

    x-[company or organization]-[attribute name]

    This should give us a reasonable amount of flexibility and 
extensibility without creating a complicated markup scheme. If 
necessary, <cdatetime> and <csummary> could be rolled into <cattr>, but 
I'd prefer to have these separate, since they're likely to always be used.

   That's all for now. Thoughts welcome.



More information about the whatwg mailing list