Re: RDFa API - global object

On 04/27/2010 03:36 AM, Toby Inkster wrote:
> The 'rdfa' object in the current draft appears to be a global object?
> Is this true?
> 
> I'd like to propose making it a property of the existing global
> 'document' object, so you'd access it in Javascript as:
> 
>  rdfa = document.rdfa;

One can't implement this in languages that don't support Delegation, or
prototype-based programming.

> Why? Firstly, globals are evil. 

Not always :) - Python uses globals to refer to package names:

import sys

and it works very well in that language. JQuery also has a global object
'jQuery', as does Prototype, and you can use '$' - which is a global
that references the jQuery/Prototype object.

> So making 'rdfa' a property of the document object would enable one
> page to load another page either as an iframe or via AJAX, and read
> RDFa from the other page.

... or we could add a method to the rdfa library:

var triples = rdfa.remote.filter("http://example.org/remote.html");

I marked this as an issue for future discussion in the latest RDFa DOM
API spec:

http://www.w3.org/2010/02/rdfa/drafts/2010/WD-rdfa-dom-api-20100429#future-discussion

-- manu

-- 
Manu Sporny (skype: msporny, twitter: manusporny)
President/CEO - Digital Bazaar, Inc.
blog: PaySwarming Goes Open Source
http://blog.digitalbazaar.com/2010/02/01/bitmunk-payswarming/

Received on Thursday, 29 April 2010 05:59:28 UTC