- From: Mark Birbeck <mark.birbeck@webbackplane.com>
- Date: Thu, 29 Apr 2010 14:53:13 +0100
- To: benjamin.adrian@dfki.de
- Cc: Shane McCarron <shane@aptest.com>, Ivan Herman <ivan@w3.org>, Manu Sporny <msporny@digitalbazaar.com>, public-rdfa-wg@w3.org
Hi Benjamin, > /* > * Create rdfa object. The developer might use any > * variable name, but as convention it should > * be called rdfa. > */ > var rdfa = new rdfaDomAPI(document) > > The whole thing is called dependency injection in object oriented > programming > and is a technique for supplying an external dependency. > <http://en.wikipedia.org/wiki/Coupling_%28computer_science%29> Right...but that's not really what I was getting at. >From a browser's point of view, the context is provided by the JavaScript run-time environment. In general this provides you with the basic types such as arrays, dates, regular expression objects, functions, and so on. This run-time environment is often provided by a standalone library, which can be initialised with a context containing pointers to things like system-specific objects and constructors for additional objects. For example, SpiderMonkey provides the JS implementation for Firefox, and when it's initialised it is given the document and window objects as global objects which are then made available to the programmer. If you want to add new types that are available independently of document and window, then from an implementation perspective you have to change the JS environment. That's a different implementation question to the one we've been considering, and it's probably something we'll get a lot of push-back on. I realise that the HTML5/XMLHttpRequest object takes a 'new object' approach, but whilst I'm not keen on that, I can accept that XHR is so central to the modern browser that to some extent it stands alone. But other than that, W3C specifications generally extend the document or the window objects, rather than the JS run-time environment. Also, the second point I was making is that the other types should be created via factory methods, and not by constructors. Regards, Mark -- Mark Birbeck, webBackplane mark.birbeck@webBackplane.com http://webBackplane.com/mark-birbeck webBackplane is a trading name of Backplane Ltd. (company number 05972288, registered office: 2nd Floor, 69/85 Tabernacle Street, London, EC2A 4RR)
Received on Thursday, 29 April 2010 13:53:53 UTC