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:34:16 -0400
Message-ID: <4C3B6E38.80508@digitalbazaar.com>
To: RDFa WG <public-rdfa-wg@w3.org>
On 07/12/10 15:12, Manu Sporny wrote:
> 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()
> 
> 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:
> 
> http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-NodeNSPrefix
> 
> 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.

Our CTO found the issue, it's this line in jQuery:

http://github.com/jquery/jquery/blob/master/src/attributes.js#L4

"prefix" needs to be added to the 'rspecialurl' regex variable on line
4. jQuery does some magic voodoo when accessing variables due to various
browser issues.

jQuery access properties directly if it isn't a rspecialurl property,
which means that $.attr('prefix') changes the Node's namespace value
instead of the 'prefix' value in the attributeList for the Node.

-- manu

-- 
Manu Sporny (skype: msporny, twitter: manusporny)
President/CEO - Digital Bazaar, Inc.
blog: Myth Busting Web Stacks - PHP is Faster Than You Think
http://blog.digitalbazaar.com/2010/06/12/myth-busting-php/2/
Received on Monday, 12 July 2010 19:34:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 27 April 2012 04:55:07 GMT