Skip to content

Commit 13fed76

Browse files
committed
CSS-extras: match attribute inside selectors
1 parent d6b5c2f commit 13fed76

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

components/prism-css-extras.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Prism.languages.css.selector = {
44
'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,
55
'pseudo-class': /:[-\w]+(?:\(.*\))?/,
66
'class': /\.[-:\.\w]+/,
7-
'id': /#[-:\.\w]+/
7+
'id': /#[-:\.\w]+/,
8+
'attribute': /\[[^\]]+\]/
89
}
910
};
1011

components/prism-css-extras.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/languages/css!+css-extras/selector_feature.test

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ foo#bar {
99

1010
#foo > .bar:not(baz):after {
1111

12+
div[foo="bar"] {
13+
1214
----------------------------------------------------
1315

1416
[
@@ -43,6 +45,11 @@ foo#bar {
4345
["class", ".bar"],
4446
["pseudo-class", ":not(baz)"],
4547
["pseudo-element", ":after"]
48+
]], ["punctuation", "{"],
49+
50+
["selector", [
51+
"div",
52+
["attribute", "[foo=\"bar\"]"]
4653
]], ["punctuation", "{"]
4754
]
4855

0 commit comments

Comments
 (0)