Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added README, added rules, fixed typo. #1

Merged
merged 9 commits into from

2 participants

@imbrianj
Collaborator

No description provided.

@imbrianj
Collaborator

Not completely certain of the "form > *:not(fieldset)" rule as it's not necessarily wrong - but is good practice in most cases. Leaving it in for now.

@imbrianj imbrianj merged commit 3817731 into yahoo:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 4, 2011
  1. A few more simple rules. Fixed a typo.

    Brian J authored
  2. @imbrianj
  3. @imbrianj

    OCD

    imbrianj authored
Commits on Oct 5, 2011
  1. @andresn

    Added checks for when inline styles are applied to a table tag. Furth…

    andresn authored
    …er, added an example / test / playground page.
  2. @imbrianj

    Merge pull request #1 from andresn/master

    imbrianj authored
    Checks for inline styles applied to table tag as well as test page
  3. @imbrianj
  4. @imbrianj
Commits on Oct 6, 2011
  1. @imbrianj
  2. @imbrianj

    Move playgrounds to gh-pages

    imbrianj authored
This page is out of date. Refresh to see the latest.
Showing with 120 additions and 16 deletions.
  1. +22 −0 README.md
  2. +98 −16 debugCSS.css
View
22 README.md
@@ -0,0 +1,22 @@
+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 (X)HTML.
+
+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."
+
+About
+---
+Each condition is specified in three areas:
+
+ - Setting up the :after area for display (trying to reset common styles like colors, font sizes, etc).
+ - Specifying the color severity (green, yellow, red) and content (which is the error or warning message to be displayed).
+ - Creating the outline around the offending element according to it's color severity.
View
114 debugCSS.css
@@ -15,8 +15,8 @@
/*****************/
/* 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
+ broken, malformed or legacy (X)HTML. 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."
*/
@@ -25,13 +25,22 @@
/* ERROR MESSAGES */
/******************/
-/* All errors should try to post a message explaning the problem. */
+/* All errors should try to post a message explaining the problem. */
+table:not([summary]):after,
table > tr:after,
+table th:not([scope]):after,
table thead td:after,
table > tbody:first-child:after,
+table > tbody + tfoot:after,
table > tr:first-child:last-child:after,
table > tbody > tr:first-child:last-child:after,
+table > *:not(thead):not(tfoot):not(tbody):not(tr):not(colgroup):not(caption):after,
+table[align]:after,
+table[bgcolor]:after,
table[border]:after,
+table[cellpadding]:after,
+table[cellspacing]:after,
+table[width]:after,
img:not([alt]):after,
a:not([href]):after,
a[href="#"]:after,
@@ -59,11 +68,18 @@ html[xmlns] a h6:after,
ol > *:not(li),
ul > *:not(li),
dl > *:not(dt):not(dd):after,
+form > *:not(fieldset):after,
+fieldset *:not(legend):first-child:after,
+iframe:not([title]):after,
+center:after,
+u:after,
font:after,
+map:after,
b:after,
i:after,
blink:after,
marquee:after {
+ border: 1px solid #000;
color: #000;
display: block;
font-family: helvetica;
@@ -80,35 +96,60 @@ marquee:after {
element.
*/
+table:not([summary]):after {
+ background: green;
+ content: 'Should you have a SUMMARY attribute on your TABLE?';
+}
+
table > tr:after {
background: yellow;
- content: 'Table does not have a tbody';
+ content: 'TABLE does not have a TBODY.';
+}
+
+table th:not([scope]):after {
+ background: green;
+ content: 'Should TH have a SCOPE attribute (ROW or COL)?.';
}
table thead td:after {
background: green;
- content: 'Cells in thead should be th.';
+ content: 'Cells in THEAD should be TH.';
}
table > tbody:first-child:after {
background: green;
- content: 'Do you need a thead or tfoot?';
+ content: 'Do you need a THEAD or TFOOT?';
+}
+
+table > tbody + tfoot:after {
+ background: yellow;
+ content: 'TBODY should come after 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?';
+ content: 'Only one TR in TABLE. Are you using it for layout?';
+}
+
+table > *:not(thead):not(tfoot):not(tbody):not(tr):not(colgroup):not(caption):after {
+ background: yellow;
+ content: 'Only THEAD/TFOOT/TBODY/COLGROUP/CAPTION/TR can be children of a TABLE';
}
-table[border]:after {
+table[align]:after,
+table[bgcolor]:after,
+table[border]:after,
+table[cellpadding]:after,
+table[cellspacing]:after,
+table[width]:after {
background: yellow;
content: 'Element has inline style.';
}
img:not([alt]):after {
background: yellow;
- content: 'Image does not have an alt tag.';
+ content: 'Image does not have an ALT attribute.';
}
a[href="#"]:after,
@@ -127,17 +168,17 @@ a[onmouseout]:after {
label:not([for]):after {
background: green;
- content: 'Should label have a for attribute?';
+ content: 'Should LABEL have a FOR attribute?';
}
nav:not([role]):after {
background: yellow;
- content: 'Nav element should have a role.';
+ content: 'NAV element should have a ROLE attribute.';
}
div[role="img"]:not([aria-label]):after {
background: yellow;
- content: 'Div used as image should have aria-label';
+ content: 'DIV used as image should have ARIA-LABEL.';
}
h1 div:after,
@@ -169,18 +210,44 @@ dl > *:not(dt):not(dd):after {
content: 'Only DT/DD can be children of a DL';
}
+form > *:not(fieldset):after {
+ background: green;
+ content: 'Should you be using a FIELDSET?';
+}
+
+fieldset *:not(legend):first-child:after {
+ background: green;
+ content: 'Should your FIELDSET be using a LEGEND?';
+}
+
+iframe:not([title]):after {
+ background: green;
+ content: 'IFRAME lacks TITLE attribute.';
+}
+
+center:after,
+u:after,
font:after {
background: yellow;
content: 'Deprecated tag used.';
}
/* These may not be "wrong", but let's bug you anyway. */
+map:after {
+ background: green;
+ content: 'Is MAP appropriate here?';
+}
+
b:after,
-i:after,
+i:after {
+ background: green;
+ content: 'Should you be using STRONG or EM?';
+}
+
blink:after,
marquee:after {
- background: green;
- content: 'Should you be using strong or em?';
+ background: yellow;
+ content: 'Should you be using STRONG or EM?';
}
/******************/
@@ -192,17 +259,27 @@ marquee:after {
messing with the document flow.
*/
+table:not([summary]),
+table th:not([scope]),
table thead td,
table > tr:first-child:last-child,
table > tbody > tr:first-child:last-child,
table > tbody:first-child,
+map,
b,
i {
outline: 5px solid green;
}
table > tr,
+table > tbody + tfoot,
+table > *:not(thead):not(tfoot):not(tbody):not(tr):not(colgroup):not(caption),
+table[align],
+table[bgcolor],
table[border],
+table[cellpadding],
+table[cellspacing],
+table[width],
img:not([alt]),
a:not([href]),
a[href="#"],
@@ -229,7 +306,12 @@ html[xmlns] a h5,
html[xmlns] a h6,
ol > *:not(li),
ul > *:not(li),
-dl > *:not(dt):not(dd):after,
+dl > *:not(dt):not(dd),
+form > *:not(fieldset),
+fieldset *:not(legend):first-child,
+iframe:not([title]),
+center,
+u,
font,
blink,
marquee {
Something went wrong with that request. Please try again.