Learning Advanced JavaScript. I just came across this interactive ’slide-show’ style tutorial from John Resig, (although it has been around for a year or more I think). I would have liked a little more background explanatory text at times, but overall it feels like a really nice way to get across some of the more complex bits of the JavaScript language.
CSS3 and beyond
I have spent quite a while recently tinkering about with the parts of the CSS3 spec that have been already implemented in various browsers (albeit mostly via vendor-prefixed properties) – things like border-radius, rgba colours, box-shadow, media queries and more. Useful additions to our toolbox, and ones which will undoubtedly cut down on the amount of general hackery we need to use to do relatively simple things; a good thing, in other words.
But there are parts of the spec that are, in my mind, definitely not a good thing. Things like the ascii-art nightmare that is the so-called ‘Advanced/Template Layout Module‘ for example, make me go weak at the knees. Why is something this offensive even being considered when one or two minor additions to the positioning model we already have would allow us to intuitively create layouts without totally re-inventing the wheel?
Parts of the spec such as this make me seriously concerned that the CSS WG are focussed on serving up high-level, situation specific solutions to problems rather than thinking about how they could evolve CSS to provide better low-level tools that would allow us to tackle problems on a more generic level. It’s a case of “give a man a fish and he’ll have food for a day, teach a man to fish and he’ll have food for life”. Give us a complex layout solution like the one proposed and you solve (in a horrible way) one problem; give us the ability to do basic maths and a few fixes to the current positioning system and we’ll be able to use them to solve all sorts of issues, not just generic page layouts.
So what would I like to see added to the CSS3 (or maybe CSS4!) spec? Glad you asked. The list below is a few things I would like to see added, that I think would aid CSS developers in their everyday work. Note there are no solutions to specific problems here; what I want is the tools to be able to sensibly solve both problems I encounter today and problems I haven’t encountered yet and can’t yet imagine.
- Basic math – I want to be able to do things like
width: 100%-200px;in my stylesheets. - Delegation – Give me a mechanism so that I can define an element’s style by way of reference to another element’s properties.
- Positioning tweaks – let me have a property that allows the element it’s applied to to clear it’s absolutely positioned siblings, in a similar way that
clear:both;does for floated elements. - Constants (or variables, if you prefer) – let me define constants for re-use to make my code clearer and more maintainable.
- Mixins – Let me define reusable groups of CSS properties that I can ‘mix in’ to the properties of other selectors without having to add multiple class names to my HTML.
People’s knee-jerk reaction to any of these suggestions is generally “CSS isn’t a programming language and it shouldn’t be made to behave like one!!”. Well, I’m sorry, but for me that argument just doesn’t stand up. CSS is a tool, and I believe that tools should be honed to better do the jobs that are asked of them. CSS wasn’t intended to be a layout solution in the first place, but we have hacked it into becoming that. People think that adding in ideas like the above make CSS more complex; I would personally argue that they would make it less complex; abstractions such as mixins and constants, and tools like basic maths should make it much more obvious what the authors intentions were when penning a certain rule or property.
Over the next couple of weeks I hope to go into a little more detail on each of the points on my ‘wish list’ above and illustrate how I think they could work and their potential application to specific, common situations. But for now, let me just point out that none of the things I have talked about are particularly new ideas; Google any one of them and you will find many people with the same viewpoint as I, and plenty more food-for-thought to boot.
Bespin Embedded. First ‘official’ (albeit preview) release of the embeddable version of the Bespin editor. I have played around with the pre-reboot version but it will be good to have a more stable, documented version to hack about a bit.
Why do we have an IMG element?. I realise I link to a lot of Mark Pilgrim’s stuff, but this mailing-list history of how the IMG element came into being is just about one of the most fascinating articles I have read on the web.
Underscore.js. Nice little JS library described as “the tie to go along with jQuery’s tux” – provides a set of functional primitives like map, reduce, max, min etc all under an underscore ‘namespace’. Bookmarked.
Empowering the UK with Google PowerMeter. Very cool – Google’s Powermeter is now being made available in the UK. I’m quite excited about this; We currently use a CurrentCost meter at home and whilst I have long toyed with setting up an Arduino-powered link to some sort of logging service, it would certainly be great if it could integrate with Powermeter in the future.
Amazon Relational Database Service. Very interesting – MySQL as a hosted cloud service from Amazon. I guess it was only an amount of time before someone did this (are Amazon actually the first?) but it is fascinating to watch how all the elements of web app building are slowly becoming cloud-ified.
HTML5 and video in email . Interesting experiment (with largely positive results) from the guys at Campaign Monitor on using the HTML5 video tag to display video in email, with a fallback for non-capable email clients.
Twig. New Django/Liquid style templating engine for PHP with an emphasis on speed, security and flexibility. I like the look of this a lot – although the extension process seems more convoluted than with Smarty.
Codebase. I’ve been playing with this app over the last couple of days and it seems (so far) to be exactly what I have been looking for. Currently I use Beanstalk plus lighthouse/pbwiki for my SVN hosting/bugtracking/documentation needs but having everything under one roof is a pretty major bonus. Interface is nice and snappy too, with a few niggly details but generally pretty good.
Tags:
(x)HTML @font-face Amazon analogue analytics Apple apps atheism books browsers canvas code CSS css3 dConstruct drag and drop eco electricity email events fail foundries freelancing Google HTML5 IE iphone javascript jQuery miscellaneous mobile MySQL performance personal php programming projects recommendations running Tea The Web tools UI webfonts web standards