- From: Nathan <nathan@webr3.org>
- Date: Sat, 04 Sep 2010 20:08:14 +0100
- To: Manu Sporny <msporny@digitalbazaar.com>
- CC: RDFa WG <public-rdfa-wg@w3.org>
Manu Sporny wrote:
> I haven't thought this through very well, but was wondering if it would
> be advisable to have an ondata attribute for the <body> element? This
> would work very much like the onload attribute that is already on the
> <body> element.
>
> I can see a few implementers complaining that the RDFa processing of a
> document could take a long time (as in more than 100ms), especially if
> certain RDFa profiles take a while to retrieve or timeout.
>
> The worst case is that a bad implementation of the RDFa API would cause
> the document not to render because the RDFa profiles are being
> fetched/processed. Ideally, RDFa processing should happen asynchronously.
Perhaps then all parsing should happen asynchronously.
DataStore could implement EventTarget and provide and dispatch the
onload event whenever processing has completed.
var store = document.data.createStore();
store.onload = function(event) {
// triggered when the store is ready
// i.e. once parsing is finished
}
var parser = document.data.createParser("rdfa1.1", store)
parser.parse( somedocument );
Actually, thinking about this more, an XMLHttpRequest style readystate
may be needed, ie add the following:
interface DataStore : EventTarget {
attribute Function onerror
attribute Function onload
attribute Function onreadystatechange;
const unsigned short EMPTY = 0;
const unsigned short LOADING = 1;
const unsigned short DONE = 2;
readonly attribute unsigned short readyState;
}
Ack, this brings up a whole host of (sadly unavoidable) questions - I'll
mail them under separate cover - sorry.
However, it seems to make sense for DataStore to work async and dispatch
events - that can be the take away - well caught Manu.
Best,
Nathan
> However, if it happens asynchronously, how do we signal developer code
> that the RDFa/Microformats/Microdata has been extracted and is ready to
> be read.
>
> The only approach that I could think of (in the 10 minutes that I've
> been thinking about the problem) is to have an "ondata" attribute on the
> BODY element that is called whenever all data extraction has completed
> for the document and there is data available in document.data.store.
>
> Have we thought about this problem before?
>
> -- manu
>
Received on Saturday, 4 September 2010 19:09:33 UTC