Giter VIP home page Giter VIP logo

revenge.css's Introduction

REVENGE.CSS

The premise of revenge.css is simple: A CSS bookmarklet that uses selectors to find bad markup, displaying ugly pink error messages in comic sans serif wherever you write bad HTML. If you activate the bookmarklet and the page gets lots of pink blotches, the author has included at least one of the following:

  • Misplaced <div>s
  • Deprecated elements
  • Malformed hyperlinks
  • Inaccessible forms
  • Empty elements
  • Inaccessible images
  • Missing ARIA landmarks
  • Badly authored sectioning elements
  • Erroneous lists
  • Obsolete attributes

Try the bookmarklet

GitHub won't let me use javascript in my README. Pretty sensible. Go to the new hot pink, skull-festooned demo page.

revenge.css's People

Contributors

heydon avatar denis-sokolov avatar fizker avatar jibbius avatar codingkittens avatar saharjs avatar

Stargazers

Olivier Philippon avatar lifes engine-ATGC avatar Maximilian Franzke avatar Mojtaba Fallah avatar Alexander Kazachkov avatar Razouck avatar Oleksandr Rodik avatar Luke Harby avatar Elaine avatar  avatar  avatar Simon Vreeman avatar Alvin80Bcn avatar Christine Moore avatar Thomas Clausen avatar joanne avatar Yuhei Yasuda avatar Don W avatar Frans de Jonge avatar R van der Feer avatar Anton Shumskyi avatar Jim Withington avatar  avatar Andrew Kazakov avatar Serhii Khalimon avatar Mojtaba Seyedi avatar Sebastián Altamirano avatar Gear Chalermkried avatar  avatar Sofie avatar Marco Campos avatar D7460N avatar Corcules avatar Aleksandr Teterin avatar  avatar Tobias Lidskog avatar Jan Deppisch avatar Maurice Snip avatar Roman Ryzhikov avatar Thalia avatar Tsalik Mozgunov avatar Daniel Lewandowski avatar Graham Harper avatar Vic avatar Matt Soria avatar Adonis Karavokyros avatar Rafael Bardini avatar Artur Parkhisenko avatar Christos Zisopoulos avatar Kouki Itou avatar Viki avatar Spike avatar Fedorov Ignatij avatar Daniele Zeppieri avatar Szabin avatar Ron Martinez avatar dai avatar Luke Fromhold avatar Russel Porosky avatar  avatar Chauncey McAskill avatar  avatar morbidick avatar Alexey Istomin avatar Artem Korsunov avatar Elvir Bekirov avatar Nikita avatar Julien Tanguy avatar  avatar Dante Catalfamo avatar Pascal Hofmann avatar Chenxuan Huang avatar  avatar Ben Peachey avatar Sean McPherson avatar Marty McGuire avatar Ufuoma 0tega  avatar Vaibhav Malaviya avatar Jimmy Briggs avatar Vitalii Kiiko avatar Andrea S avatar stieglitzz avatar Andreas Ofner avatar  avatar  avatar  avatar Shannon avatar ChattyTurtle avatar kzndotsh avatar  avatar  avatar Germán Freixinós avatar  avatar  avatar Daniel Candeira avatar Lene Saile avatar Michael Gira avatar Karl Guillotte avatar Alexandra Vivdičová avatar  avatar

Watchers

 avatar Thomas Puppe avatar Juan Fernandes avatar  avatar Hyubsoo Nam avatar James Cloos avatar Sobral avatar Ravi Sundram avatar Александр avatar Christian Oliff avatar Doug Gibson avatar Frank Reding avatar Ephraim Härer avatar Jake Hoggans avatar Peter Monte avatar Tom Lutzenberger avatar Henry Tran avatar Peter Ivanov avatar Jeremy Muse avatar Paul Miller avatar Сергей Бердюг avatar Power Of The Cross 01 avatar Germán Freixinós avatar Benjamin Schodts avatar Robot avatar  avatar  avatar  avatar  avatar  avatar

revenge.css's Issues

Being less agressive

Hey Heydon!

First of all, I love the idea. I think it does a great job showing what's not great in a web page with CSS only however I think it's a bit too agressive for someone who justs want to make sure he didn't do something awful.

I'd like to see several levels of warnings like:

  • smooth: not great but okay,
  • okay: not a good idea,
  • bad: mostly a bad idea,
  • agressive: omfg? how dare u?.

I think using Sass would make things easier. For instance, we could have a mixin accepting a warning level or something, that would then dump only the rules for this level and below.

Then a Compass extension, a npm package or anything would make it very cool to use. Like:

@import "revenge.css";
@include revenge('agressive'); // or whatever like this

Just my 2 cents. I like what you did so far. :)

Update: having a closer look at the code, I think we even could have warning levels like aria, a11y, semantics, etc.

Not an issue just seeking opinion on updates to CSS

Hi @Heydon

I made a few changes in a forked version and if you get a spare moment would appreciate your comments.

https://github.com/Decrepidos/REVENGE.CSS

Added or removed the following:

Added not:span.fa and i.fa to exclude Font Awesomeicons hooks on empty elements.

Added i.fa:not([aria-hidden="true"])::after, span.fa:not([aria-hidden="true"])::after {
content: 'Use aria-hidden="true on icons.' !important;
} to make sure aria-hidden is included on icons

Removed as

