Hi
Now that both Seaside 2.7a1 and 2.6b1 have the "new" header API i think its time to write something short about it so people don't have to ask. The old header API was suffering from the same problems as the old renderer API. Just to add an stylesheet with media and title you had to copy and paste about 4 methods. Addional 4 for alternate stylesheets. If you wanted a new conditional import you needed to copy and paste a 3 LOC method. And so on. So we followed the same path like the Canvas API and made use of cascades. The new API offers four base methods to create elements - base, for base elements - if, for conditional imports - link, for link elements - meta, for meta elements - script, for script elements Most of the time will want to use one of these two convenience methods: - javascript, for javascripts - stylesheet, for css stylesheets See WABaseElement, WAConditionalComment, WALinkElement, WAMetaElement and WAScriptElement for details examples: aRoot stylesheet url: 'styles/blue.css' aRoot stylesheet document: 'a { color:red; }' aRoot javascript url: 'scripts/scriptaculous.css' aRoot if lessThan; ie7; do: [ aRoot javascripts url: 'iehacks.js' ] stuff that was just awkward to do with the old api: aRoot link beAlternateStylesheet; beCss; addProjection; addPrint; title: 'Blue'; url: 'styles/blue.css' Contrary to the Canvas renderer API the new header API in the background still used the old implementation. So you will have to implement no methods like #rendererClass. If you use the old API on Seaside 2.7a1 and have the development toolbar on you will get a warning pointing to where you use the old API. These methods include the code that you should replace yours with. Philippe _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
On Oct 26, 2006, at 11:45 AM, Philippe Marschall wrote: > Hi > > Now that both Seaside 2.7a1 and 2.6b1 have the "new" header API i > think its time > to write something short about it so people don't have to ask. > > The old header API was suffering from the same problems as the old > renderer API. Just to add an stylesheet with media and title you had > to copy and paste about 4 methods. Addional 4 for alternate > stylesheets. If you wanted a new conditional import you needed to copy > and paste a 3 LOC method. And so on. So we followed the same path > like the Canvas API and made use of cascades. > > The new API offers four base methods to create elements > - base, for base elements > - if, for conditional imports > - link, for link elements > - meta, for meta elements > - script, for script elements > > Most of the time will want to use one of these two convenience > methods: > - javascript, for javascripts > - stylesheet, for css stylesheets Looks great, guys. Avi _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Philippe Marschall
> -----Original Message-----
> From: [hidden email] > [mailto:[hidden email]] On Behalf > Of Philippe Marschall > Sent: Thursday, October 26, 2006 11:46 AM > To: The Squeak Enterprise Aubergines Server - general discussion. > Subject: [Seaside] new header api > > Hi > > Now that both Seaside 2.7a1 and 2.6b1 have the "new" header > API i think its time to write something short about it so > people don't have to ask. > > The old header API was suffering from the same problems as > the old renderer API. Just to add an stylesheet with media > and title you had to copy and paste about 4 methods. Addional > 4 for alternate stylesheets. If you wanted a new conditional > import you needed to copy and paste a 3 LOC method. And so > on. So we followed the same path like the Canvas API and made > use of cascades. > > The new API offers four base methods to create elements > - base, for base elements > - if, for conditional imports > - link, for link elements > - meta, for meta elements > - script, for script elements > > Most of the time will want to use one of these two > convenience methods: > - javascript, for javascripts > - stylesheet, for css stylesheets > > See WABaseElement, WAConditionalComment, WALinkElement, > WAMetaElement and WAScriptElement for details > > examples: > > aRoot stylesheet > url: 'styles/blue.css' > > aRoot stylesheet > document: 'a { color:red; }' > > aRoot javascript > url: 'scripts/scriptaculous.css' > > aRoot if lessThan; ie7; do: [ > aRoot javascripts > url: 'iehacks.js' ] > > stuff that was just awkward to do with the old api: > > aRoot link beAlternateStylesheet; beCss; > addProjection; addPrint; > title: 'Blue'; > url: 'styles/blue.css' > > Contrary to the Canvas renderer API the new header API in the > background still used the old implementation. So you will > have to implement no methods like #rendererClass. > > If you use the old API on Seaside 2.7a1 and have the > development toolbar on you will get a warning pointing to > where you use the old API. These methods include the code > that you should replace yours with. > > Philippe Nice work on the new header stuff, just trying it out. I love the deprecated code warning. Ramon Leon http://onsmalltalk.com _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |