mirror of
https://github.com/less/less.js.git
synced 2026-02-06 04:55:03 -05:00
Merge pull request #879 from dmcass/attribute-selector
Allow numbers and underscores in attribute selectors
This commit is contained in:
@@ -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));
|
||||
@@ -670,7 +670,7 @@ less.Parser = function Parser(env) {
|
||||
color: function () {
|
||||
var rgb;
|
||||
|
||||
if (input.charAt(i) === '#' && (rgb = $(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/))) {
|
||||
if (input.charAt(i) === '#' && (rgb = $(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))) {
|
||||
return new(tree.Color)(rgb[1]);
|
||||
}
|
||||
},
|
||||
@@ -756,7 +756,7 @@ less.Parser = function Parser(env) {
|
||||
|
||||
if (s !== '.' && s !== '#') { return }
|
||||
|
||||
while (e = $(/^[#.](?:[\w-]|\\(?:[a-fA-F0-9]{1,6} ?|[^a-fA-F0-9]))+/)) {
|
||||
while (e = $(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)) {
|
||||
elements.push(new(tree.Element)(c, e, i));
|
||||
c = $('>');
|
||||
}
|
||||
@@ -821,7 +821,7 @@ less.Parser = function Parser(env) {
|
||||
|
||||
save();
|
||||
|
||||
if (match = $(/^([#.](?:[\w-]|\\(?:[a-fA-F0-9]{1,6} ?|[^a-fA-F0-9]))+)\s*\(/)) {
|
||||
if (match = $(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)) {
|
||||
name = match[1];
|
||||
|
||||
do {
|
||||
@@ -917,7 +917,7 @@ less.Parser = function Parser(env) {
|
||||
var e, t, c, v;
|
||||
|
||||
c = $(this.combinator);
|
||||
e = $(/^(?:\d+\.\d+|\d+)%/) || $(/^(?:[.#]?|:*)(?:[\w-]|\\(?:[a-fA-F0-9]{1,6} ?|[^a-fA-F0-9]))+/) ||
|
||||
e = $(/^(?:\d+\.\d+|\d+)%/) || $(/^(?:[.#]?|:*)(?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/) ||
|
||||
$('*') || $(this.attribute) || $(/^\([^)@]+\)/);
|
||||
|
||||
if (! e) {
|
||||
@@ -988,14 +988,14 @@ less.Parser = function Parser(env) {
|
||||
if (elements.length > 0) { return new(tree.Selector)(elements) }
|
||||
},
|
||||
tag: function () {
|
||||
return $(/^[a-zA-Z][a-zA-Z-]*[0-9]?/) || $('*');
|
||||
return $(/^[A-Za-z][A-Za-z-]*[0-9]?/) || $('*');
|
||||
},
|
||||
attribute: function () {
|
||||
var attr = '', key, val, op;
|
||||
|
||||
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;
|
||||
},
|
||||
|
||||
@@ -1160,7 +1160,7 @@ less.Parser = function Parser(env) {
|
||||
if (rules = $(this.block)) {
|
||||
return new(tree.Directive)(name + " " + types, rules);
|
||||
}
|
||||
} else if (name = $(/^@[-a-z]+/)) {
|
||||
} else if (name = $(/^@[a-z-]+/)) {
|
||||
if (name === '@font-face') {
|
||||
if (rules = $(this.block)) {
|
||||
return new(tree.Directive)(name, rules);
|
||||
@@ -1303,7 +1303,7 @@ less.Parser = function Parser(env) {
|
||||
property: function () {
|
||||
var name;
|
||||
|
||||
if (name = $(/^(\*?-?[-a-z_0-9]+)\s*:/)) {
|
||||
if (name = $(/^(\*?-?[_a-z0-9-]+)\s*:/)) {
|
||||
return name[1];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user