requires role=contentInfo and requires role=banner as these are already conveyed natively. W3C validator generates a warning if used.

/*
body > div#footer:not([role="contentinfo"])::after, body > div.footer:not([role="contentinfo"])::after {
content: 'Use role="contentinfo" on this footer element or use native HTML5

.' !important;
}
body > div#header:not([role="banner"])::after, body > div.header:not([role="banner"])::after, body > div.banner:not([role="banner"])::after, body > div#banner:not([role="banner"])::after {
content: 'Use role="banner" on this header element or use native .' !important;
}
*/

/***
Added if div has class or ID of header but is not a native element include role. Considering if .banner #banner should be included
*/
div#header:not([role="banner"])::after, div.header:not([role="banner"])::after {
content: 'Use role="banner" on this header element or use native

.' !important;
}
Regards
Laurence

Is the message suggesting ”Forms must have action attributes” still relevant?

Arrived here from @brucelawson's 10/12/19 post (https://www.brucelawson.co.uk/2019/checklist-to-avoid-the-most-common-accessibility-errors/) where he recommends this bookmarklet for checking certain common accessibility errors.

Similar to the issue he logged (#25), is the “Forms must have action attributes” still relevant?

HTML5 spec https://www.w3.org/TR/html52/sec-forms.html#element-attrdef-submitbuttonelements-formaction:

The action and formaction content attributes, if specified, must have a value that is a valid non-empty URL potentially surrounded by spaces.

'If specified' as in 'optional'? This answer on StackOverflow seems to think so (https://stackoverflow.com/questions/9401521/is-action-really-required-on-forms). According to them it was required in HTML4 but not in HTML5 and can be left off. So if doctype is HTML5 there is no need for the action attribute?

Explain yourself

Hi Heydon,

I love this and have had a lot of fun using it on my website and my competitors (yes, I get a real kick out of seeing how many HTML fuck-ups they've made)

What I really think the project needs however is some explanation as to why some things are bad.

I imagine where a rule isn't considered best practices, you still have some very logical reasons, but it would be useful to know them.

For example, I am quite puzzled about why I often see If you are going to make it look like a button, make it a button, dammit! on <a class="button"> elements. These 'buttons' are hyperlinks and should work without JavaScript and be seen as links by search engines and screen readers. Does that mean they should not look like buttons? I think that's a very harsh limitation to a designer.

Thanks for your time and contributions to the web community.
Tom

Recommendation: sr-only class in Twitter Bootstrap

I find the sr-only class used for off-screen screen reader only text used in sites. Often it is used unnecessarily. For example: <h2 class=”sr-only”> This is the site header</h2>.
I recommend including the following to flag this.
.sr-only:after{
content: 'Off-screen text for screen reader users. Is this text necessary?' !important;
}

Move to `::after`

Since you don't aim at supporting IE 8 based on the number of :not() occurrences, I think you could move all the :after to ::after to stick to the specifications.

No big deal, just a minor improvement.

li[role="separator"] shouldn't be recommended since it's invalid

One of your error messages is:

Do not use list items to divide up lists unless they have role = separator

However <li role="separator"> is invalid per http://www.w3.org/TR/html5/dom.html#sec-implicit-aria-semantics :

  • Language feature: li element whose parent is an ol or ul element
  • Restrictions: If specified, role must be one of the following: listitem, menuitem, menuitemcheckbox, menuitemradio, option, radio, tab, treeitem or presentation

Note how separator is absent from that list.

Perhaps presentation should be recommended instead?

Add version to bookmarklet

I'd love to see some indication of which version I've got stored on my bookmarks bar, compared to the current master version. Is it possible to add a version near the beginning of the bookmarklet code?

i.e.
javascript:(function(){'1.0.0';revenge=document.createEleme...
or
javascript:(function(){version='1.0.0';revenge=document.createEleme...
?

I realise that the bookmarklet is just a way to link in the .css, but it still wouldn't hurt to have a version present.

Wrong `img` rule

I believe there is a rule matching all correctly formated images:

img[alt]:not([alt=""])

This targets all img tags with an alt attribute which is not empty. So... Every properly formated image as far as I know. I believe you want to target:

img[alt=""]

... but you might want to override this rule for images in figure, because it's common practice to empty the alt attribute when there is a figcaption.

DL permits DIV as direct child since "HTML5" and adjacent DTs and DDs

dl > *:not(dt):not(dd),

Sure this style predates HTML5 and HTML Living Standard, so hard to criticize, but nowadays it is allowed to have non-nested DIV elements inside DL:

https://html.spec.whatwg.org/multipage/grouping-content.html#the-dl-element:concept-element-content-model

dt + *:not(dd),

Also AFAIK it newer was a mistake to have multiple definitiondescription therms defscribed by one or more DD.

So such sample should suffer no revenge:

<dl>
  <div>
   <dt>foo</dt>
   <dt>bar</dt>
   <dt>baz</dt>
   <dd>Very common metasyntactic variables.</dd>
   <dd>Frowned-upon words without meaning often seen in programming handbooks.</dd>
  </div>
  <div>
    <dt>metasyntactic variable</dt>
    <dd><q cite="https://en.wikipedia.org/wiki/Metasyntactic_variable">specific word or set of words identified as a placeholder in computer science and specifically computer programming</q></dd>
  </div>
</dl>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.