superhi / editor-issues

A place to report issues on the SuperHi Editor
4 stars 0 forks source link

Flag Dotted Class Name in HTML/JS/JQuery #10

Closed jacobbf closed 5 years ago

jacobbf commented 5 years ago

A common issue we've been seeing from students is the addition of CSS class dots where they aren't meant to be - primarily in JS but occasionally in HTML. They show up a lot in classList methods as well as jQuery class manipulation and HTML class attributes and as far as I can figure there's no situation where this would be intentional.

JS Ex. el.classList.add('.classthatwontadd') jQuery Ex.$('.el').addClass('.classthatwontadd') HTML Ex. `

If we could flag these categories with a yellow error that explains that they won't produce the intended behavior that would be phenomenal. Would probably also help students what the period there actually means rather than thinking it's part of the name itself.

List of classList methods List of jQuery class manipulation methods

artcommacode commented 5 years ago

Yeah we already have class validation added in for $(), jQuery(), document.querySelector() and document.querySelectorAll(), we could extend that to not only make sure somebody isn't trying to add a class like ..classthatwontadd but also that the class they're trying to add is valid and exists in their CSS or not

artcommacode commented 5 years ago
Screenshot 2019-07-05 at 15 27 27