Ühilduvus standarditega - martin329/Valimised GitHub Wiki

Sisukord

1.HTML vastavus HTML5 standardile

2.CSS vastavus standardile

3.Javascript vastavus standardile

HTML vastavus HTML5 standardile

HTML failid said kõik validaatorilt rohelise tule. KAsutasime (W3C validaatorit)[http://validator.w3.org/]. Suuremate failide puhul on lisatud kood, mis enne oli ning kood, mida sai muudetud, et viia vastavusse validaatoriga.

Enne (Kood):

  • Line 1, column 2: Non-space characters found without seeing a doctype first. Expected . ...
  • Line 1, column 2: Element head is missing a required instance of child element title ...
  • Line 2, column 15: Stray doctype. <!DOCTYPE HTML>
  • Line 3, column 69: Stray start tag html. <html manifest="cache.appcache" xmlns="http://www.w3.org/1999/xhtml">
  • Line 5, column 69: Attribute http-equiv not allowed on element meta at this point. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  • Line 5, column 69: Element meta is missing required attribute itemprop. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  • Line 6, column 7: Element title not allowed as child of element body in this context. (Suppressing further errors from this subtree.) <title>Põhivaade</title>
  • Line 7, column 63: Element link is missing required attribute property. <link href="../css/css.css" rel="stylesheet" type="text/css" />
  • Line 9, column 17: Element link is missing required attribute property. media="print" />
  • Line 11, column 17: Element link is missing required attribute property. type="text/css">
  • Line 31, column 7: Stray end tag head. </head>
  • Line 34, column 28: An body start tag seen but an element of the same type was already open. <body onLoad="displayMap()">
  • Line 83, column 17: Stray start tag div. <div id="footer">
  • Line 89, column 10: Stray end tag footer. </footer>
  • Line 90, column 7: End tag for html seen, but there were unclosed elements. </html>
  • Line 83, column 17: Unclosed element div. <div id="footer">

Pärast (Kood):

  • This document was successfully checked as HTML5!

Enne (Kood):

  • Line 58, column 75: Stray end tag input. <input id="kasutajaID" name="kasutajaID" type="hidden" value=0></input>
  • Line 63, column 9: End tag br. </br>

Pärast (Kood):

  • This document was successfully checked as HTML5!
  • Using experimental feature: HTML5 Conformance Checker.
  • Using Direct Input mode: UTF-8 character encoding assumed

Enne (Kood):

  • Line 17, column 75: Stray end tag input. <input id="kasutajaID" name="kasutajaID" type="hidden" value=0></input>
  • Line 21, column 11: End tag br. </br>

Pärast (Kood):

  • This document was successfully checked as HTML5!
  • Using experimental feature: HTML5 Conformance Checker.
  • Using Direct Input mode: UTF-8 character encoding assumed.

Enne (Kood):

  • Line 5, column 7: Element head is missing a required instance of child element title. </head>

Pärast (Kood):

  • This document was successfully checked as HTML5!
  • Using experimental feature: HTML5 Conformance Checker.
  • Using Direct Input mode: UTF-8 character encoding assumed.

Enne (Kood):

  • Line 17, column 9: Stray end tag script. </script>
  • Line 19, column 7: Element head is missing a required instance of child element title. </head>
  • Line 59, column 35: Stray end tag input. id="otsing_nimevali"></input> <input type="button" value="Otsi"
  • Line 60, column 29: Stray end tag input. onclick=otsi()></input>
  • Line 75, column 48: An img element must have an alt attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images. <img src="../images/loader.gif" id=loaderimg></img>
  • Line 75, column 54: Stray end tag img. <img src="../images/loader.gif" id=loaderimg></img>

Pärast (Kood):

  • This document was successfully checked as HTML5!
  • Using experimental feature: HTML5 Conformance Checker.
  • Using Direct Input mode: UTF-8 character encoding assumed.

Enne (Kood):

  • Line 7, column 68: Stray end tag link. <link href="../css/css.css" rel="stylesheet" type="text/css"></link>
  • Line 8, column 81: Stray end tag link. ...ink href="../css/statistika-tabel.css" rel="stylesheet" type="text/css"></link>
  • Line 58, column 76: Stray end tag input. <input id="kandidaatNr" name="kandidaat" type="hidden" value=0></input>
  • Line 59, column 76: Stray end tag input. <input id="haaletajaNr" name="haaletaja" type="hidden" value=0></input>
  • Line 91, column 8: Stray end tag form. </form>

Pärast (Kood):

  • This document was successfully checked as HTML5!
  • Using experimental feature: HTML5 Conformance Checker.
  • Using Direct Input mode: UTF-8 character encoding assumed.

Enne (Kood):

  • Line 4, column 69: Attribute http-equiv not allowed on element meta at this point. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  • Line 4, column 69: Element meta is missing required attribute itemprop. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  • Line 5, column 7: Element title not allowed as child of element body in this context. (Suppressing further errors from this subtree.) <title>Hääletusnimekirja lisamise tagasiside</title>
  • Line 6, column 63: Element link is missing required attribute property. <link href="../css/css.css" rel="stylesheet" type="text/css" />

Pärast (Kood):

  • This document was successfully checked as HTML5!
  • Using experimental feature: HTML5 Conformance Checker.
  • Using Direct Input mode: UTF-8 character encoding assumed.

CSS vastavus standardile

Kontrollitud sai faili css.css, sest see sisaldab praktiliselt kogu CSS-i meie projektis. Kasutasime (W3C validaatorit)[http://jigsaw.w3.org/css-validator/]. CSS failis sai kõrvaldatud kõik vead välja arvatud veel mitte veebistandarditele vastavad web-toolkitid, mis ei tee miskit paha. Lihtsalt antud validaator ei tunnista veel neid.

Enne (Kood):

  • Value Error : font 13px is not a font-family value : "Trebuchet MS",Arial,Helvetica,sans-serif 13px / 1.5
  • [Warning] Property -webkit-border-radius is an unknown vendor extension
  • [Warning] Property -moz-border-radius is an unknown vendor extension
  • [Warning] Family names containing whitespace should be quoted. If quoting is omitted, any whitespace characters before and after the name are ignored and any sequence of whitespace characters inside the name is converted to a single space.

Pärast (Kood):

  • [Warning] Property -webkit-border-radius is an unknown vendor extension
  • [Warning] Property -moz-border-radius is an unknown vendor extension
  • Kuna transform ei ole veel CSS3 standard ning errorite asemel annab validaator selle kohta hoiatusi, mitte erroreid, siis otsustasime need jätta. Need hoiatused ei kahjusta kuidagi koodi ning ei muuda selle kvaliteeti halvemaks.

Javascripti vastavus standardile

Valiteeritud sai kõik javascripti failid välja arvatud jquery enda teek ning modernizer.js, mis pole meie loodud vaid on internetis genereeritud fail. Valideerimiseks sai kasutatud nii (JSLint)[http://www.jslint.com/] kui ka (JSHint)[http://jshint.com/] validaatoreid. Kõrvaldatud sai praktiliselt kõik vead. Igas failis tuli mõni rida koodi juurde lisada või muuta.

Enne:

  • Use spaces, not tabs.
  • Missing 'use strict' statement.
  • 'document' was used before it was defined.
  • Combine this with the previous 'var' statement.
  • Expected ';' and instead saw '}'.
  • Missing semicolons
  • comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==)
  • Expected '}' at column X, not column X.
  • Expected exactly one space between ')' and '{'.
  • Expected '$' at column X, not column X.
  • Expected '!==' and instead saw '!='.
  • '$' was used before it was defined.
  • Fail haaletamisTabel.js sisaldas viga The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype: for (var i in data.kandidaadid)

Pärast:

  • Asendasime "=="/"!=" "==="/"!==" vastu, et oleks täpselt võrdne antud tüübi ja arvuga.
  • Eirasime hoiatusi, mis validaator annab tühikute kohta. Kuna neid veateateid ei saa enne vastavusse validaatori tahte järgi, siis ei ole otstarbekas kogu koodi ümber kirjutada või tühikuid hakata toksima. Ajakulu oleks liiga suur aine raames ning see ei annaks erilist võitu jõudluses, etc..
  • Samuti eirasime erisusi erinevate muutujate kasutamise kohta enne defineerimist, sest need defineeritakse teises failis.
  • Funktsioonidele sai lisatud "use strict";
  • for (var i in data.kandidaadid) sai asendatud for (var i=0; i < data.kandidaadid; i++)
  • Muud süntaksi vead said parandatud.

(Kontrollitud ka teises valididaatoris (JSHint)[http://jshint.com/], mis ei näita tühikute vigu.) JSHint-jsFile-validated

⚠️ **GitHub.com Fallback** ⚠️