Adjust attribute selector regex to allow for numbers and underscores in attribute names (fixes #863, fixes #876).

This commit is contained in:
Dustin Cass
2012-07-26 15:47:53 -07:00
parent 5974b9e15a
commit 4821735ba2
3 changed files with 13 additions and 7 deletions

View File

@@ -542,7 +542,7 @@ less.Parser = function Parser(env) {
keyword: function () {
var k;
if (k = $(/^[_A-Za-z-][_A-Za-z0-9-]*/)) {
if (k = $(/^[_A-Za-z-][_A-Za-z0-9-]*/)) {
if (tree.colors.hasOwnProperty(k)) {
// detect named color
return new(tree.Color)(tree.colors[k].slice(1));
@@ -995,7 +995,7 @@ less.Parser = function Parser(env) {
if (! $('[')) return;
if (key = $(/^[a-zA-Z-]+/) || $(this.entities.quoted)) {
if (key = $(/^[a-zA-Z0-9_-]+/) || $(this.entities.quoted)) {
if ((op = $(/^[|~*$^]?=/)) &&
(val = $(this.entities.quoted) || $(/^[\w-]+/))) {
attr = [key, op, val.toCSS ? val.toCSS() : val].join('');
@@ -1117,7 +1117,7 @@ less.Parser = function Parser(env) {
mediaFeatures: function () {
var e, features = [];
do {
if (e = $(this.mediaFeature)) {
features.push(e);
@@ -1127,7 +1127,7 @@ less.Parser = function Parser(env) {
if (! $(',')) { break }
}
} while (e);
return features.length > 0 ? features : null;
},

View File

@@ -10,6 +10,9 @@
.other {
-moz-transform: translate(0, 11em) rotate(-90deg);
}
.item[data-cra_zy-attr1b-ut3=bold] {
font-weight: bold;
}
p:not([class*="lead"]) {
color: black;
}

View File

@@ -1,4 +1,4 @@
.comma-delimited {
.comma-delimited {
background: url(bg.jpg) no-repeat, url(bg.png) repeat-x top left, url(bg);
text-shadow: -1px -1px 1px red, 6px 5px 5px yellow;
-moz-box-shadow: 0pt 0pt 2px rgba(255, 255, 255, 0.4) inset,
@@ -12,8 +12,11 @@
.other {
-moz-transform: translate(0, 11em) rotate(-90deg);
}
.item[data-cra_zy-attr1b-ut3=bold] {
font-weight: bold;
}
p:not([class*="lead"]) {
color: black;
color: black;
}
input[type="text"].class#id[attr=32]:not(1) {
@@ -24,7 +27,7 @@ div#id.class[a=1][b=2].class:not(1) {
color: white;
}
ul.comma > li:not(:only-child)::after {
ul.comma > li:not(:only-child)::after {
color: white;
}