| Línea 14... |
Línea 14... |
| 14 |
// You should have received a copy of the GNU General Public License
|
14 |
// You should have received a copy of the GNU General Public License
|
| 15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
| Línea 16... |
Línea 16... |
| 16 |
|
16 |
|
| Línea 17... |
Línea 17... |
| 17 |
namespace tool_brickfield\local\htmlchecker\common\checks;
|
17 |
namespace tool_brickfield\local\htmlchecker\common\checks;
|
| Línea 18... |
Línea 18... |
| 18 |
|
18 |
|
| 19 |
use tool_brickfield\local\htmlchecker\common\brickfield_accessibility_tag_test;
|
19 |
use tool_brickfield\local\htmlchecker\common\brickfield_accessibility_test;
|
| 20 |
|
20 |
|
| 21 |
/**
|
21 |
/**
|
| Línea 26... |
Línea 26... |
| 26 |
*
|
26 |
*
|
| 27 |
* @package tool_brickfield
|
27 |
* @package tool_brickfield
|
| 28 |
* @copyright 2020 onward: Brickfield Education Labs, www.brickfield.ie
|
28 |
* @copyright 2020 onward: Brickfield Education Labs, www.brickfield.ie
|
| 29 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
29 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
| 30 |
*/
|
30 |
*/
|
| 31 |
class i_is_not_used extends brickfield_accessibility_tag_test {
|
31 |
class i_is_not_used extends brickfield_accessibility_test {
|
| Línea 32... |
Línea 32... |
| 32 |
|
32 |
|
| 33 |
/** @var int The default severity code for this test. */
|
33 |
/** @var int The default severity code for this test. */
|
| Línea 34... |
Línea 34... |
| 34 |
public $defaultseverity = \tool_brickfield\local\htmlchecker\brickfield_accessibility::BA_TEST_SEVERE;
|
34 |
public $defaultseverity = \tool_brickfield\local\htmlchecker\brickfield_accessibility::BA_TEST_SEVERE;
|
| 35 |
|
35 |
|
| - |
|
36 |
/** @var string The tag this test will fire on. */
|
| - |
|
37 |
public $tag = 'i';
|
| - |
|
38 |
|
| - |
|
39 |
/**
|
| - |
|
40 |
* Check for any i elements and flag them as errors
|
| - |
|
41 |
* while allowing font awesome icons to be used.
|
| - |
|
42 |
*/
|
| - |
|
43 |
public function check(): void {
|
| - |
|
44 |
foreach ($this->get_all_elements('i') as $element) {
|
| - |
|
45 |
// Ensure this is not a font awesome icon with aria-hidden.
|
| - |
|
46 |
if (str_contains($element->getAttribute('class'), 'fa-') && $element->getAttribute('aria-hidden') === 'true') {
|
| - |
|
47 |
continue;
|
| - |
|
48 |
}
|
| - |
|
49 |
$this->add_report($element);
|
| 36 |
/** @var string The tag this test will fire on. */
|
50 |
}
|