Re: RDFa API - global object

Toby Inkster schrieb:
> The 'rdfa' object in the current draft appears to be a global object?
> Is this true?
>   
Yes
> 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;
>
> Why? Firstly, globals are evil. Secondly, because the 'document' object
> is already presented to the user in a number of convenient places.
>   
In JS implementations I agree with you.
But you can't modify objects in languages without concepts like prototyping.

Dependency injection would solve this:
Define rdfa as interface with document as property.

> For example, it'saccessible across IFRAME elements. I can do this:
>
>  <iframe src="otherdoc.html"></iframe>
>  <script type="text/javascript">
>   var frames = document.getElementsByTagName('iframe');
>   var fdoc   = frames[0].contentDocument;
>   window.alert(fdoc.body.innerHTML);
>  </script>
>
> Or I can perform an XMLHttpRequest for some external file, get the
> response and do something like this:
>
>  var response = ... XML response ...;
>  window.alert(response.responseXML.documentElement.innerHTML);
>
> 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.
>   
And this is really cool.

Best regards,

Ben

-- 
__________________________________________
Benjamin Adrian
Email : benjamin.adrian@dfki.de
WWW : http://www.dfki.uni-kl.de/~adrian/
Tel.: +49631 20575 145
__________________________________________
Deutsches Forschungszentrum für Künstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschäftsführung:
Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster (Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats:
Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
__________________________________________

Received on Tuesday, 27 April 2010 08:59:36 UTC