RDFa API - global object

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;

Why? Firstly, globals are evil. Secondly, because the 'document' object
is already presented to the user in a number of convenient places.

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.

-- 
Toby A Inkster
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>

Received on Tuesday, 27 April 2010 07:38:30 UTC