I like that approach! Though "data" is actually a standard DOM attribute in HTML5, eg. for object or datagrid elements: http://www.w3.org/html/wg/html5/#datagrid
Also Opera supports a data attribute for select elements, making the data-attribute readonly. Something to avoid overloading. One option could be: div[:data.foo.bar=12] That makes it clear that ":data" isn't a normal attribute. Jörn On Mon, Nov 3, 2008 at 12:11 AM, Balazs Endresz <[EMAIL PROTECTED]> wrote: > > I've just made a small patch to Sizzle: http://jsbin.com/omipi/edit > It works like: Sizzle("div[data.foo.bar^=12]"); > I first thought of using ":" too in the square brackets but i fear > that needs a bit more hacking with other regular expressions too, but > that would work better for sure. > Just for the record I haven't seen a selector engine till now but > looking at jQuery's current one and Peppy, well, I think that would be > a nightmare to implement something like this on those (especially with > Peppy), Sizzle seems to be incomparably better designed! > > On Nov 2, 10:13 pm, Ariel Flesler <[EMAIL PROTECTED]> wrote: >> Seems fine to me. The ideal place for it would be inside $.expr[':'] >> but I'm not sure it fits. >> >> $('*:data(foo)') >> >> No place for the value. The other option (requires modifying/ >> overloading the core) would be: >> >> $('*[:foo=bar]') >> >> Where those ':' are some random character that identifies this. As a >> generic solution, I think we could add another $.expr for characters >> on this place. >> So.. one could do (f.e) >> >> $('*[~padding=0px]') >> >> As a random way of selecting by style properties. Hopefully Sizzle >> will allow this easily. >> >> -- >> Ariel Fleslerhttp://flesler.blogspot.com/ >> >> On Nov 2, 3:28 am, Danny <[EMAIL PROTECTED]> wrote: >> >> > I was recently having a discussion with a fellow developer who was >> > writing code that set custom html attributes to various nodes to save >> > information that'd be required later when working with them. >> > I asked him why he wasn't using jquery's built-in support, Data for >> > storing that information in the nodes. He responded saying, he >> > woulnd't be able to use jquery's selectors to query against the dom. >> > $("div[custId=5]") //etc. >> >> > That made me wonder, why isn't there some sort of support for querying >> > the values in the jquery.data from within a selector. I'm aware I >> > could write a whole .filter(...) function but thats extrodinarily >> > wordy and defeat the purpose. >> >> > I was wondering what others thought of this, and how useful the data >> > functionality is to them in this regard. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
