W3C home > Mailing lists > Public > public-rdfa-wg@w3.org > July 2010

Re: Updating RDFa Core

From: Manu Sporny <msporny@digitalbazaar.com>
Date: Mon, 12 Jul 2010 15:12:49 -0400
Message-ID: <4C3B6931.3040903@digitalbazaar.com>
To: RDFa WG <public-rdfa-wg@w3.org>
On 07/10/10 15:15, Gregg Kellogg wrote:
> I did come across one odd thing in implementing this in jQuery, I
> couldn't get attr('prefix', '...') to set the @prefix. I think that
> 'prefix' might mean something special in jQuery (the prefix of the
> element?), but don't have time to look more deeply into this. Try this
> in Firebug:
>     d = $("<div><p/></div>")
>     d.children("p").attr("prefix", "dc: http://purl.org/dc/terms/")
>     d.html()
>     => "<p></p>"
> If you replace "prefix" with most anything else, it works okay.
> Reading also poses problems:
>     d = $("<div><p prefix='dc: http://purl.org/dc/terms/'/></div>")
>     d.children("p").attr("prefix")
>     => null

Yeah, verified - this was really weird until we figured out what was
going on. Seems to be a bug in jQuery. I checked the source and there is
no mention of matching against a "prefix" string in the code anywhere,
however Node has a prefix attribute that is exposed via DOM Level 2:


When you do jQuery.Node.attr("prefix", "foo"), it'll change the Node's
namespace prefix to "foo". This is not the correct behavior, AFAICT.

You can get around it by using Element.setAttribute() and

For example:

d = $("<div><p/></div>");
d.children("p")[0].setAttribute("prefix", "dc: http://purl.org/dc/terms/");



Someone might want to log a bug on jQuery...

-- manu

Manu Sporny (skype: msporny, twitter: manusporny)
President/CEO - Digital Bazaar, Inc.
blog: Myth Busting Web Stacks - PHP is Faster Than You Think
Received on Monday, 12 July 2010 19:13:20 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:19:48 UTC