├── .eslintrc.json ├── .gitignore ├── .travis.yml ├── Auditor ├── HTMLCSAuditor.css ├── HTMLCSAuditor.js ├── Images │ ├── HTMLCS-tools.png │ ├── bgTexture1.gif │ ├── summaryLoader-error.gif │ ├── summaryLoader-notice.gif │ └── summaryLoader-warning.gif └── beacon.js ├── Contrib ├── Build │ ├── header-bookmarklet.js │ ├── umd-footer.js │ └── umd-header.js ├── PhantomJS │ ├── HTMLCS_Run.js │ ├── runner.js │ └── test.js └── Testing │ ├── HTMLCS_Test.js │ └── run_tests.sh ├── Gruntfile.js ├── HTMLCS.Util.js ├── HTMLCS.js ├── README.markdown ├── Standards ├── Section508 │ ├── Sniffs │ │ ├── A.js │ │ ├── B.js │ │ ├── C.js │ │ ├── D.js │ │ ├── G.js │ │ ├── H.js │ │ ├── I.js │ │ ├── J.js │ │ ├── K.js │ │ ├── L.js │ │ ├── M.js │ │ ├── N.js │ │ ├── O.js │ │ └── P.js │ └── ruleset.js ├── WCAG2A │ └── ruleset.js ├── WCAG2AA │ └── ruleset.js └── WCAG2AAA │ ├── Sniffs │ ├── Principle1 │ │ ├── Guideline1_1 │ │ │ └── 1_1_1.js │ │ ├── Guideline1_2 │ │ │ ├── 1_2_1.js │ │ │ ├── 1_2_2.js │ │ │ ├── 1_2_3.js │ │ │ ├── 1_2_4.js │ │ │ ├── 1_2_5.js │ │ │ ├── 1_2_6.js │ │ │ ├── 1_2_7.js │ │ │ ├── 1_2_8.js │ │ │ └── 1_2_9.js │ │ ├── Guideline1_3 │ │ │ ├── 1_3_1.js │ │ │ ├── 1_3_1_A.js │ │ │ ├── 1_3_1_AAA.js │ │ │ ├── 1_3_2.js │ │ │ ├── 1_3_3.js │ │ │ ├── 1_3_4.js │ │ │ ├── 1_3_5.js │ │ │ └── 1_3_6.js │ │ └── Guideline1_4 │ │ │ ├── 1_4_1.js │ │ │ ├── 1_4_10.js │ │ │ ├── 1_4_11.js │ │ │ ├── 1_4_12.js │ │ │ ├── 1_4_13.js │ │ │ ├── 1_4_2.js │ │ │ ├── 1_4_3.js │ │ │ ├── 1_4_3_Contrast.js │ │ │ ├── 1_4_3_F24.js │ │ │ ├── 1_4_4.js │ │ │ ├── 1_4_5.js │ │ │ ├── 1_4_6.js │ │ │ ├── 1_4_7.js │ │ │ ├── 1_4_8.js │ │ │ └── 1_4_9.js │ ├── Principle2 │ │ ├── Guideline2_1 │ │ │ ├── 2_1_1.js │ │ │ ├── 2_1_2.js │ │ │ └── 2_1_4.js │ │ ├── Guideline2_2 │ │ │ ├── 2_2_1.js │ │ │ ├── 2_2_2.js │ │ │ ├── 2_2_3.js │ │ │ ├── 2_2_4.js │ │ │ ├── 2_2_5.js │ │ │ └── 2_2_6.js │ │ ├── Guideline2_3 │ │ │ ├── 2_3_1.js │ │ │ ├── 2_3_2.js │ │ │ └── 2_3_3.js │ │ ├── Guideline2_4 │ │ │ ├── 2_4_1.js │ │ │ ├── 2_4_2.js │ │ │ ├── 2_4_3.js │ │ │ ├── 2_4_4.js │ │ │ ├── 2_4_5.js │ │ │ ├── 2_4_6.js │ │ │ ├── 2_4_7.js │ │ │ ├── 2_4_8.js │ │ │ └── 2_4_9.js │ │ └── Guideline2_5 │ │ │ ├── 2_5_1.js │ │ │ ├── 2_5_2.js │ │ │ ├── 2_5_3.js │ │ │ ├── 2_5_4.js │ │ │ ├── 2_5_5.js │ │ │ └── 2_5_6.js │ ├── Principle3 │ │ ├── Guideline3_1 │ │ │ ├── 3_1_1.js │ │ │ ├── 3_1_2.js │ │ │ ├── 3_1_3.js │ │ │ ├── 3_1_4.js │ │ │ ├── 3_1_5.js │ │ │ └── 3_1_6.js │ │ ├── Guideline3_2 │ │ │ ├── 3_2_1.js │ │ │ ├── 3_2_2.js │ │ │ ├── 3_2_3.js │ │ │ ├── 3_2_4.js │ │ │ └── 3_2_5.js │ │ └── Guideline3_3 │ │ │ ├── 3_3_1.js │ │ │ ├── 3_3_2.js │ │ │ ├── 3_3_3.js │ │ │ ├── 3_3_4.js │ │ │ ├── 3_3_5.js │ │ │ └── 3_3_6.js │ └── Principle4 │ │ └── Guideline4_1 │ │ ├── 4_1_1.js │ │ ├── 4_1_2.js │ │ └── 4_1_3.js │ └── ruleset.js ├── Tests └── WCAG2 │ ├── 1_1_1_NullAltText.html │ ├── 1_3_1_Heading_Alt_Test.html │ ├── 1_3_1_Labels.html │ ├── 1_3_1_Labels_Hidden.html │ ├── 1_3_1_Presentation_Roles.html │ ├── 1_3_1_Table_Header_Attr.html │ ├── 1_4_3_Contrast.html │ ├── 2_1_1_Keyboard_Events.html │ ├── 2_4_1_Bypass.html │ ├── 3_2_2_Form_Input.html │ ├── 4_1_2_Aria_Labels.html │ ├── 4_1_2_SelectOptionSelected.html │ └── 4_1_2_wrapping_label.html ├── Translations ├── cn.js ├── en.js ├── fr.js ├── it.js ├── ja.js ├── nl.js └── pl.js ├── index.js ├── licence.txt └── package.json /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "node": false 5 | }, 6 | "extends": "eslint:recommended", 7 | "rules": { 8 | "indent": [ 9 | "error", 10 | 4 11 | ], 12 | "linebreak-style": [ 13 | "error", 14 | "unix" 15 | ], 16 | "semi": [ 17 | "error", 18 | "always" 19 | ], 20 | "no-console": 0, 21 | "no-undef": 0, 22 | "no-unused-vars": [ 23 | "error", { 24 | "args": "none" 25 | } 26 | ], 27 | "no-redeclare": 0 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | package-lock.json 2 | 3 | # Build files # 4 | ############### 5 | build/ 6 | node_modules/ 7 | Auditor/Auditor_with_beacon.js 8 | *.tgz 9 | 10 | # OS generated files # 11 | ###################### 12 | .DS_Store 13 | .DS_Store? 14 | ._* 15 | .Spotlight-V100 16 | .Trashes 17 | Icon? 18 | ehthumbs.db 19 | Thumbs.db 20 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - "10" 5 | script: 6 | - npm test 7 | cache: 8 | directories: 9 | - node_modules 10 | matrix: 11 | fast_finish: true 12 | -------------------------------------------------------------------------------- /Auditor/Images/HTMLCS-tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfed/AccessibilityCheck/7c18c5dee8a783964ddd972dc4482facc43b4ee1/Auditor/Images/HTMLCS-tools.png -------------------------------------------------------------------------------- /Auditor/Images/bgTexture1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfed/AccessibilityCheck/7c18c5dee8a783964ddd972dc4482facc43b4ee1/Auditor/Images/bgTexture1.gif -------------------------------------------------------------------------------- /Auditor/Images/summaryLoader-error.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfed/AccessibilityCheck/7c18c5dee8a783964ddd972dc4482facc43b4ee1/Auditor/Images/summaryLoader-error.gif -------------------------------------------------------------------------------- /Auditor/Images/summaryLoader-notice.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfed/AccessibilityCheck/7c18c5dee8a783964ddd972dc4482facc43b4ee1/Auditor/Images/summaryLoader-notice.gif -------------------------------------------------------------------------------- /Auditor/Images/summaryLoader-warning.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfed/AccessibilityCheck/7c18c5dee8a783964ddd972dc4482facc43b4ee1/Auditor/Images/summaryLoader-warning.gif -------------------------------------------------------------------------------- /Contrib/Build/header-bookmarklet.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | (function (root, factory) { 14 | var exports = factory(); 15 | for (var prop in exports) { 16 | root[prop] = exports[prop]; 17 | } 18 | }(this, function () { 19 | var _global = { 20 | translation: {} 21 | }; 22 | -------------------------------------------------------------------------------- /Contrib/Build/umd-footer.js: -------------------------------------------------------------------------------- 1 | // Expose globals. 2 | return _global; 3 | })); -------------------------------------------------------------------------------- /Contrib/Build/umd-header.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | (function (root, factory) { 14 | if (typeof define === 'function' && define.amd) { 15 | define('htmlcs', factory); 16 | } else if (typeof exports === 'object') { 17 | module.exports = factory(); 18 | } else { 19 | var exports = factory(); 20 | for (var prop in exports) { 21 | root[prop] = exports[prop]; 22 | } 23 | } 24 | }(this, function () { 25 | var _global = { 26 | translation: {} 27 | }; 28 | -------------------------------------------------------------------------------- /Contrib/PhantomJS/runner.js: -------------------------------------------------------------------------------- 1 | /* exported HTMLCS_RUNNER */ 2 | var HTMLCS_RUNNER = _global.HTMLCS_RUNNER = new function() { 3 | this.run = function(standard, callback) { 4 | var self = this; 5 | 6 | // At the moment, it passes the whole DOM document. 7 | HTMLCS.process(standard, document, function() { 8 | var messages = HTMLCS.getMessages(); 9 | var length = messages.length; 10 | var msgCount = {}; 11 | msgCount[HTMLCS.ERROR] = 0; 12 | msgCount[HTMLCS.WARNING] = 0; 13 | msgCount[HTMLCS.NOTICE] = 0; 14 | 15 | for (var i = 0; i < length; i++) { 16 | self.output(messages[i]); 17 | msgCount[messages[i].type]++; 18 | } 19 | console.log('done'); 20 | }, function() { 21 | console.log('Something in HTML_CodeSniffer failed to parse. Cannot run.'); 22 | console.log('done'); 23 | }, 'en'); 24 | }; 25 | 26 | this.output = function(msg) { 27 | // Simple output for now. 28 | var typeName = 'UNKNOWN'; 29 | switch (msg.type) { 30 | case HTMLCS.ERROR: 31 | typeName = _global.HTMLCS.getTranslation("auditor_error"); 32 | break; 33 | 34 | case HTMLCS.WARNING: 35 | typeName = _global.HTMLCS.getTranslation("auditor_warning"); 36 | break; 37 | 38 | case HTMLCS.NOTICE: 39 | typeName = _global.HTMLCS.getTranslation("auditor_notice"); 40 | break; 41 | }//end switch 42 | 43 | var nodeName = ''; 44 | if (msg.element) { 45 | nodeName = msg.element.nodeName.toLowerCase(); 46 | } 47 | 48 | var elementId = ''; 49 | if (msg.element.id && (msg.element.id !== '')) { 50 | elementId = '#' + msg.element.id; 51 | } 52 | 53 | // Clone the node to get it's outerHTML (with inner replaced with ... for brevity) 54 | var html = ''; 55 | if (msg.element.outerHTML) { 56 | var node = msg.element.cloneNode(true); 57 | node.innerHTML = '...'; 58 | html = node.outerHTML; 59 | } 60 | 61 | console.log('[HTMLCS] ' + typeName + '|' + msg.code + '|' + nodeName + '|' + elementId + '|' + msg.msg + '|' + html); 62 | }; 63 | 64 | }; 65 | -------------------------------------------------------------------------------- /Contrib/PhantomJS/test.js: -------------------------------------------------------------------------------- 1 | var data = ''; 2 | 3 | process.stdin.resume(); 4 | process.stdin.setEncoding('utf8'); 5 | 6 | process.stdin.on('data', function(chunk) { 7 | data += chunk; 8 | }); 9 | 10 | function toHTML(obj) { 11 | return '' + 12 | '${obj.code}' + 13 | '${obj.msg}' + 14 | ''; 15 | } 16 | 17 | process.stdin.on('end', function() { 18 | var issues = JSON.parse(data); 19 | var html = '' + 20 | '' + 21 | ' ' + 22 | '' + 23 | '' + 25 | '' + 26 | '' + 27 | issues.map(toHTML).join('') + 28 | '' + 29 | '
CodeMessage' + 24 | '
'; 30 | console.log(html); 31 | }); 32 | -------------------------------------------------------------------------------- /Contrib/Testing/run_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | WD=$PWD 4 | NUMFAIL=0 5 | NUMPASS=0 6 | NUMTESTS=0 7 | cd ../../Tests 8 | FILES=`find . -name *.html` 9 | cd $WD 10 | for FILE in $FILES; do 11 | REMAIN=`expr $NUMTESTS % 40` 12 | if [[ "x$REMAIN" == "x0" ]]; then 13 | if [[ "x$NUMTESTS" != "x0" ]]; then 14 | echo ' ' 15 | fi 16 | fi 17 | 18 | NUMTESTS=`expr $NUMTESTS + 1` 19 | phantomjs HTMLCS_Test.js $FILE 20 | if [[ "x$?" == "x0" ]]; then 21 | NUMPASS=`expr $NUMPASS + 1` 22 | echo -n "PASS $FILE" 23 | else 24 | NUMFAIL=`expr $NUMFAIL + 1` 25 | echo -n "FAIL $FILE" 26 | fi 27 | done 28 | 29 | echo '' 30 | echo "Tests: $NUMTESTS, Passed: $NUMPASS, Failed: $NUMFAIL" -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = function (grunt) { 3 | grunt.initConfig({ 4 | pkg: grunt.file.readJSON('./package.json'), 5 | eslint: { 6 | target: ['Standards/**/*.js', 'Contrib/PhantomJS/*.js'] 7 | }, 8 | uglify: { 9 | debug: { 10 | options: { 11 | compress: false, 12 | mangle: false, 13 | beautify: true, 14 | preserveComments: true, 15 | banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */\n' + grunt.file.read('Contrib/Build/umd-header.js'), 16 | footer: grunt.file.read('Contrib/Build/umd-footer.js') 17 | }, 18 | files: { 19 | 'build/HTMLCS.js': ['Translations/*.js', 'Standards/**/*.js', 'HTMLCS.js', 'HTMLCS.Util.js', 'Contrib/PhantomJS/runner.js', 'Auditor/HTMLCSAuditor.js'] 20 | } 21 | }, 22 | dist: { 23 | options: { 24 | banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */\n' + grunt.file.read('Contrib/Build/umd-header.js'), 25 | footer: grunt.file.read('Contrib/Build/umd-footer.js') 26 | }, 27 | files: { 28 | 'build/HTMLCS.js': ['Translations/*.js', 'Standards/**/*.js', 'HTMLCS.js', 'HTMLCS.Util.js', 'Contrib/PhantomJS/runner.js', 'Auditor/HTMLCSAuditor.js'] 29 | } 30 | }, 31 | bookmarklet: { 32 | options: { 33 | banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */\n' + grunt.file.read('Contrib/Build/header-bookmarklet.js'), 34 | footer: grunt.file.read('Contrib/Build/umd-footer.js') 35 | }, 36 | files: { 37 | 'build/HTMLCS.js': ['Translations/*.js', 'Standards/**/*.js', 'HTMLCS.js', 'HTMLCS.Util.js', 'Contrib/PhantomJS/runner.js', 'Auditor/Auditor_with_beacon.js'] 38 | } 39 | } 40 | }, 41 | copy: { 42 | dist: { 43 | files: [ 44 | { 45 | expand: true, 46 | flatten: true, 47 | src: 'Auditor/HTMLCSAuditor.css', 48 | rename: function (dest, src) { 49 | return dest + '/HTMLCS.css'; 50 | }, 51 | dest: 'build', 52 | filter: 'isFile' 53 | }, { 54 | expand: true, 55 | flatten: true, 56 | src: 'Auditor/Images/*', 57 | dest: 'build/Images', 58 | filter: 'isFile' 59 | }, { 60 | expand: true, 61 | flatten: true, 62 | src: 'licence.txt', 63 | dest: 'build', 64 | filter: 'isFile' 65 | } 66 | ] 67 | } 68 | } 69 | }); 70 | 71 | grunt.file.setBase('./'); 72 | require('load-grunt-tasks')(grunt); 73 | 74 | grunt.registerTask('default', ['eslint']); 75 | grunt.registerTask('build', ['uglify:dist', 'copy:dist']); 76 | grunt.registerTask('build-bookmarklet', ['uglify:bookmarklet', 'copy:dist']); 77 | 78 | return grunt.registerTask('build-debug', ['uglify:debug', 'copy:dist']); 79 | }; 80 | -------------------------------------------------------------------------------- /Standards/Section508/Sniffs/B.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Australia Pty Ltd ABN 53 131 581 247 | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_Section508_Sniffs_B = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'object', 27 | 'applet', 28 | 'embed', 29 | 'video' 30 | ]; 31 | 32 | }, 33 | 34 | /** 35 | * Process the registered element. 36 | * 37 | * @param {DOMNode} element The element registered. 38 | * @param {DOMNode} top The top element of the tested code. 39 | */ 40 | process: function(element, top) 41 | { 42 | HTMLCS.addMessage(HTMLCS.NOTICE, element, 'For multimedia containing video, ensure a synchronised audio description or text alternative for the video portion is provided.', 'Video'); 43 | HTMLCS.addMessage(HTMLCS.NOTICE, element, 'For multimedia containing synchronised audio and video, ensure synchronised captions are provided for the audio portion.', 'Captions'); 44 | 45 | } 46 | }; 47 | -------------------------------------------------------------------------------- /Standards/Section508/Sniffs/C.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Australia Pty Ltd ABN 53 131 581 247 | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_Section508_Sniffs_C = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, 'Ensure that any information conveyed using colour alone is also available without colour, such as through context or markup.', 'Colour'); 38 | 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /Standards/Section508/Sniffs/D.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Australia Pty Ltd ABN 53 131 581 247 | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_Section508_Sniffs_D = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | if (element === top) { 38 | HTMLCS.addMessage(HTMLCS.NOTICE, top, 'Ensure that content is ordered in a meaningful sequence when linearised, such as when style sheets are disabled.', 'Linearised'); 39 | this.testPresentationMarkup(top); 40 | this.testHeadingOrder(top); 41 | 42 | // Look for any script elements, and fire off another notice regarding 43 | // potentially hidden text (eg. "click to expand" sections). For instance, 44 | // such text should be stored semantically in the page, not loaded into 45 | // a container through AJAX (and thus not accessible with scripting off). 46 | var hasScript = HTMLCS.util.getAllElements(top, 'script, link[rel="stylesheet"]'); 47 | if (hasScript.length > 0) { 48 | HTMLCS.addMessage(HTMLCS.NOTICE, top, 'If content is hidden and made visible using scripting (such as "click to expand" sections), ensure this content is readable when scripts and style sheets are disabled.', 'HiddenText'); 49 | } 50 | } 51 | }, 52 | 53 | /** 54 | * Test for the use of presentational elements. 55 | * 56 | * @param [DOMNode] top The top element of the tested code. 57 | */ 58 | testPresentationMarkup: function(top) 59 | { 60 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_3_1_3_1.testPresentationMarkup(top); 61 | }, 62 | 63 | testHeadingOrder: function(top) { 64 | var lastHeading = 0; 65 | var headings = HTMLCS.util.getAllElements(top, 'h1, h2, h3, h4, h5, h6'); 66 | 67 | for (var i = 0; i < headings.length; i++) { 68 | var headingNum = parseInt(headings[i].nodeName.substr(1, 1)); 69 | if (headingNum - lastHeading > 1) { 70 | var exampleMsg = 'should be an h' + (lastHeading + 1) + ' to be properly nested'; 71 | if (lastHeading === 0) { 72 | // If last heading is empty, we are at document top and we are 73 | // expecting a H1, generally speaking. 74 | exampleMsg = 'appears to be the primary document heading, so should be an h1 element'; 75 | } 76 | 77 | HTMLCS.addMessage(HTMLCS.ERROR, headings[i], 'The heading structure is not logically nested. This h' + headingNum + ' element ' + exampleMsg + '.', 'HeadingOrder'); 78 | } 79 | 80 | lastHeading = headingNum; 81 | } 82 | } 83 | 84 | }; 85 | -------------------------------------------------------------------------------- /Standards/Section508/Sniffs/G.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Australia Pty Ltd ABN 53 131 581 247 | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_Section508_Sniffs_G = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['table']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | // If no table headers, emit notice about the table. 38 | if (HTMLCS.util.isLayoutTable(element) === true) { 39 | HTMLCS.addMessage(HTMLCS.NOTICE, element, 'This table has no headers. If this is a data table, ensure row and column headers are identified using th elements.', 'TableHeaders'); 40 | } 41 | } 42 | 43 | }; 44 | -------------------------------------------------------------------------------- /Standards/Section508/Sniffs/H.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Australia Pty Ltd ABN 53 131 581 247 | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_Section508_Sniffs_H = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['table']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(table, top) 36 | { 37 | var headersAttr = HTMLCS.util.testTableHeaders(table); 38 | 39 | // Incorrect usage of headers - error; emit always. 40 | for (var i = 0; i < headersAttr.wrongHeaders.length; i++) { 41 | HTMLCS.addMessage(HTMLCS.ERROR, headersAttr.wrongHeaders[i].element, 'Incorrect headers attribute on this td element. Expected "' + headersAttr.wrongHeaders[i].expected + '" but found "' + headersAttr.wrongHeaders[i].actual + '"', 'IncorrectHeadersAttr'); 42 | } 43 | 44 | // Errors where headers are compulsory. 45 | if ((headersAttr.required === true) && (headersAttr.allowScope === false)) { 46 | if (headersAttr.used === false) { 47 | // Headers not used at all, and they are mandatory. 48 | HTMLCS.addMessage(HTMLCS.ERROR, table, 'The relationship between td elements and their associated th elements is not defined. As this table has multiple levels of th elements, you must use the headers attribute on td elements.', 'MissingHeadersAttrs'); 49 | } else { 50 | // Missing TH IDs - error; emit at this stage only if headers are compulsory. 51 | if (headersAttr.missingThId.length > 0) { 52 | HTMLCS.addMessage(HTMLCS.ERROR, table, 'Not all th elements in this table contain an id attribute. These cells should contain ids so that they may be referenced by td elements\' headers attributes.', 'MissingHeaderIds'); 53 | } 54 | 55 | // Missing TD headers attributes - error; emit at this stage only if headers are compulsory. 56 | if (headersAttr.missingTd.length > 0) { 57 | HTMLCS.addMessage(HTMLCS.ERROR, table, 'Not all td elements in this table contain a headers attribute. Each headers attribute should list the ids of all th elements associated with that cell.', 'IncompleteHeadersAttrs'); 58 | } 59 | }//end if 60 | }//end if 61 | } 62 | 63 | }; 64 | -------------------------------------------------------------------------------- /Standards/Section508/Sniffs/I.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Australia Pty Ltd ABN 53 131 581 247 | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_Section508_Sniffs_I = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'frame', 27 | 'iframe', 28 | 'object' 29 | ]; 30 | 31 | }, 32 | 33 | /** 34 | * Process the registered element. 35 | * 36 | * @param {DOMNode} element The element registered. 37 | * @param {DOMNode} top The top element of the tested code. 38 | */ 39 | process: function(element, top) 40 | { 41 | var nodeName = element.nodeName.toLowerCase(); 42 | var hasTitle = element.hasAttribute('title'); 43 | var titleEmpty = true; 44 | 45 | if (hasTitle === true) { 46 | titleEmpty = HTMLCS.util.isStringEmpty(element.getAttribute('title')); 47 | } 48 | 49 | if (titleEmpty === true) { 50 | HTMLCS.addMessage(HTMLCS.ERROR, top, 'This ' + nodeName + ' element is missing title text. Frames should be titled with text that facilitates frame identification and navigation.', 'Frames'); 51 | } 52 | } 53 | }; 54 | -------------------------------------------------------------------------------- /Standards/Section508/Sniffs/J.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Australia Pty Ltd ABN 53 131 581 247 | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_Section508_Sniffs_J = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | // The term in Sec. 508 is "flicker" rather than flash. 38 | HTMLCS.addMessage(HTMLCS.NOTICE, top, 'Check that no component of the content flickers at a rate of greater than 2 and less than 55 times per second.', 'Flicker'); 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /Standards/Section508/Sniffs/K.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Australia Pty Ltd ABN 53 131 581 247 | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_Section508_Sniffs_K = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, 'If this page cannot be made compliant, a text-only page with equivalent information or functionality should be provided. The alternative page needs to be updated in line with this page\'s content.', 'AltVersion'); 38 | } 39 | 40 | }; 41 | -------------------------------------------------------------------------------- /Standards/Section508/Sniffs/M.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Australia Pty Ltd ABN 53 131 581 247 | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_Section508_Sniffs_M = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'object', 27 | 'applet', 28 | 'bgsound', 29 | 'embed', 30 | 'audio', 31 | 'video' 32 | ]; 33 | 34 | }, 35 | 36 | /** 37 | * Process the registered element. 38 | * 39 | * @param {DOMNode} element The element registered. 40 | * @param {DOMNode} top The top element of the tested code. 41 | */ 42 | process: function(element, top) 43 | { 44 | HTMLCS.addMessage(HTMLCS.NOTICE, element, 'If external media requires a plugin or application to view, ensure a link is provided to a plugin or application that complies with Section 508 accessibility requirements for applications.', 'PluginLink'); 45 | } 46 | 47 | }; 48 | -------------------------------------------------------------------------------- /Standards/Section508/Sniffs/N.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Australia Pty Ltd ABN 53 131 581 247 | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_Section508_Sniffs_N = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['form']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | var nodeName = element.nodeName.toLowerCase(); 38 | if (nodeName === 'form') { 39 | HTMLCS.addMessage(HTMLCS.NOTICE, element, 'If an input error is automatically detected in this form, check that the item(s) in error are identified and the error(s) are described to the user in text.', 'Errors'); 40 | HTMLCS.addMessage(HTMLCS.NOTICE, element, 'Check that descriptive labels or instructions (including for required fields) are provided for user input in this form.', 'Labels'); 41 | HTMLCS.addMessage(HTMLCS.NOTICE, element, 'Ensure that this form can be navigated using the keyboard and other accessibility tools.', 'KeyboardNav'); 42 | } 43 | } 44 | 45 | }; 46 | -------------------------------------------------------------------------------- /Standards/Section508/Sniffs/O.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Australia Pty Ltd ABN 53 131 581 247 | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_Section508_Sniffs_O = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | '_top', 27 | 'a', 28 | 'area' 29 | ]; 30 | 31 | }, 32 | 33 | /** 34 | * Process the registered element. 35 | * 36 | * @param {DOMNode} element The element registered. 37 | * @param {DOMNode} top The top element of the tested code. 38 | */ 39 | process: function(element, top) 40 | { 41 | if (element === top) { 42 | HTMLCS.addMessage(HTMLCS.NOTICE, top, 'Ensure that any common navigation elements can be bypassed; for instance, by use of skip links, header elements, or ARIA landmark roles.', 'SkipLinks'); 43 | } else { 44 | if (element.hasAttribute('href') === true) { 45 | var href = element.getAttribute('href'); 46 | href = HTMLCS.util.trim(href); 47 | if ((href.length > 1) && (href.charAt(0) === '#')) { 48 | var id = href.substr(1); 49 | 50 | try { 51 | var doc = top; 52 | if (doc.ownerDocument) { 53 | doc = doc.ownerDocument; 54 | } 55 | 56 | // First search for an element with the appropriate ID, then search for a 57 | // named anchor using the name attribute. 58 | var target = doc.getElementById(id); 59 | if (target === null) { 60 | target = doc.querySelector('a[name="' + id + '"]'); 61 | } 62 | 63 | if ((target === null) || (HTMLCS.util.contains(top, target) === false)) { 64 | if ((HTMLCS.isFullDoc(top) === true) || (top.nodeName.toLowerCase() === 'body')) { 65 | HTMLCS.addMessage(HTMLCS.ERROR, element, 'This link points to a named anchor "' + id + '" within the document, but no anchor exists with that name.', 'NoSuchID'); 66 | } else { 67 | HTMLCS.addMessage(HTMLCS.WARNING, element, 'This link points to a named anchor "' + id + '" within the document, but no anchor exists with that name in the fragment tested.', 'NoSuchIDFragment'); 68 | } 69 | } 70 | } catch (ex) { 71 | // Ignore error 72 | }//end try 73 | }//end if 74 | } 75 | } 76 | } 77 | 78 | }; 79 | -------------------------------------------------------------------------------- /Standards/Section508/Sniffs/P.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Australia Pty Ltd ABN 53 131 581 247 | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_Section508_Sniffs_P = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | '_top', 27 | 'meta' 28 | ]; 29 | 30 | }, 31 | 32 | /** 33 | * Process the registered element. 34 | * 35 | * @param {DOMNode} element The element registered. 36 | * @param {DOMNode} top The top element of the tested code. 37 | */ 38 | process: function(element, top) 39 | { 40 | if (element === top) { 41 | HTMLCS.addMessage(HTMLCS.NOTICE, top, 'If a timed response is required on this page, alert the user and provide sufficient time to allow them to indicate that more time is required.', 'TimeLimit'); 42 | } else { 43 | if (element.hasAttribute('http-equiv') === true) { 44 | if ((String(element.getAttribute('http-equiv'))).toLowerCase() === 'refresh') { 45 | if (/^[1-9]\d*/.test(element.getAttribute('content').toLowerCase()) === true) { 46 | if (/url=/.test(element.getAttribute('content').toLowerCase()) === true) { 47 | // Redirect. 48 | HTMLCS.addMessage(HTMLCS.ERROR, element, 'Meta refresh tag used to redirect to another page, with a time limit that is not zero. Users cannot control this time limit.', 'MetaRedirect'); 49 | } else { 50 | // Just a refresh. 51 | HTMLCS.addMessage(HTMLCS.ERROR, element, 'Meta refresh tag used to refresh the current page. Users cannot control the time limit for this refresh.', 'MetaRefresh'); 52 | } 53 | } 54 | }//end if 55 | }//end if 56 | }//end if 57 | } 58 | 59 | }; 60 | -------------------------------------------------------------------------------- /Standards/Section508/ruleset.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Australia Pty Ltd ABN 53 131 581 247 | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_Section508 = { 15 | name: 'Section508', 16 | description: 'U.S. Section 508 Standard', 17 | shortdescription: 'US Section 508', 18 | sniffs: [ 19 | 'A', 20 | 'B', 21 | 'C', 22 | 'D', 23 | 'G', 24 | 'H', 25 | 'I', 26 | 'J', 27 | 'K', 28 | 'L', 29 | 'M', 30 | 'N', 31 | 'O', 32 | 'P' 33 | ], 34 | getMsgInfo: function(code) { 35 | var msgCodeParts = code.split('.', 3); 36 | var paragraph = msgCodeParts[1].toLowerCase(); 37 | 38 | var retval = [ 39 | ['Section', '1194.22 (' + paragraph + ')'] 40 | ]; 41 | 42 | return retval; 43 | } 44 | }; 45 | -------------------------------------------------------------------------------- /Standards/WCAG2A/ruleset.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2A = { 15 | name: 'WCAG2A', 16 | description: 'Web Content Accessibility Guidelines (WCAG) 2.1 A', 17 | shortdescription: 'WCAG 2.1 A', 18 | sniffs: [ 19 | { 20 | standard: 'WCAG2AAA', 21 | include: [ 22 | 'Principle1.Guideline1_1.1_1_1', 23 | 'Principle1.Guideline1_2.1_2_1', 24 | 'Principle1.Guideline1_2.1_2_2', 25 | 'Principle1.Guideline1_2.1_2_3', 26 | 'Principle1.Guideline1_3.1_3_1', 27 | 'Principle1.Guideline1_3.1_3_1_A', 28 | 'Principle1.Guideline1_3.1_3_2', 29 | 'Principle1.Guideline1_3.1_3_3', 30 | 'Principle1.Guideline1_4.1_4_1', 31 | 'Principle1.Guideline1_4.1_4_2', 32 | 'Principle2.Guideline2_1.2_1_1', 33 | 'Principle2.Guideline2_1.2_1_2', 34 | 'Principle2.Guideline2_1.2_1_4', 35 | 'Principle2.Guideline2_2.2_2_1', 36 | 'Principle2.Guideline2_2.2_2_2', 37 | 'Principle2.Guideline2_3.2_3_1', 38 | 'Principle2.Guideline2_4.2_4_1', 39 | 'Principle2.Guideline2_4.2_4_2', 40 | 'Principle2.Guideline2_4.2_4_3', 41 | 'Principle2.Guideline2_4.2_4_4', 42 | 'Principle2.Guideline2_5.2_5_1', 43 | 'Principle2.Guideline2_5.2_5_2', 44 | 'Principle2.Guideline2_5.2_5_3', 45 | 'Principle2.Guideline2_5.2_5_4', 46 | 'Principle3.Guideline3_1.3_1_1', 47 | 'Principle3.Guideline3_2.3_2_1', 48 | 'Principle3.Guideline3_2.3_2_2', 49 | 'Principle3.Guideline3_3.3_3_1', 50 | 'Principle3.Guideline3_3.3_3_2', 51 | 'Principle4.Guideline4_1.4_1_1', 52 | 'Principle4.Guideline4_1.4_1_2' 53 | ] 54 | } 55 | ], 56 | getMsgInfo: function(code) { 57 | return HTMLCS_WCAG2AAA.getMsgInfo(code); 58 | } 59 | }; 60 | -------------------------------------------------------------------------------- /Standards/WCAG2AA/ruleset.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AA = { 15 | name: 'WCAG2AA', 16 | description: 'Web Content Accessibility Guidelines (WCAG) 2.1 AA', 17 | shortdescription: 'WCAG 2.1 AA', 18 | sniffs: [ 19 | { 20 | standard: 'WCAG2AAA', 21 | include: [ 22 | 'Principle1.Guideline1_1.1_1_1', 23 | 'Principle1.Guideline1_2.1_2_1', 24 | 'Principle1.Guideline1_2.1_2_2', 25 | 'Principle1.Guideline1_2.1_2_4', 26 | 'Principle1.Guideline1_2.1_2_5', 27 | 'Principle1.Guideline1_3.1_3_1', 28 | 'Principle1.Guideline1_3.1_3_1_A', 29 | 'Principle1.Guideline1_3.1_3_2', 30 | 'Principle1.Guideline1_3.1_3_3', 31 | 'Principle1.Guideline1_3.1_3_4', 32 | 'Principle1.Guideline1_3.1_3_5', 33 | 'Principle1.Guideline1_4.1_4_1', 34 | 'Principle1.Guideline1_4.1_4_2', 35 | 'Principle1.Guideline1_4.1_4_3', 36 | 'Principle1.Guideline1_4.1_4_3_F24', 37 | 'Principle1.Guideline1_4.1_4_3_Contrast', 38 | 'Principle1.Guideline1_4.1_4_4', 39 | 'Principle1.Guideline1_4.1_4_5', 40 | 'Principle1.Guideline1_4.1_4_10', 41 | 'Principle1.Guideline1_4.1_4_11', 42 | 'Principle1.Guideline1_4.1_4_12', 43 | 'Principle1.Guideline1_4.1_4_13', 44 | 'Principle2.Guideline2_1.2_1_1', 45 | 'Principle2.Guideline2_1.2_1_2', 46 | 'Principle2.Guideline2_1.2_1_4', 47 | 'Principle2.Guideline2_2.2_2_1', 48 | 'Principle2.Guideline2_2.2_2_2', 49 | 'Principle2.Guideline2_3.2_3_1', 50 | 'Principle2.Guideline2_4.2_4_1', 51 | 'Principle2.Guideline2_4.2_4_2', 52 | 'Principle2.Guideline2_4.2_4_3', 53 | 'Principle2.Guideline2_4.2_4_4', 54 | 'Principle2.Guideline2_4.2_4_5', 55 | 'Principle2.Guideline2_4.2_4_6', 56 | 'Principle2.Guideline2_4.2_4_7', 57 | 'Principle2.Guideline2_5.2_5_1', 58 | 'Principle2.Guideline2_5.2_5_2', 59 | 'Principle2.Guideline2_5.2_5_3', 60 | 'Principle2.Guideline2_5.2_5_4', 61 | 'Principle3.Guideline3_1.3_1_1', 62 | 'Principle3.Guideline3_1.3_1_2', 63 | 'Principle3.Guideline3_2.3_2_1', 64 | 'Principle3.Guideline3_2.3_2_2', 65 | 'Principle3.Guideline3_2.3_2_3', 66 | 'Principle3.Guideline3_2.3_2_4', 67 | 'Principle3.Guideline3_3.3_3_1', 68 | 'Principle3.Guideline3_3.3_3_2', 69 | 'Principle3.Guideline3_3.3_3_3', 70 | 'Principle3.Guideline3_3.3_3_4', 71 | 'Principle4.Guideline4_1.4_1_1', 72 | 'Principle4.Guideline4_1.4_1_2', 73 | 'Principle4.Guideline4_1.4_1_3' 74 | ] 75 | } 76 | ], 77 | getMsgInfo: function(code) { 78 | return HTMLCS_WCAG2AAA.getMsgInfo(code); 79 | } 80 | }; 81 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_2/1_2_1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_2_1_2_1 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'object', 27 | 'embed', 28 | 'applet', 29 | 'bgsound', 30 | 'audio', 31 | 'video' 32 | ]; 33 | 34 | }, 35 | 36 | /** 37 | * Process the registered element. 38 | * 39 | * @param {DOMNode} element The element registered. 40 | * @param {DOMNode} top The top element of the tested code. 41 | */ 42 | process: function(element, top) 43 | { 44 | var nodeName = element.nodeName.toLowerCase(); 45 | 46 | if (nodeName !== 'video') { 47 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("1_2_1_G158"), 'G158'); 48 | } 49 | 50 | if ((nodeName !== 'bgsound') && (nodeName !== 'audio')) { 51 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("1_2_1_G159,G166"), 'G159,G166'); 52 | } 53 | 54 | } 55 | }; 56 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_2/1_2_2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_2_1_2_2 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'object', 27 | 'embed', 28 | 'applet', 29 | 'video' 30 | ]; 31 | 32 | }, 33 | 34 | /** 35 | * Process the registered element. 36 | * 37 | * @param {DOMNode} element The element registered. 38 | * @param {DOMNode} top The top element of the tested code. 39 | */ 40 | process: function(element, top) 41 | { 42 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("1_2_2_G87,G93"), 'G87,G93'); 43 | 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_2/1_2_3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_2_1_2_3 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'object', 27 | 'embed', 28 | 'applet', 29 | 'video' 30 | ]; 31 | 32 | }, 33 | 34 | /** 35 | * Process the registered element. 36 | * 37 | * @param {DOMNode} element The element registered. 38 | * @param {DOMNode} top The top element of the tested code. 39 | */ 40 | process: function(element, top) 41 | { 42 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("1_2_3_G69,G78,G173,G8"), 'G69,G78,G173,G8'); 43 | 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_2/1_2_4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_2_1_2_4 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'object', 27 | 'embed', 28 | 'applet', 29 | 'video' 30 | ]; 31 | 32 | }, 33 | 34 | /** 35 | * Process the registered element. 36 | * 37 | * @param {DOMNode} element The element registered. 38 | * @param {DOMNode} top The top element of the tested code. 39 | */ 40 | process: function(element, top) 41 | { 42 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("1_2_4_G9,G87,G93"), 'G9,G87,G93'); 43 | 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_2/1_2_5.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_2_1_2_5 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'object', 27 | 'embed', 28 | 'applet', 29 | 'video' 30 | ]; 31 | 32 | }, 33 | 34 | /** 35 | * Process the registered element. 36 | * 37 | * @param {DOMNode} element The element registered. 38 | * @param {DOMNode} top The top element of the tested code. 39 | */ 40 | process: function(element, top) 41 | { 42 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("1_2_5_G78,G173,G8"), 'G78,G173,G8'); 43 | 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_2/1_2_6.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_2_1_2_6 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'object', 27 | 'embed', 28 | 'applet', 29 | 'video' 30 | ]; 31 | 32 | }, 33 | 34 | /** 35 | * Process the registered element. 36 | * 37 | * @param {DOMNode} element The element registered. 38 | * @param {DOMNode} top The top element of the tested code. 39 | */ 40 | process: function(element, top) 41 | { 42 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("1_2_6_G54,G81"), 'G54,G81'); 43 | 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_2/1_2_7.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_2_1_2_7 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'object', 27 | 'embed', 28 | 'applet', 29 | 'video' 30 | ]; 31 | 32 | }, 33 | 34 | /** 35 | * Process the registered element. 36 | * 37 | * @param {DOMNode} element The element registered. 38 | * @param {DOMNode} top The top element of the tested code. 39 | */ 40 | process: function(element, top) 41 | { 42 | // Check for elements that could potentially contain video. 43 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("1_2_7_G8"), 'G8'); 44 | 45 | } 46 | }; 47 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_2/1_2_8.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_2_1_2_8 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'object', 27 | 'embed', 28 | 'applet', 29 | 'video' 30 | ]; 31 | 32 | }, 33 | 34 | /** 35 | * Process the registered element. 36 | * 37 | * @param {DOMNode} element The element registered. 38 | * @param {DOMNode} top The top element of the tested code. 39 | */ 40 | process: function(element, top) 41 | { 42 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("1_2_8_G69,G159"), 'G69,G159'); 43 | 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_2/1_2_9.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_2_1_2_9 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'object', 27 | 'embed', 28 | 'applet', 29 | 'bgsound', 30 | 'audio' 31 | ]; 32 | 33 | }, 34 | 35 | /** 36 | * Process the registered element. 37 | * 38 | * @param {DOMNode} element The element registered. 39 | * @param {DOMNode} top The top element of the tested code. 40 | */ 41 | process: function(element, top) 42 | { 43 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("1_2_9_G150,G151,G157"), 'G150,G151,G157'); 44 | 45 | } 46 | }; 47 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_3/1_3_1_A.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_3_1_3_1_A = { 15 | _labelNames: null, 16 | 17 | register: function() 18 | { 19 | return [ 20 | '_top' 21 | ]; 22 | 23 | }, 24 | 25 | /** 26 | * Process the registered element. 27 | * 28 | * @param {DOMNode} element The element registered. 29 | * @param {DOMNode} top The top element of the tested code. 30 | */ 31 | process: function(element, top) 32 | { 33 | var sniff = HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_3_1_3_1; 34 | 35 | if (element === top) { 36 | sniff.testHeadingOrder(top, HTMLCS.WARNING); 37 | } 38 | 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_3/1_3_1_AAA.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_3_1_3_1_AAA = { 15 | _labelNames: null, 16 | 17 | register: function() 18 | { 19 | return [ 20 | '_top' 21 | ]; 22 | 23 | }, 24 | 25 | /** 26 | * Process the registered element. 27 | * 28 | * @param {DOMNode} element The element registered. 29 | * @param {DOMNode} top The top element of the tested code. 30 | */ 31 | process: function(element, top) 32 | { 33 | var sniff = HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_3_1_3_1; 34 | 35 | if (element === top) { 36 | sniff.testHeadingOrder(top, HTMLCS.ERROR); 37 | } 38 | 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_3/1_3_2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_3_1_3_2 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_3_2_G57"), 'G57'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_3/1_3_3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_3_1_3_3 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_3_3_G96"), 'G96'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_3/1_3_4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_3_1_3_4 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, 38 | _global.HTMLCS.getTranslation("1_3_4.RestrictView"), ''); 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_3/1_3_6.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_3_1_3_6 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_3_6_ARIA11.Check"), 'ARIA11'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_1 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_4_1_G14,G18"), 'G14,G182'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_10.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_10 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() { 24 | return ["_top", "pre", "meta"]; 25 | }, 26 | 27 | /** 28 | * Process the registered element. 29 | * 30 | * @param {DOMNode} element The element registered. 31 | * @param {DOMNode} top The top element of the tested code. 32 | */ 33 | process: function(element, top) { 34 | if (element === top) { 35 | HTMLCS.addMessage( 36 | HTMLCS.NOTICE, 37 | top, 38 | _global.HTMLCS.getTranslation("1_4_10_C32,C31,C33,C38,SCR34,G206.Check"), 39 | "C32,C31,C33,C38,SCR34,G206" 40 | ); 41 | 42 | var all = HTMLCS.util.getAllElements(top, '*'); 43 | for (var i = 0; i < all.length; i++) { 44 | var x = all[i]; 45 | if ( 46 | window.getComputedStyle(x, null).getPropertyValue("position") == 47 | "fixed" 48 | ) { 49 | HTMLCS.addMessage( 50 | HTMLCS.WARNING, 51 | x, 52 | _global.HTMLCS.getTranslation("1_4_10_C32,C31,C33,C38,SCR34,G206.Fixed"), 53 | "C32,C31,C33,C38,SCR34,G206" 54 | ); 55 | } 56 | } 57 | } else { 58 | var nodeName = element.nodeName.toLowerCase(); 59 | 60 | switch (nodeName) { 61 | case "pre": 62 | HTMLCS.addMessage( 63 | HTMLCS.WARNING, 64 | top, 65 | _global.HTMLCS.getTranslation("1_4_10_C32,C31,C33,C38,SCR34,G206.Scrolling"), 66 | "C32,C31,C33,C38,SCR34,G206" 67 | ); 68 | break; 69 | case "meta": 70 | var content = element.getAttribute('content'); 71 | var name = element.getAttribute('name'); 72 | if (name === 'viewport' && !!content && 73 | (content.indexOf("maximum-scale") > -1 || 74 | content.indexOf("minimum-scale") > -1 || 75 | content.indexOf("user-scalable=no") > -1 || 76 | content.indexOf("user-scalable=0") > -1) 77 | ) { 78 | HTMLCS.addMessage( 79 | HTMLCS.WARNING, 80 | element, 81 | _global.HTMLCS.getTranslation("1_4_10_C32,C31,C33,C38,SCR34,G206.Zoom"), 82 | "C32,C31,C33,C38,SCR34,G206" 83 | ); 84 | } 85 | } 86 | } 87 | } 88 | }; 89 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_11.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_11 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_4_11_G195,G207,G18,G145,G174,F78.Check"), 'G195,G207,G18,G145,G174,F78'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_12.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_12 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_4_12_C36,C35.Check"), 'C36,C35'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_13.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_13 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_4_13_F95.Check"), 'F95'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_2 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'object', 27 | 'embed', 28 | 'applet', 29 | 'bgsound', 30 | 'audio', 31 | 'video' 32 | ]; 33 | 34 | }, 35 | 36 | /** 37 | * Process the registered element. 38 | * 39 | * @param {DOMNode} element The element registered. 40 | * @param {DOMNode} top The top element of the tested code. 41 | */ 42 | process: function(element, top) 43 | { 44 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_4_2_F23"), 'F23'); 45 | } 46 | }; 47 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_3_F24.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_3_F24 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | // Test for background/foreground stuff. 38 | var elements = HTMLCS.util.getAllElements(top, '*'); 39 | for (var i = 0; i < elements.length; i++) { 40 | this.testColourComboFail(elements[i]); 41 | } 42 | }, 43 | 44 | /** 45 | * Tests for setting foreground without background, or vice versa (failure F24). 46 | * 47 | * It is a failure for a background colour to be set without a foreground colour, 48 | * or vice versa. A user agent style sheet could try and set both, and because 49 | * one is overridden, the result could be unreadable. 50 | * 51 | * This is being thrown as a warning, not an error. The failure allows the FG 52 | * and BG colours to be set further up the chain, as long as the content has both 53 | * foreground and background colours set by the time. 54 | 55 | * Further, we can only test inline styles (either through attributes, CSS, or 56 | * JavaScript setting through eg. jQuery) because computed styles cause issues. 57 | * For instance, if no user style sheet is set, the default stylesheet (in 58 | * Firefox) at least is "transparent background/black text", and this would show 59 | * up in the computed style (and fail, since transparent is "not set"). The F24 60 | * description (by my reading) allows the colours to be set further up the chain, 61 | * as long as the content has -a- BG and -a- FG colour. 62 | * 63 | * @param Node element The element to test. 64 | */ 65 | testColourComboFail: function(element) 66 | { 67 | var hasFg = element.hasAttribute('color'); 68 | hasFg = hasFg || element.hasAttribute('link'); 69 | hasFg = hasFg || element.hasAttribute('vlink'); 70 | hasFg = hasFg || element.hasAttribute('alink'); 71 | var hasBg = element.hasAttribute('bgcolor'); 72 | 73 | if (element.style) { 74 | var fgStyle = element.style.color; 75 | var bgStyle = element.style.background; 76 | 77 | if ((fgStyle !== '') && (fgStyle !== 'auto')) { 78 | hasFg = true; 79 | } 80 | 81 | if ((bgStyle !== '') && (bgStyle !== 'auto')) { 82 | hasBg = true; 83 | } 84 | }//end if 85 | 86 | if (hasBg !== hasFg) { 87 | if (hasBg === true) { 88 | HTMLCS.addMessage(HTMLCS.WARNING, element, _global.HTMLCS.getTranslation("1_4_3_F24.BGColour"), 'F24.BGColour'); 89 | } else { 90 | HTMLCS.addMessage(HTMLCS.WARNING, element, _global.HTMLCS.getTranslation("1_4_3_F24.FGColour"), 'F24.FGColour'); 91 | } 92 | } 93 | } 94 | }; 95 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_4 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_4_4_G142"), 'G142'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_5.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_5 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | var imgObj = top.querySelector('img'); 38 | 39 | if (imgObj !== null) { 40 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_4_5_G140,C22,C30.AALevel"), 'G140,C22,C30.AALevel'); 41 | } 42 | 43 | } 44 | }; 45 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_6.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_6 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | if (element === top) { 38 | var failures = HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_3_Contrast.testContrastRatio(top, 7.0, 4.5); 39 | 40 | for (var i = 0; i < failures.length; i++) { 41 | var element = failures[i].element; 42 | 43 | var decimals = 2; 44 | var value = (Math.round(failures[i].value * Math.pow(10, decimals)) / Math.pow(10, decimals)); 45 | var required = failures[i].required; 46 | var recommend = failures[i].recommendation; 47 | var hasBgImg = failures[i].hasBgImage || false; 48 | var isAbsolute = failures[i].isAbsolute || false; 49 | 50 | // If the values would look identical, add decimals to the value. 51 | while (required === value) { 52 | decimals++; 53 | value = (Math.round(failures[i].value * Math.pow(10, decimals)) / Math.pow(10, decimals)); 54 | } 55 | 56 | if (required === 4.5) { 57 | var code = 'G18'; 58 | } else if (required === 7.0) { 59 | var code = 'G17'; 60 | } 61 | 62 | var recommendText = []; 63 | if (recommend) { 64 | if (recommend.fore.from !== recommend.fore.to) { 65 | recommendText.push(_global.HTMLCS.getTranslation("1_4_6_G18_or_G17.Fail.Recomendation.Text").replace(/\{\{value\}\}/g, recommend.fore.to)); 66 | } 67 | if (recommend.back.from !== recommend.back.to) { 68 | recommendText.push(_global.HTMLCS.getTranslation("1_4_6_G18_or_G17.Fail.Recomendation.Background").replace(/\{\{value\}\}/g, recommend.back.to)); 69 | } 70 | }//end if 71 | 72 | if (recommendText.length > 0) { 73 | recommendText = ' ' + _global.HTMLCS.getTranslation("1_4_6_G18_or_G17.Fail.Recomendation") + ' ' + recommendText.join(', ') + '.'; 74 | } 75 | 76 | if (isAbsolute === true) { 77 | code += '.Abs'; 78 | HTMLCS.addMessage(HTMLCS.WARNING, element, _global.HTMLCS.getTranslation("1_4_6_G18_or_G17.Abs").replace(/\{\{required\}\}/g, required), code); 79 | } else if (hasBgImg === true) { 80 | code += '.BgImage'; 81 | HTMLCS.addMessage(HTMLCS.WARNING, element, _global.HTMLCS.getTranslation("1_4_6_G18_or_G17.BgImage").replace(/\{\{required\}\}/g, required), code); 82 | } else { 83 | code += '.Fail'; 84 | HTMLCS.addMessage(HTMLCS.ERROR, element, _global.HTMLCS.getTranslation("1_4_6_G18_or_G17.Fail").replace(/\{\{required\}\}/g, required).replace(/\{\{value\}\}/g, value) + recommendText, code); 85 | }//end if 86 | }//end for 87 | }//end if 88 | } 89 | }; 90 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_7.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_7 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'object', 27 | 'embed', 28 | 'applet', 29 | 'bgsound', 30 | 'audio' 31 | ]; 32 | 33 | }, 34 | 35 | /** 36 | * Process the registered element. 37 | * 38 | * @param {DOMNode} element The element registered. 39 | * @param {DOMNode} top The top element of the tested code. 40 | */ 41 | process: function(element, top) 42 | { 43 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("1_4_7_G56"), 'G56'); 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_8.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_8 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | // This Success Criterion has five prongs, and each should be thrown as a 38 | // separate notice as separate techniques apply to each. 39 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_4_8_G148,G156,G175"), 'G148,G156,G175'); 40 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_4_8_H87,C20"), 'H87,C20'); 41 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_4_8_C19,G172,G169"), 'C19,G172,G169'); 42 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_4_8_G188,C21"), 'G188,C21'); 43 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_4_8_H87,G146,C26"), 'H87,G146,C26'); 44 | 45 | } 46 | }; 47 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_9.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_9 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | var imgObj = top.querySelector('img'); 38 | 39 | if (imgObj !== null) { 40 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("1_4_9_G140,C22,C30.NoException"), 'G140,C22,C30.NoException'); 41 | } 42 | } 43 | }; 44 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_1/2_1_1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_1_2_1_1 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | // Testing for elements that have explicit attributes for mouse-specific 38 | // events. Note: onclick is considered keyboard accessible, as it is actually 39 | // tied to the default action of a link or button - not merely a click. 40 | if (element === top) { 41 | 42 | // Cannot detect event listeners here so only onclick attributes are checked. 43 | var keyboardTriggers = HTMLCS.util.getAllElements(top, '*[onclick], *[onkeyup], *[onkeydown], *[onkeypress], *[onfocus], *[onblur]'); 44 | keyboardTriggers.forEach(function(elem) { 45 | if (HTMLCS.util.isKeyboardNavigable(elem) === false) { 46 | HTMLCS.addMessage( 47 | HTMLCS.WARNING, 48 | elem, 49 | _global.HTMLCS.getTranslation("2_1_1_G90"), 50 | 'G90' 51 | ); 52 | } 53 | }); 54 | 55 | var dblClickEls = HTMLCS.util.getAllElements(top, '*[ondblclick]'); 56 | for (var i = 0; i < dblClickEls.length; i++) { 57 | HTMLCS.addMessage(HTMLCS.WARNING, dblClickEls[i], _global.HTMLCS.getTranslation("2_1_1_SCR20.DblClick"), 'SCR20.DblClick'); 58 | } 59 | 60 | var mouseOverEls = HTMLCS.util.getAllElements(top, '*[onmouseover]'); 61 | for (var i = 0; i < mouseOverEls.length; i++) { 62 | HTMLCS.addMessage(HTMLCS.WARNING, mouseOverEls[i], _global.HTMLCS.getTranslation("2_1_1_SCR20.MouseOver"), 'SCR20.MouseOver'); 63 | } 64 | 65 | var mouseOutEls = HTMLCS.util.getAllElements(top, '*[onmouseout]'); 66 | for (var i = 0; i < mouseOutEls.length; i++) { 67 | HTMLCS.addMessage(HTMLCS.WARNING, mouseOutEls[i], _global.HTMLCS.getTranslation("2_1_1_SCR20.MouseOut"), 'SCR20.MouseOut'); 68 | } 69 | 70 | var mouseMoveEls = HTMLCS.util.getAllElements(top, '*[onmousemove]'); 71 | for (var i = 0; i < mouseMoveEls.length; i++) { 72 | HTMLCS.addMessage(HTMLCS.WARNING, mouseMoveEls[i], _global.HTMLCS.getTranslation("2_1_1_SCR20.MouseMove"), 'SCR20.MouseMove'); 73 | } 74 | 75 | var mouseDownEls = HTMLCS.util.getAllElements(top, '*[onmousedown]'); 76 | for (var i = 0; i < mouseDownEls.length; i++) { 77 | HTMLCS.addMessage(HTMLCS.WARNING, mouseDownEls[i], _global.HTMLCS.getTranslation("2_1_1_SCR20.MouseDown"), 'SCR20.MouseDown'); 78 | } 79 | 80 | var mouseUpEls = HTMLCS.util.getAllElements(top, '*[onmouseup]'); 81 | for (var i = 0; i < mouseUpEls.length; i++) { 82 | HTMLCS.addMessage(HTMLCS.WARNING, mouseUpEls[i], _global.HTMLCS.getTranslation("2_1_1_SCR20.MouseUp"), 'SCR20.MouseUp'); 83 | } 84 | } 85 | 86 | } 87 | }; 88 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_1/2_1_2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_1_2_1_2 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'object', 27 | 'applet', 28 | 'embed' 29 | ]; 30 | 31 | }, 32 | 33 | /** 34 | * Process the registered element. 35 | * 36 | * @param {DOMNode} element The element registered. 37 | * @param {DOMNode} top The top element of the tested code. 38 | */ 39 | process: function(element, top) 40 | { 41 | HTMLCS.addMessage(HTMLCS.WARNING, element, _global.HTMLCS.getTranslation("2_1_2_F10"), 'F10'); 42 | } 43 | }; 44 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_1/2_1_4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_1_2_1_4 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("2_1_4.Check"), ''); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_2/2_2_1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_2_2_2_1 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['meta']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | // Meta refresh testing under H76/F41. Fails if a non-zero timeout is provided. 38 | // NOTE: H76 only lists criterion 3.2.5, but F41 also covers refreshes to 39 | // same page (no URL content), which is covered by non-adjustable timeouts 40 | // in criterion 2.2.1. 41 | if (element.hasAttribute('http-equiv') === true) { 42 | if ((String(element.getAttribute('http-equiv'))).toLowerCase() === 'refresh') { 43 | if (/^[1-9]\d*/.test(element.getAttribute('content').toLowerCase()) === true) { 44 | if (/url=/.test(element.getAttribute('content').toLowerCase()) === true) { 45 | // Redirect. 46 | HTMLCS.addMessage(HTMLCS.ERROR, element, _global.HTMLCS.getTranslation("2_2_1_F40.2"), 'F40.2'); 47 | } else { 48 | // Just a refresh. 49 | HTMLCS.addMessage(HTMLCS.ERROR, element, _global.HTMLCS.getTranslation("2_2_1_F41.2"), 'F41.2'); 50 | } 51 | } 52 | }//end if 53 | }//end if 54 | 55 | } 56 | }; 57 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_2/2_2_2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_2_2_2_2 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | '_top', 27 | 'blink' 28 | ]; 29 | 30 | }, 31 | 32 | /** 33 | * Process the registered element. 34 | * 35 | * @param {DOMNode} element The element registered. 36 | * @param {DOMNode} top The top element of the tested code. 37 | */ 38 | process: function(element, top) 39 | { 40 | if (element === top) { 41 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("2_2_2_SCR33,SCR22,G187,G152,G186,G191"), 'SCR33,SCR22,G187,G152,G186,G191'); 42 | 43 | var elements = HTMLCS.util.getAllElements(top, '*'); 44 | for (var i = 0; i < elements.length; i++) { 45 | var computedStyle = HTMLCS.util.style(elements[i]); 46 | 47 | if (computedStyle) { 48 | if (/blink/.test(computedStyle['text-decoration']) === true) { 49 | HTMLCS.addMessage(HTMLCS.WARNING, elements[i], _global.HTMLCS.getTranslation("2_2_2_F4"), 'F4'); 50 | } 51 | } 52 | }//end for 53 | } else if (element.nodeName.toLowerCase() === 'blink') { 54 | HTMLCS.addMessage(HTMLCS.ERROR, element, _global.HTMLCS.getTranslation("2_2_2_F47"), 'F47'); 55 | }//end if 56 | 57 | } 58 | }; 59 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_2/2_2_3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_2_2_2_3 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("2_2_3_G5"), 'G5'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_2/2_2_4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_2_2_2_4 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("2_2_4_SCR14"), 'SCR14'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_2/2_2_5.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_2_2_2_5 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("2_2_5_G105,G181"), 'G105,G181'); 38 | 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_2/2_2_6.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_2_2_2_6 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("2_2_6.Check"), ''); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_3/2_3_1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_3_2_3_1 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | // The "small" flashing area is deliberately vague - users should see 38 | // technique G176 for more details, as the threshold depends on both the 39 | // size and resolution of a screen. 40 | // The technique gives a baseline (based on a 15-17 inch monitor read at 41 | // 22-26 inches, at 1024 x 768 resolution). A 10-degree field of vision is 42 | // approximately 341 x 256 pixels in this environment, and a flashing area 43 | // needs to be no more than 25% of this (not necessarily rectangular). 44 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("2_3_1_G19,G176"), 'G19,G176'); 45 | 46 | } 47 | }; 48 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_3/2_3_2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_3_2_3_2 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("2_3_2_G19"), 'G19'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_3/2_3_3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_3_2_3_3 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("2_3_3.Check"), 'C39'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_4/2_4_2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_4_2_4_2 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['html']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | // Find a head first. 38 | var children = element.childNodes; 39 | var head = null; 40 | 41 | for (var i = 0; i < children.length; i++) { 42 | if (children[i].nodeName.toLowerCase() === 'head') { 43 | head = children[i]; 44 | break; 45 | } 46 | } 47 | 48 | if (head === null) { 49 | HTMLCS.addMessage(HTMLCS.ERROR, element, _global.HTMLCS.getTranslation("2_4_2_H25.1.NoHeadEl"), 'H25.1.NoHeadEl'); 50 | } else { 51 | var children = head.childNodes; 52 | var title = null; 53 | 54 | for (var i = 0; i < children.length; i++) { 55 | if (children[i].nodeName.toLowerCase() === 'title') { 56 | title = children[i]; 57 | break; 58 | } 59 | } 60 | 61 | if (title === null) { 62 | HTMLCS.addMessage(HTMLCS.ERROR, head, _global.HTMLCS.getTranslation("2_4_2_H25.1.NoTitleEl"), 'H25.1.NoTitleEl'); 63 | } else { 64 | if (/^\s*$/.test(title.innerHTML) === true) { 65 | HTMLCS.addMessage(HTMLCS.ERROR, title, _global.HTMLCS.getTranslation("2_4_2_H25.1.EmptyTitle"), 'H25.1.EmptyTitle'); 66 | } else { 67 | HTMLCS.addMessage(HTMLCS.NOTICE, title, _global.HTMLCS.getTranslation("2_4_2_H25.2"), 'H25.2'); 68 | } 69 | }//end if 70 | }//end if 71 | 72 | } 73 | }; 74 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_4/2_4_3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_4_2_4_3 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | if (element === top) { 38 | var tabIndexExists = top.querySelector('*[tabindex]'); 39 | 40 | if (tabIndexExists) { 41 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("2_4_3_H4.2"), 'H4.2'); 42 | } 43 | } 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_4/2_4_4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_4_2_4_4 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['a']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | if (element.hasAttribute('title') === true) { 38 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("2_4_4_H77,H78,H79,H80,H81,H33"), 'H77,H78,H79,H80,H81,H33'); 39 | } else { 40 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("2_4_4_H77,H78,H79,H80,H81"), 'H77,H78,H79,H80,H81'); 41 | } 42 | 43 | } 44 | }; 45 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_4/2_4_5.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_4_2_4_5 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("2_4_5_G125,G64,G63,G161,G126,G185"), 'G125,G64,G63,G161,G126,G185'); 38 | 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_4/2_4_6.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_4_2_4_6 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("2_4_6_G130,G131"), 'G130,G131'); 38 | 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_4/2_4_7.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_4_2_4_7 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | // Fire this notice if there appears to be an input field or link on the page 38 | // (which will be just about anything). Links are important because they can 39 | // still be tabbed to. 40 | var inputField = top.querySelector('input, textarea, button, select, a'); 41 | 42 | if (inputField !== null) { 43 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("2_4_7_G149,G165,G195,C15,SCR31"), 'G149,G165,G195,C15,SCR31'); 44 | } 45 | 46 | } 47 | }; 48 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_4/2_4_8.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_4_2_4_8 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['link']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | var linkParentName = element.parentNode.nodeName.toLowerCase(); 38 | 39 | // Check for the correct location. HTML4 states "it may only appear in the 40 | // HEAD element". HTML5 states it appears "wherever metadata content is 41 | // expected", which only includes the head element. 42 | if (linkParentName !== 'head') { 43 | HTMLCS.addMessage(HTMLCS.ERROR, element, _global.HTMLCS.getTranslation("2_4_8_H59.1"), 'H59.1'); 44 | } 45 | 46 | // Check for mandatory elements. 47 | if ((element.hasAttribute('rel') === false) || (!element.getAttribute('rel')) || (/^\s*$/.test(element.getAttribute('rel')) === true)) { 48 | HTMLCS.addMessage(HTMLCS.ERROR, element, _global.HTMLCS.getTranslation("2_4_8_H59.2a"), 'H59.2a'); 49 | } 50 | 51 | if ((element.hasAttribute('href') === false) || (!element.getAttribute('href')) || (/^\s*$/.test(element.getAttribute('href')) === true)) { 52 | HTMLCS.addMessage(HTMLCS.ERROR, element, _global.HTMLCS.getTranslation("2_4_8_H59.2b"), 'H59.2b'); 53 | } 54 | } 55 | }; 56 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_4/2_4_9.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_4_2_4_9 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['a']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("2_4_9_H30"), 'H30'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_5/2_5_1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_5_2_5_1 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("2_5_1.Check"), ''); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_5/2_5_2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_5_2_5_2 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() { 24 | return ["_top"]; 25 | }, 26 | 27 | /** 28 | * Process the registered element. 29 | * 30 | * @param {DOMNode} element The element registered. 31 | * @param {DOMNode} top The top element of the tested code. 32 | */ 33 | process: function(element, top) { 34 | HTMLCS.addMessage( 35 | HTMLCS.NOTICE, 36 | top, 37 | _global.HTMLCS.getTranslation("2_5_2.SinglePointer_Check"), 38 | "" 39 | ); 40 | 41 | if (element == top) { 42 | var allMousedown = HTMLCS.util.getAllElements(top, "*[onmousedown]"); 43 | for (var i = 0; i < allMousedown.length; i++) { 44 | var x = allMousedown[i]; 45 | HTMLCS.addMessage( 46 | HTMLCS.NOTICE, 47 | x, 48 | _global.HTMLCS.getTranslation("2_5_2.Mousedown_Check"), 49 | "" 50 | ); 51 | } 52 | var allTouchstart = HTMLCS.util.getAllElements(top, "*[ontouchstart]"); 53 | for (var i = 0; i < allTouchstart.length; i++) { 54 | var x = allTouchstart[i]; 55 | HTMLCS.addMessage( 56 | HTMLCS.NOTICE, 57 | x, 58 | _global.HTMLCS.getTranslation("2_5_2.Touchstart_Check"), 59 | "" 60 | ); 61 | } 62 | } 63 | } 64 | }; 65 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_5/2_5_3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_5_2_5_3 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() { 24 | return ["_top", "a", "button", "label", "input"]; 25 | }, 26 | 27 | /** 28 | * Process the registered element. 29 | * 30 | * @param {DOMNode} element The element registered. 31 | * @param {DOMNode} top The top element of the tested code. 32 | */ 33 | process: function(element, top) { 34 | if (element == top) { 35 | HTMLCS.addMessage( 36 | HTMLCS.NOTICE, 37 | top, 38 | _global.HTMLCS.getTranslation("2_5_3_F96.Check"), 39 | "F96" 40 | ); 41 | } else { 42 | var nodeName = element.nodeName.toLowerCase(); 43 | 44 | var visibleLabel = ""; 45 | var accessibleName = ""; 46 | switch (nodeName) { 47 | case "a": 48 | visibleLabel = HTMLCS.util.getTextContent(element); 49 | accessibleName = HTMLCS.util.getAccessibleName(element, top); 50 | break; 51 | case "button": 52 | visibleLabel = HTMLCS.util.getTextContent(element); 53 | accessibleName = HTMLCS.util.getAccessibleName(element, top); 54 | break; 55 | case "label": 56 | visibleLabel = HTMLCS.util.getTextContent(element); 57 | var labelFor = element.getAttribute("for"); 58 | if (labelFor) { 59 | var refNode = undefined; 60 | if (top.ownerDocument) { 61 | refNode = top.ownerDocument.getElementById(labelFor); 62 | } else { 63 | refNode = top.getElementById(labelFor); 64 | } 65 | if (!!refNode) { 66 | accessibleName = HTMLCS.util.getAccessibleName(refNode, top); 67 | } 68 | } 69 | break; 70 | case "input": 71 | if (element.getAttribute("type") === "submit") { 72 | visibleLabel = element.getAttribute("value"); 73 | } 74 | accessibleName = HTMLCS.util.getAccessibleName(element, top); 75 | break; 76 | } 77 | if (!!visibleLabel && !!accessibleName) { 78 | var a = visibleLabel.replace(/[^A-Za-z]/g, "").toLowerCase(); 79 | var b = accessibleName.replace(/[^A-Za-z]/g, "").toLowerCase(); 80 | if (!!a && !!b && b.indexOf(a) === -1) { 81 | HTMLCS.addMessage( 82 | HTMLCS.WARNING, 83 | element, 84 | _global.HTMLCS.getTranslation("2_5_3_F96.AccessibleName"), 85 | "F96" 86 | ); 87 | } 88 | } 89 | } 90 | } 91 | }; 92 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_5/2_5_4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_5_2_5_4 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() { 24 | return ["_top"]; 25 | }, 26 | 27 | /** 28 | * Process the registered element. 29 | * 30 | * @param {DOMNode} element The element registered. 31 | * @param {DOMNode} top The top element of the tested code. 32 | */ 33 | process: function(element, top) { 34 | HTMLCS.addMessage( 35 | HTMLCS.NOTICE, 36 | top, 37 | _global.HTMLCS.getTranslation("2_5_4.Check"), 38 | "" 39 | ); 40 | 41 | if (element == top) { 42 | var all = HTMLCS.util.getAllElements(element, "*[ondevicemotion]"); 43 | for (var i = 0; i < all.length; i++) { 44 | var x = all[i]; 45 | HTMLCS.addMessage( 46 | HTMLCS.WARNING, 47 | x, 48 | _global.HTMLCS.getTranslation("2_5_4.Devicemotion"), 49 | "" 50 | ); 51 | } 52 | } 53 | } 54 | }; 55 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_5/2_5_5.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_5_2_5_5 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("2_5_5.Check"), ''); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_5/2_5_6.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_5_2_5_6 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("2_5_6.Check"), ''); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_1/3_1_1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_1_3_1_1 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['html']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | if ((element.hasAttribute('lang') === false) && (element.hasAttribute('xml:lang') === false)) { 38 | // TODO: if we can tell whether it's HTML or XHTML, we should split this 39 | // into two - one asking for "lang", the other for "xml:lang". 40 | HTMLCS.addMessage(HTMLCS.ERROR, element, _global.HTMLCS.getTranslation("3_1_1_H57.2"), 'H57.2'); 41 | } else { 42 | if (element.hasAttribute('lang') === true) { 43 | var lang = element.getAttribute('lang'); 44 | if (this.isValidLanguageTag(lang) === false) { 45 | HTMLCS.addMessage(HTMLCS.ERROR, top, _global.HTMLCS.getTranslation("3_1_1_H57.3.Lang"), 'H57.3.Lang'); 46 | } 47 | } 48 | 49 | if (element.hasAttribute('xml:lang') === true) { 50 | var lang = element.getAttribute('xml:lang'); 51 | if (this.isValidLanguageTag(lang) === false) { 52 | HTMLCS.addMessage(HTMLCS.ERROR, top, _global.HTMLCS.getTranslation("3_1_1_H57.3.XmlLang"), 'H57.3.XmlLang'); 53 | } 54 | } 55 | } 56 | 57 | }, 58 | 59 | 60 | /** 61 | * Test for well-formed language tag as per IETF BCP 47. 62 | * 63 | * Note that this checks only for well-formedness, not whether the subtags are 64 | * actually on the registered subtags list. 65 | * 66 | * @param {String} langTag The language tag to test. 67 | * 68 | * @returns {Boolean} the result of the regex test. 69 | */ 70 | isValidLanguageTag: function(langTag) 71 | { 72 | // Allow irregular or private-use tags starting with 'i' or 'x'. 73 | // Values after it are 1-8 alphanumeric characters. 74 | var regexStr = '^([ix](-[a-z0-9]{1,8})+)$|'; 75 | 76 | // Core language tags - 2 to 8 letters 77 | regexStr += '^[a-z]{2,8}'; 78 | 79 | // Extlang subtags - three letters, repeated 0 to 3 times 80 | regexStr += '(-[a-z]{3}){0,3}'; 81 | 82 | // Script subtag - four letters, optional. 83 | regexStr += '(-[a-z]{4})?'; 84 | 85 | // Region subtag - two letters for a country or a three-digit region; optional. 86 | regexStr += '(-[a-z]{2}|-[0-9]{3})?'; 87 | 88 | // Variant subtag - either digit + 3 alphanumeric, or 89 | // 5-8 alphanumeric where it doesn't start with a digit; optional 90 | // but repeatable. 91 | regexStr += '(-[0-9][a-z0-9]{3}|-[a-z0-9]{5,8})*'; 92 | 93 | // Extension subtag - one single alphanumeric character (but not "x"), 94 | // followed by at least one value of 2-8 alphanumeric characters. 95 | // The whole thing is optional but repeatable (for different extensions). 96 | regexStr += '(-[a-wy-z0-9](-[a-z0-9]{2,8})+)*'; 97 | 98 | // Private use subtag, starting with an "x" and containing at least one 99 | // value of 1-8 alphanumeric characters. It must come last. 100 | regexStr += '(-x(-[a-z0-9]{1,8})+)?$'; 101 | 102 | // Make a regex out of it, and make it all case-insensitive. 103 | var regex = new RegExp(regexStr, 'i'); 104 | 105 | // Throw the correct lang code depending on whether this is a document 106 | // element or not. 107 | var valid = true; 108 | if (regex.test(langTag) === false) { 109 | valid = false; 110 | } 111 | 112 | return valid; 113 | } 114 | }; 115 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_1/3_1_2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_1_3_1_2 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | // Generic message for changes in language. 38 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("3_1_2_H58"), 'H58'); 39 | 40 | // Alias the SC 3.1.1 object, which contains our "valid language tag" test. 41 | var sc3_1_1 = HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_1_3_1_1; 42 | 43 | // Note, going one element beyond the end, so we can test the top element 44 | // (which doesn't get picked up by the above query). Instead of going off the 45 | // cliff of the collection, the last loop (i === langEls.length) checks the 46 | // top element. 47 | var langEls = HTMLCS.util.getAllElements(top, '*[lang]'); 48 | for (var i = 0; i <= langEls.length; i++) { 49 | if (i === langEls.length) { 50 | var langEl = top; 51 | } else { 52 | var langEl = langEls[i]; 53 | } 54 | 55 | // Skip html nodes, they are covered by 3.1.1. 56 | // Also skip if the top element is the document element. 57 | if ((!langEl.documentElement) && (langEl.nodeName.toLowerCase() !== 'html')) { 58 | if (langEl.hasAttribute('lang') === true) { 59 | var lang = langEl.getAttribute('lang'); 60 | if (sc3_1_1.isValidLanguageTag(lang) === false) { 61 | HTMLCS.addMessage(HTMLCS.ERROR, langEl, _global.HTMLCS.getTranslation("3_1_2_H58.1.Lang"), 'H58.1.Lang'); 62 | } 63 | } 64 | 65 | if (langEl.hasAttribute('xml:lang') === true) { 66 | var lang = langEl.getAttribute('xml:lang'); 67 | if (sc3_1_1.isValidLanguageTag(lang) === false) { 68 | HTMLCS.addMessage(HTMLCS.ERROR, langEl, _global.HTMLCS.getTranslation("3_1_2_H58.1.XmlLang"), 'H58.1.XmlLang'); 69 | } 70 | } 71 | }//end if 72 | }//end for 73 | } 74 | }; 75 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_1/3_1_3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_1_3_1_3 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("3_1_3_H40,H54,H60,G62,G70"), 'H40,H54,H60,G62,G70'); 38 | 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_1/3_1_4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_1_3_1_4 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("3_1_4_G102,G55,G62,H28,G97"), 'G102,G55,G62,H28,G97'); 38 | 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_1/3_1_5.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_1_3_1_5 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("3_1_5_G86,G103,G79,G153,G160"), 'G86,G103,G79,G153,G160'); 38 | 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_1/3_1_6.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_1_3_1_6 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['ruby']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | var rb = element.querySelectorAll('rb'); 38 | var rt = element.querySelectorAll('rt'); 39 | if (rt.length === 0) { 40 | // Vary the message depending on whether an rb element exists. If it doesn't, 41 | // the presumption is that we are using HTML5 that uses the body of the ruby 42 | // element for the same purpose (otherwise, assume XHTML 1.1 with rb element). 43 | if (rb.length === 0) { 44 | HTMLCS.addMessage(HTMLCS.ERROR, element, _global.HTMLCS.getTranslation("3_1_6_H62.1.HTML5"), 'H62.1.HTML5'); 45 | } else { 46 | HTMLCS.addMessage(HTMLCS.ERROR, element, _global.HTMLCS.getTranslation("3_1_6_H62.1.XHTML11"), 'H62.1.XHTML11'); 47 | } 48 | } 49 | 50 | var rp = element.querySelectorAll('rp'); 51 | if (rp.length === 0) { 52 | // No "ruby parentheses" tags for those user agents that don't support 53 | // ruby at all. 54 | HTMLCS.addMessage(HTMLCS.ERROR, element, _global.HTMLCS.getTranslation("3_1_6_H62.2"), 'H62.2'); 55 | } 56 | } 57 | }; 58 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_2/3_2_1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_2_3_2_1 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | 'input', 27 | 'textarea', 28 | 'button', 29 | 'select' 30 | ]; 31 | 32 | }, 33 | 34 | /** 35 | * Process the registered element. 36 | * 37 | * @param {DOMNode} element The element registered. 38 | * @param {DOMNode} top The top element of the tested code. 39 | */ 40 | process: function(element, top) 41 | { 42 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("3_2_1_G107"), 'G107'); 43 | } 44 | }; 45 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_2/3_2_2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_2_3_2_2 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['form']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | var nodeName = element.nodeName.toLowerCase(); 38 | 39 | if (nodeName === 'form') { 40 | this.checkFormSubmitButton(element); 41 | } 42 | }, 43 | 44 | /** 45 | * Test for forms that don't have a submit button of some sort (technique H32). 46 | * 47 | * @param {DOMNode} form The form to test. 48 | */ 49 | checkFormSubmitButton: function(form) 50 | { 51 | var ok = false; 52 | 53 | // Test for INPUT-based submit buttons. The type must be specified, as 54 | // the default for INPUT is text. 55 | var inputButtons = form.querySelectorAll('input[type=submit], input[type=image]'); 56 | if (inputButtons.length > 0) { 57 | ok = true; 58 | } else { 59 | // Check for BUTTONs that aren't reset buttons, or normal buttons. 60 | // If they're blank or invalid, they are submit buttons. 61 | var buttonButtons = form.querySelectorAll('button'); 62 | var nonSubmitButtons = form.querySelectorAll('button[type=reset], button[type=button]'); 63 | if (buttonButtons.length > nonSubmitButtons.length) { 64 | ok = true; 65 | } 66 | }//end if 67 | 68 | if (ok === false) { 69 | // Look for buttons with form attributes, outside of the form. 70 | if (form.id) { 71 | var externalButtons = document.querySelectorAll('button[form], input[form][type=submit], input[form][type=image]'); 72 | Array.prototype.slice.call(externalButtons).forEach( 73 | function(el) { 74 | // Check they aren't reset buttons, or normal buttons. 75 | switch (el.getAttribute('type')) { 76 | case 'reset': 77 | case 'button': 78 | return; 79 | } 80 | 81 | // Confirm they are associated with the form. 82 | if (el.attributes['form'].value === form.id) { 83 | ok = true; 84 | } 85 | } 86 | ); 87 | } 88 | } 89 | 90 | if (ok === false) { 91 | HTMLCS.addMessage( 92 | HTMLCS.ERROR, 93 | form, 94 | _global.HTMLCS.getTranslation("3_2_2_H32.2"), 95 | 'H32.2' 96 | ); 97 | } 98 | } 99 | }; 100 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_2/3_2_3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_2_3_2_3 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("3_2_3_G61"), 'G61'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_2/3_2_4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_2_3_2_4 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("3_2_4_G197"), 'G197'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_2/3_2_5.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_2_3_2_5 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['a']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | var nodeName = element.nodeName.toLowerCase(); 38 | 39 | if (nodeName === 'a') { 40 | this.checkNewWindowTarget(element); 41 | } 42 | }, 43 | 44 | /** 45 | * Test for links that open in new windows but don't warn users (technique H83). 46 | * 47 | * @param {DOMNode} link The link to test. 48 | */ 49 | checkNewWindowTarget: function(link) 50 | { 51 | var hasTarget = link.hasAttribute('target'); 52 | 53 | if (hasTarget === true) { 54 | var target = link.getAttribute('target') || ''; 55 | if ((target === '_blank') && (/new window/i.test(link.innerHTML) === false)) { 56 | HTMLCS.addMessage(HTMLCS.WARNING, link, _global.HTMLCS.getTranslation("3_2_5_H83.3"), 'H83.3'); 57 | } 58 | } 59 | } 60 | }; 61 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_3/3_3_1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_3_3_3_1 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['form']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("3_3_1_G83,G84,G85"), 'G83,G84,G85'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_3/3_3_2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_3_3_3_2 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['form']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | // Only the generic message will be displayed here. If there were problems 38 | // with input boxes not having labels, it will be pulled up as errors in 39 | // other Success Criteria (eg. 1.3.1, 4.1.2). 40 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("3_3_2_G131,G89,G184,H90"), 'G131,G89,G184,H90'); 41 | } 42 | }; 43 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_3/3_3_3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_3_3_3_3 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['form']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | // Only G177 (about providing suggestions) is flagged as a technique. 38 | // The techniques in 3.3.1 are also listed in this Success Criterion. 39 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("3_3_3_G177"), 'G177'); 40 | } 41 | }; 42 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_3/3_3_4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_3_3_3_4 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['form']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("3_3_4_G98,G99,G155,G164,G168.LegalForms"), 'G98,G99,G155,G164,G168.LegalForms'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_3/3_3_5.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_3_3_3_5 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['form']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("3_3_5_G71,G184,G193"), 'G71,G184,G193'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_3/3_3_6.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle3_Guideline3_3_3_3_6 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['form']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, element, _global.HTMLCS.getTranslation("3_3_6_G98,G99,G155,G164,G168.AllForms"), 'G98,G99,G155,G164,G168.AllForms'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle4/Guideline4_1/4_1_1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle4_Guideline4_1_4_1_1 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return [ 26 | '_top' 27 | ]; 28 | 29 | }, 30 | 31 | /** 32 | * Process the registered element. 33 | * 34 | * @param {DOMNode} element The element registered. 35 | * @param {DOMNode} top The top element of the tested code. 36 | */ 37 | process: function(element, top) 38 | { 39 | if (element === top) { 40 | var elsWithIds = HTMLCS.util.getAllElements(top, '*[id]'); 41 | var usedIds = {}; 42 | 43 | for (var i = 0; i < elsWithIds.length; i++) { 44 | var id = elsWithIds[i].getAttribute('id'); 45 | 46 | if (/^\s*$/.test(id) === true) { 47 | continue; 48 | } 49 | 50 | if (usedIds[id] !== undefined) { 51 | // F77 = "Failure of SC 4.1.1 due to duplicate values of type ID". 52 | // Appropriate technique in HTML is H93. 53 | HTMLCS.addMessage(HTMLCS.ERROR, elsWithIds[i], _global.HTMLCS.getTranslation("4_1_1_F77").replace(/\{\{id\}\}/g, id), 'F77'); 54 | } else { 55 | usedIds[id] = true; 56 | } 57 | } 58 | } 59 | } 60 | }; 61 | -------------------------------------------------------------------------------- /Standards/WCAG2AAA/Sniffs/Principle4/Guideline4_1/4_1_3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * +--------------------------------------------------------------------+ 3 | * | This HTML_CodeSniffer file is Copyright (c) | 4 | * | Squiz Pty Ltd (ABN 77 084 670 600) | 5 | * +--------------------------------------------------------------------+ 6 | * | IMPORTANT: Your use of this Software is subject to the terms of | 7 | * | the Licence provided in the file licence.txt. If you cannot find | 8 | * | this file please contact Squiz (www.squiz.com.au) so we may | 9 | * | provide you a copy. | 10 | * +--------------------------------------------------------------------+ 11 | * 12 | */ 13 | 14 | _global.HTMLCS_WCAG2AAA_Sniffs_Principle4_Guideline4_1_4_1_3 = { 15 | /** 16 | * Determines the elements to register for processing. 17 | * 18 | * Each element of the returned array can either be an element name, or "_top" 19 | * which is the top element of the tested code. 20 | * 21 | * @returns {Array} The list of elements. 22 | */ 23 | register: function() 24 | { 25 | return ['_top']; 26 | 27 | }, 28 | 29 | /** 30 | * Process the registered element. 31 | * 32 | * @param {DOMNode} element The element registered. 33 | * @param {DOMNode} top The top element of the tested code. 34 | */ 35 | process: function(element, top) 36 | { 37 | HTMLCS.addMessage(HTMLCS.NOTICE, top, _global.HTMLCS.getTranslation("4_1_3_ARIA22,G199,ARIA19,G83,G84,G85,G139,G177,G194,ARIA23.Check"), ''); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Tests/WCAG2/1_1_1_NullAltText.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.1.1 Null Alt Text on Images and Areas 5 | 18 | 19 | 20 | Alt Text 21 | 22 | 23 | 24 |  25 | 26 | 27 | Has Alt 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Tests/WCAG2/1_3_1_Heading_Alt_Test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.3.1 Null Alt Text on headings 5 | 11 | 12 | 13 | 14 |

15 | 16 | 17 | 18 |

19 | 20 |

21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Tests/WCAG2/1_3_1_Labels.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.3.1 Labels 5 | 28 | 29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | Labelled By 55 | Labelled By 56 | Labelled By Multiple Entries 57 | 58 |
59 | 60 | 61 | -------------------------------------------------------------------------------- /Tests/WCAG2/1_3_1_Labels_Hidden.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.3.1 Labels Hidden 5 | 11 | 12 | 13 |
14 | 15 | 16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /Tests/WCAG2/1_3_1_Presentation_Roles.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.3.1 Presentation Roles 5 | 17 | 18 | 19 | 22 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 40 | 53 |
54 |

Aria Hidden stops presentation role check with aria-hidden on same element as role

55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /Tests/WCAG2/1_4_3_Contrast.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.4.3 Contrast 5 | 14 | 25 | 26 | 27 | 28 |

Basic failing text

29 | 30 |

Basic failing link on hover

31 | 32 |

Sample: I am 14pt bold text and should pass

33 | 34 |
Warning:
I am 14pt bold text on a transparent background and should generate a warning
35 | 36 |
Warning RGBA:
I am 14pt bold text on a transparent background and should generate a warning
37 | 38 |
39 | Warning RBGA in BG 40 |
Text
41 |
42 | 43 |
44 | Test linear gradient BG 45 |
46 | 47 |
48 | Test external class linear gradient BG 49 |
50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Tests/WCAG2/2_1_1_Keyboard_Events.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 2.1.1 Providing keyboard-triggered event handlers 5 | 17 | 18 | 19 | 20 | 21 | std1 22 | std1 23 | 24 |
std3
25 |
std4
26 | 27 | 28 | std5 29 | std1 30 |
std6
31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Tests/WCAG2/2_4_1_Bypass.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 2.4.1 Bypass 5 | 10 | 15 | 16 | 17 | 18 | 19 | Skip to main content 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Tests/WCAG2/3_2_2_Form_Input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 3.2.2 Form Input 5 | 12 | 13 | 14 | 15 |
16 | 17 |
18 | 19 |
20 | 21 |
22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Tests/WCAG2/4_1_2_Aria_Labels.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.1.2 Aria Labels 5 | 19 | 20 | 21 |
22 | 23 | 26 | 27 | 30 | 31 | 34 | 35 |
Billing Address
36 |
37 |
Name
38 | 39 |
40 | 41 | 42 | 43 | 44 |
My monkey
45 | 46 | 47 | 48 | 49 | 50 |
51 |
52 | 53 |
54 | 55 | 56 | -------------------------------------------------------------------------------- /Tests/WCAG2/4_1_2_SelectOptionSelected.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 412_01 5 | 13 | 14 | 15 |
16 | 21 | 26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /Tests/WCAG2/4_1_2_wrapping_label.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 412_wrapping_label 5 | 12 | 13 | 14 |
15 |
16 | 24 |
25 |
26 | 27 | 28 | 29 | 30 | Lorem ipsum 31 | 32 |
33 |
34 | 35 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var scriptPath = __dirname+'/build/HTMLCS.js'; 3 | 4 | if (fs.existsSync(scriptPath) === true) { 5 | module.exports = require(scriptPath); 6 | } else { 7 | throw new Error('HTMLCS must be built using `grunt build` before it can be required in Node.js.'); 8 | } 9 | -------------------------------------------------------------------------------- /licence.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Squiz Pty Ltd (ABN 77 084 670 600) 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of Squiz Pty Ltd nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "html_codesniffer", 3 | "version": "2.5.1", 4 | "description": "HTML_CodeSniffer is a client-side JavaScript that checks a HTML document or source code, and detects violations of a defined coding standard.", 5 | "license": "BSD-3-Clause", 6 | "main": "index.js", 7 | "keywords": [ 8 | "htmlcs" 9 | ], 10 | "scripts": { 11 | "prepack": "grunt build", 12 | "build": "grunt build", 13 | "test": "grunt eslint" 14 | }, 15 | "engines": { 16 | "node": ">=6" 17 | }, 18 | "files": [ 19 | "Auditor", 20 | "build", 21 | "Contrib", 22 | "Standards", 23 | "Translations", 24 | "HTMLCS.js", 25 | "HTMLCS.Util.js", 26 | "index.js" 27 | ], 28 | "repository": { 29 | "type": "git", 30 | "url": "https://github.com/squizlabs/HTML_CodeSniffer.git" 31 | }, 32 | "author": "Squiz", 33 | "bugs": { 34 | "url": "https://github.com/squizlabs/HTML_CodeSniffer/issues" 35 | }, 36 | "homepage": "http://squizlabs.github.io/HTML_CodeSniffer/", 37 | "devDependencies": { 38 | "grunt": "^1.1.0", 39 | "grunt-contrib-copy": "^1.0.0", 40 | "grunt-eslint": "^22.0.0", 41 | "grunt-contrib-watch": "^1.1.0", 42 | "load-grunt-tasks": "^5.1.0", 43 | "grunt-contrib-uglify": "^4.0.0" 44 | } 45 | } 46 | --------------------------------------------------------------------------------