Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Fix custom element selectors #64

Closed

Conversation

hansottowirtz
Copy link

I fixed some tokening problems for custom tags, the regexes now look for a {, a space, or the begin of another element. Now they work better with [] and :: after them. Also added some escaping on line 486 for clarity, and stopped matching more than 2 :'s on line 519. Added a test, and changed one because it did not have a {.

captura de pantalla 2016-07-08 a las 2 51 51

captura de pantalla 2016-07-08 a las 2 50 42

@hediyi
Copy link
Contributor

hediyi commented Jul 8, 2016

You know you can run the specs locally in Atom or a CLI, right?

@hansottowirtz
Copy link
Author

Yes, I found that out :) I hoped this would be a quick fix, but after the first pull request failed I did some more research and tested it.

'name': 'entity.name.tag.css'
}
{
'match': '\\b([a-zA-Z0-9]+(-[a-zA-Z0-9]+)+)(?=\\.|\\s++[^:]|\\s*[,{]|:(link|visited|hover|active|focus|target|lang|disabled|enabled|checked|indeterminate|root|nth-child()|nth-last-child()|nth-of-type()|nth-last-of-type()|first-child|last-child|first-of-type|last-of-type|only-child|only-of-type|empty|not|valid|invalid|:shadow)(\\([0-9A-Za-z]*\\))?)'
'match': '\\b(?<=\\s|^|,)(?<![\\.\\:\\)\\]-])([a-zA-Z0-9-]*)\\b(?=(?:\\.[a-z-]+|::?[a-z-]+(\\(.*\\))?|\\[.+\\])*\\s*({|,|\\s*(?=[\\[:.*#a-zA-Z])))'
Copy link
Contributor

@winstliu winstliu Jul 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

([a-zA-Z0-9-]+) would be a safer choice here I think.

@@ -483,15 +483,15 @@
]
'selector':
'begin': '\\s*(?=[\\[:.*#a-zA-Z])'
'end': '(?=[/@{)])'
'end': '(?=[\\/@{\\)])'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Oniguruma, the only characters that need to be escaped to be used literally in a character class are \[]-^.

@hediyi hediyi mentioned this pull request Aug 31, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants