We might have a dozen or so data-* attributes attached to different DOM elements. You'll be surprised how much easier your life will be.
var versions = $('.Revision') .filter('[data-project-id="' + projectId + '"]');
var versions = $('.Revision').dfilter('project-id', projectId);
You can even opt to only check against existence of a non-blank data-* attribute:
var versions = $('.Revision').dfilter('project-id'); var sameVersions = $('.Revision').dfilter('project-id', true);
Or, give it an array!
var versions = $('.Revision').dfilter('project-id', [100, 101]);
You can also filter using true and false. A value of true filters elements with that data attribute, even if the attribute is blank. A value of false will select all things without that data attribute:
// Selects all revisions without a project-id var versions = $('.Revision').dfilter('project-id', false);
Copyright 2013 LayerVault Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.