Skip to content

Commit

Permalink
Special filtering commands based on true/false.
Browse files Browse the repository at this point in the history
issue #1
  • Loading branch information
kellysutton committed Jul 22, 2012
1 parent 965e43d commit c6dfd8b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/jquery.data.filter.js
Expand Up @@ -5,6 +5,14 @@
if (typeof value === "undefined" || value === "") {
return this.filter('[data-' + attribute + ']');
}
else if (typeof value === "boolean") {
if (value) { // value === true
return this.filter('[data-' + attribute + ']')
}
else { // value === false
return this.not('[data-' + attribute + ']');
}
}
else if ($.isArray(value)) {

// In the case that we have an array, we want to build a big multiple selector string:
Expand Down
2 changes: 1 addition & 1 deletion test.html
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<div class="Revision">None</div>
<div class="Revision">None</div>
<div class="Revision" data-id>100</div>
<div class="Revision" data-id="100">100</div>
<div class="Revision" data-id="101">101</div>
</body>
Expand Down

0 comments on commit c6dfd8b

Please sign in to comment.