Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/glenn/css-utils-fixes' into pfly…
Browse files Browse the repository at this point in the history
…nn/css-utils-tests

* origin/glenn/css-utils-fixes:
  Add support for *, and trailing id selector
  • Loading branch information
peterflynn committed Mar 3, 2012
2 parents a8af2d5 + 9de39f8 commit cb6a1a7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/CSSUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,15 @@ define(function (require, exports, module) {
selector = "(^|\\s)" + selector;
}

var re = new RegExp(selector + "(\\[[^\\]]*\\]|:{1,2}[\\w-]+|\\.[\\w-]+)*\\s*$", classOrIdSelector ? "" : "i");
var re = new RegExp(selector + "(\\[[^\\]]*\\]|:{1,2}[\\w-]+|\\.[\\w-]+|#[\\w-]+)*\\s*$", classOrIdSelector ? "" : "i");
for (i = 0; i < allSelectors.length; i++) {
if (allSelectors[i].selector.search(re) !== -1) {
result.push(allSelectors[i]);
} else if (!classOrIdSelector) {
// Special case for tag selectors - match "*"
if (allSelectors[i].selector.trim() === "*") {
result.push(allSelectors[i]);
}
}
}

Expand Down

0 comments on commit cb6a1a7

Please sign in to comment.