Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 958e099713c106f653e8637c2eb69cfbdc416242 Brian J committed Oct 3, 2011
Showing with 237 additions and 0 deletions.
  1. +237 −0 debugCSS.css
@@ -0,0 +1,237 @@
+/***********/
+/* LICENSE */
+/***********/
+
+/* Copyrights for code authored by Yahoo! Inc. is licensed under the following terms:
+ MIT License
+ Copyright (c) 2011 Yahoo! Inc. All Rights Reserved.
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+/*****************/
+/* WHAT IS THIS? */
+/*****************/
+
+/* debugCSS is meant to be loaded on an existing page to highlight potentially
+ broken, malformed or legacy code. Not all "errors" are created equally, so
+ they are color coded to highlight severity. Green is "probably not a big
+ problem", yellow is "worth looking at" and red is "you really should fix
+ this."
+*/
+
+/******************/
+/* ERROR MESSAGES */
+/******************/
+
+/* All errors should try to post a message explaning the problem. */
+table > tr:after,
+table thead td:after,
+table > tbody:first-child:after,
+table > tr:first-child:last-child:after,
+table > tbody > tr:first-child:last-child:after,
+table[border]:after,
+img:not([alt]):after,
+a:not([href]):after,
+a[href="#"]:after,
+a[href*=javascript\:]:after,
+a[onclick]:after,
+a[onmouseover]:after,
+a[onmouseout]:after,
+label:not([for]):after,
+nav:not([role]):after,
+div[role="img"]:not([aria-label]):after,
+h1 div:after,
+h2 div:after,
+h3 div:after,
+h4 div:after,
+h5 div:after,
+h6 div:after,
+a div:after,
+span div:after,
+html[xmlns] a h1:after, /* Try to select only in XHTML documents (thanks, Thierry). */
+html[xmlns] a h2:after,
+html[xmlns] a h3:after,
+html[xmlns] a h4:after,
+html[xmlns] a h5:after,
+html[xmlns] a h6:after,
+ol > *:not(li),
+ul > *:not(li),
+dl > *:not(dt):not(dd):after,
+font:after,
+b:after,
+i:after,
+blink:after,
+marquee:after {
+ color: #000;
+ display: block;
+ font-family: helvetica;
+ font-size: 12px;
+ font-weight: normal;
+ position: absolute;
+ text-transform: none;
+ z-index: 99999;
+}
+
+/* Each error message will have a color for severity (green, yellow, red) and a
+ message. Even if the content isn't able to be displayed (such as with
+ images), they're used so you can quickly see the message when inspecting the
+ element.
+*/
+
+table > tr:after {
+ background: yellow;
+ content: 'Table does not have a tbody';
+}
+
+table thead td:after {
+ background: green;
+ content: 'Cells in thead should be th.';
+}
+
+table > tbody:first-child:after {
+ background: green;
+ content: 'Do you need a thead or tfoot?';
+}
+
+table > tr:first-child:last-child:after,
+table > tbody > tr:first-child:last-child:after {
+ background: green;
+ content: 'Only one table row in table. Are you using it for layout?';
+}
+
+table[border]:after {
+ background: yellow;
+ content: 'Element has inline style.';
+}
+
+img:not([alt]):after {
+ background: yellow;
+ content: 'Image does not have an alt tag.';
+}
+
+a[href="#"]:after,
+a:not([href]):after {
+ background: yellow;
+ content: 'Anchor tag is # or does not exist - does not degrade gracefully.';
+}
+
+a[href*=javascript\:]:after,
+a[onclick]:after,
+a[onmouseover]:after,
+a[onmouseout]:after {
+ background: yellow;
+ content: 'Inline JS on anchor.';
+}
+
+label:not([for]):after {
+ background: green;
+ content: 'Should label have a for attribute?';
+}
+
+nav:not([role]):after {
+ background: yellow;
+ content: 'Nav element should have a role.';
+}
+
+div[role="img"]:not([aria-label]):after {
+ background: yellow;
+ content: 'Div used as image should have aria-label';
+}
+
+h1 div:after,
+h2 div:after,
+h3 div:after,
+h4 div:after,
+h5 div:after,
+h6 div:after,
+a div:after,
+span div:after,
+html[xmlns] a h1:after,
+html[xmlns] a h2:after,
+html[xmlns] a h3:after,
+html[xmlns] a h4:after,
+html[xmlns] a h5:after,
+html[xmlns] a h6:after {
+ background: yellow;
+ content: 'Block level element within inline element.';
+}
+
+ol > *:not(li):after,
+ul > *:not(li):after {
+ background: yellow;
+ content: 'Only LIs can be children of UL or OL';
+}
+
+dl > *:not(dt):not(dd):after {
+ background: yellow;
+ content: 'Only DT/DD can be children of a DL';
+}
+
+font:after {
+ background: yellow;
+ content: 'Deprecated tag used.';
+}
+
+/* These may not be "wrong", but let's bug you anyway. */
+b:after,
+i:after,
+blink:after,
+marquee:after {
+ background: green;
+ content: 'Should you be using strong or em?';
+}
+
+/******************/
+/* ERROR OUTLINES */
+/******************/
+
+/* In addition to printing the error message next to the element, outline the
+ element so it's easy to spot. Use outline instead of border to avoid
+ messing with the document flow.
+*/
+
+table thead td,
+table > tr:first-child:last-child,
+table > tbody > tr:first-child:last-child,
+table > tbody:first-child,
+b,
+i {
+ outline: 5px solid green;
+}
+
+table > tr,
+table[border],
+img:not([alt]),
+a:not([href]),
+a[href="#"],
+a[href*=javascript\:],
+a[onclick],
+a[onmouseover],
+a[onmouseout],
+label:not([for]),
+nav:not([role]),
+div[role="img"]:not([aria-label]),
+h1 div,
+h2 div,
+h3 div,
+h4 div,
+h5 div,
+h6 div,
+a div,
+span div,
+html[xmlns] a h1,
+html[xmlns] a h2,
+html[xmlns] a h3,
+html[xmlns] a h4,
+html[xmlns] a h5,
+html[xmlns] a h6,
+ol > *:not(li),
+ul > *:not(li),
+dl > *:not(dt):not(dd):after,
+font,
+blink,
+marquee {
+ outline: 5px solid yellow;
+}

0 comments on commit 958e099

Please sign in to comment.