Skip to content

Commit a47c05a

Browse files
RunDevelopmentmAAdhaTTah
authored andcommitted
Fixed lowercase supposed class names (#1544)
This PR fixes a bug with supposed class names. Lowercase supposed class names are no longer highlighted. **Before**: ![before](https://user-images.githubusercontent.com/20878432/44656379-e7c17900-a9f8-11e8-8b1a-7f1dd694263e.png) **After**: ![after](https://user-images.github usercontent.com/20878432/44656379-e7c17900-a9f8-11e8-8b1a-7f1dd694263e.png)
1 parent 2b62e57 commit a47c05a

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

components/prism-javascript.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
Prism.languages.javascript = Prism.languages.extend('clike', {
22
'class-name': [
33
Prism.languages.clike['class-name'],
4-
/[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/
4+
{
5+
pattern: /(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,
6+
lookbehind: true
7+
}
58
],
69
'keyword': [
710
{

components/prism-javascript.min.js

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

prism.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,10 @@ Prism.languages.clike = {
727727
Prism.languages.javascript = Prism.languages.extend('clike', {
728728
'class-name': [
729729
Prism.languages.clike['class-name'],
730-
/[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/
730+
{
731+
pattern: /(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,
732+
lookbehind: true
733+
}
731734
],
732735
'keyword': [
733736
{

tests/languages/javascript/supposed-classes_feature.test

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Foo.prototype.bar;
22
Bar.constructor;
3+
fooBar.prototype.bar;
34

45
----------------------------------------------------
56

@@ -14,6 +15,13 @@ Bar.constructor;
1415
["class-name", "Bar"],
1516
["punctuation", "."],
1617
"constructor",
18+
["punctuation", ";"],
19+
20+
"\nfooBar",
21+
["punctuation", "."],
22+
"prototype",
23+
["punctuation", "."],
24+
"bar",
1725
["punctuation", ";"]
1826
]
1927

0 commit comments

Comments
 (0)