[jQuery] Re: A general Javascript question: duplicate IDs in a document?

2009-03-31 Thread Ricardo
You can store data in the class attribute. See the jquery.metadata plugin: http://docs.jquery.com/Plugins/Metadata. You can also use the data() method in jQuery, it's meant for this. - ricardo On Mar 31, 6:42 pm, Eric Garside wrote: > Right, but the problems with that approach is inefficiency.

[jQuery] Re: A general Javascript question: duplicate IDs in a document?

2009-03-31 Thread Mauricio (Maujor) Samy Silva
Right, but the problems with that approach is inefficiency. It's more efficient to grab the entire set of elements via $('.event-phase') and comparing their "rel" attribute than it is to throw a loop around $ ('.event-phase-' + i); I think it depends upon the context. If the loop is needed fo

[jQuery] Re: A general Javascript question: duplicate IDs in a document?

2009-03-31 Thread brian
On Tue, Mar 31, 2009 at 5:42 PM, Eric Garside wrote: > > Right, but the problems with that approach is inefficiency. It's more > efficient to grab the entire set of elements via $('.event-phase') and > comparing their "rel" attribute than it is to throw a loop around $ > ('.event-phase-' + i); W

[jQuery] Re: A general Javascript question: duplicate IDs in a document?

2009-03-31 Thread RobG
On Apr 1, 7:42 am, Eric Garside wrote: > Right, but the problems with that approach is inefficiency. It's more > efficient to grab the entire set of elements via $('.event-phase') and > comparing their "rel" attribute than it is to throw a loop around $ > ('.event-phase-' + i); > > I use ref/re

[jQuery] Re: A general Javascript question: duplicate IDs in a document?

2009-03-31 Thread Jonathan
That approach is only more efficient because the original design was lacking. Also, you can just use the starts(^) attribute selector $("div [id^='event-phase']") to retrieve all IDs that start with 'event-phase'. You don't get to make up new meaning for existing attributes because you think it s

[jQuery] Re: A general Javascript question: duplicate IDs in a document?

2009-03-31 Thread Eric Garside
Right, but the problems with that approach is inefficiency. It's more efficient to grab the entire set of elements via $('.event-phase') and comparing their "rel" attribute than it is to throw a loop around $ ('.event-phase-' + i); I use ref/rel for the same basic semantic ideas behind their ascr

[jQuery] Re: A general Javascript question: duplicate IDs in a document?

2009-03-31 Thread Mauricio (Maujor) Samy Silva
Is there any major problems you're aware of with this kind of dom pollution that have a negative impact on ease or performance? My thoughts: Firstly: Validate! But I think that negative impact on whatever isn't the point. Suppose: Option 1 - Heading level 1 Option 2 - Heading level 1 What opt

[jQuery] Re: A general Javascript question: duplicate IDs in a document?

2009-03-31 Thread Eric Garside
2009 1:57 PM > To: jQuery (English) > Subject: [jQuery] Re: A general Javascript question: duplicate IDs in a > document? > > A best practice I've adopted is to utilize classes and ref/rel attributes on > dom elements for situations like you're describing. > > >

[jQuery] Re: A general Javascript question: duplicate IDs in a document?

2009-03-31 Thread Andy Matthews
1:57 PM To: jQuery (English) Subject: [jQuery] Re: A general Javascript question: duplicate IDs in a document? A best practice I've adopted is to utilize classes and ref/rel attributes on dom elements for situations like you're describing. Instead of On Mar 31, 12:31 pm, bri

[jQuery] Re: A general Javascript question: duplicate IDs in a document?

2009-03-31 Thread Eric Garside
A best practice I've adopted is to utilize classes and ref/rel attributes on dom elements for situations like you're describing. Instead of On Mar 31, 12:31 pm, brian wrote: > An ID should be unique. That's why it's callled an ID (IDentifier). > Repeating an ID in a page will cause

[jQuery] Re: A general Javascript question: duplicate IDs in a document?

2009-03-31 Thread brian
An ID should be unique. That's why it's callled an ID (IDentifier). Repeating an ID in a page will cause problems for any DOM work. For your purposes, you might do something like: On Tue, Mar 31, 2009 at 12:24 PM, riotbrrd wrote: > > I realize this is not jQuery specific, but I figured yo

[jQuery] Re: A general Javascript question: duplicate IDs in a document?

2009-03-31 Thread Andy Matthews
It's against the W3c spec for the DOM. The whole point of an ID is that it's unique on the page. Duplicate IDs lead to potential errors. If you need to have more than one of a thing on a page, then use a class. -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@google