mirror of
https://github.com/moodle/moodle.git
synced 2025-04-25 10:26:17 +02:00
Merge branch 'MDL-44116-master' of git://github.com/damyon/moodle
This commit is contained in:
commit
4a928b9dfc
@ -22,8 +22,13 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Accessibility checker';
|
||||
$string['nowarnings'] = 'Congratulations, no accessibility problems found!';
|
||||
$string['report'] = 'Accessibility report:';
|
||||
$string['emptytext'] = 'Empty text';
|
||||
$string['imagesmissingalt'] = 'Images require alternative text. To fix this warning, add an alt attribute to your img tags. An empty alt attribute may be used, but only when the image is purely decorative and carries no information.';
|
||||
$string['needsmorecontrast'] = 'The colours of the foreground and background text do not have enough contrast. To fix this warning, change either foreground or background colour of the text so that it is easier to read.';
|
||||
$string['needsmoreheadings'] = 'There is a lot of text with no headings. Headings will allow screen reader users to navigate through the page easily and will make the page more usable for everyone.';
|
||||
$string['nowarnings'] = 'Congratulations, no accessibility problems found!';
|
||||
$string['pluginname'] = 'Accessibility checker';
|
||||
$string['report'] = 'Accessibility report:';
|
||||
$string['tablesmissingcaption'] = 'Tables should have captions. While it is not necessary for each table to have a caption, a caption is generally very helpful.';
|
||||
$string['tablesmissingheaders'] = 'Tables should use row and/or column headers.';
|
||||
$string['tableswithmergedcells'] = 'Tables should not contain merged cells. Despite being standard markup for tables for many years, some screen readers still do not fully support complex tables. When possible, try to "flatten" the table and avoid merged cells.';
|
||||
|
@ -34,7 +34,12 @@ function atto_accessibilitychecker_strings_for_js() {
|
||||
$PAGE->requires->strings_for_js(array('nowarnings',
|
||||
'report',
|
||||
'imagesmissingalt',
|
||||
'needsmorecontrast'),
|
||||
'needsmorecontrast',
|
||||
'needsmoreheadings',
|
||||
'tableswithmergedcells',
|
||||
'tablesmissingcaption',
|
||||
'emptytext',
|
||||
'tablesmissingheaders'),
|
||||
'atto_accessibilitychecker');
|
||||
}
|
||||
|
||||
|
@ -34,3 +34,39 @@ Feature: Atto accessibility checker
|
||||
When I click on "Show more buttons" "button"
|
||||
And I click on "Accessibility checker" "button"
|
||||
Then I should see "The colours of the foreground and background text do not have enough contrast."
|
||||
|
||||
@javascript
|
||||
Scenario: No headings
|
||||
Given I log in as "admin"
|
||||
And I navigate to "Edit profile" node in "My profile settings"
|
||||
And I set the field "Description" to "<p>Sweet roll oat cake jelly-o macaroon donut oat cake. Caramels macaroon cookie sweet roll croissant cheesecake candy jelly-o. Gummies sugar plum sugar plum gingerbread dessert. Tiramisu bonbon jujubes danish marshmallow cookie chocolate cake cupcake tiramisu. Bear claw oat cake chocolate bar croissant. Lollipop cookie topping liquorice croissant. Brownie cookie cupcake lollipop cupcake cupcake. Fruitcake dessert sweet biscuit dragée caramels marzipan brownie. Chupa chups gingerbread apple pie cookie liquorice caramels carrot cake cookie gingerbread. Croissant candy jelly beans. Tiramisu apple pie dessert apple pie macaroon soufflé. Brownie powder carrot cake chocolate. Tart applicake croissant dragée macaroon chocolate donut.</p><p>Jelly beans gingerbread tootsie roll. Sugar plum tiramisu cotton candy toffee pie cotton candy tiramisu. Carrot cake chocolate bar sesame snaps cupcake cake dessert sweet fruitcake wafer. Marshmallow cupcake gingerbread pie sweet candy canes powder gummi bears. Jujubes cake muffin marshmallow candy jelly beans tootsie roll pie. Gummi bears applicake chocolate cake sweet jelly sesame snaps lollipop lollipop carrot cake. Marshmallow cake jelly beans. Jelly beans sesame snaps muffin halvah cookie ice cream candy canes carrot cake. Halvah donut marshmallow tiramisu. Cookie dessert gummi bears. Sugar plum apple pie jelly beans gummi bears tart chupa chups. Liquorice macaroon gummi bears gummies macaroon marshmallow sweet roll cake topping. Lemon drops caramels pie icing danish. Chocolate cake oat cake dessert halvah danish carrot cake apple pie.</p>"
|
||||
When I click on "Show more buttons" "button"
|
||||
And I click on "Accessibility checker" "button"
|
||||
Then I should see "There is a lot of text with no headings."
|
||||
|
||||
@javascript
|
||||
Scenario: Merged cells
|
||||
Given I log in as "admin"
|
||||
And I navigate to "Edit profile" node in "My profile settings"
|
||||
And I set the field "Description" to "<table><caption>Dogs that look good in pants</caption><tr><th>Breed</th><th>Coolness</th></tr><tr><td>Poodle</td><td rowspan='2'>NOT COOL</td></tr><tr><td>Doberman</td></tr></table>"
|
||||
When I click on "Show more buttons" "button"
|
||||
And I click on "Accessibility checker" "button"
|
||||
Then I should see "Tables should not contain merged cells."
|
||||
|
||||
@javascript
|
||||
Scenario: Table missing row/column headers
|
||||
Given I log in as "admin"
|
||||
And I navigate to "Edit profile" node in "My profile settings"
|
||||
And I set the field "Description" to "<table><caption>Dogs that look good in pants</caption><tr><th>Breed</th><td>Coolness</td></tr><tr><td>Poodle</td><td>NOT COOL</td></tr><tr><td>Doberman</td><td>COOL</td></tr></table>"
|
||||
When I click on "Show more buttons" "button"
|
||||
And I click on "Accessibility checker" "button"
|
||||
Then I should see "Tables should use row and/or column headers."
|
||||
|
||||
@javascript
|
||||
Scenario: Table missing caption
|
||||
Given I log in as "admin"
|
||||
And I navigate to "Edit profile" node in "My profile settings"
|
||||
And I set the field "Description" to "<table><tr><th>Breed</th><th>Coolness</th></tr><tr><td>Poodle</td><td>NOT COOL</td></tr><tr><td>Doberman</td><td>COOL</td></tr></table>"
|
||||
When I click on "Show more buttons" "button"
|
||||
And I click on "Accessibility checker" "button"
|
||||
Then I should see "Tables should have captions."
|
||||
|
@ -170,10 +170,57 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
}, this);
|
||||
this._addWarnings(list, M.util.get_string('needsmorecontrast', COMPONENT), problemNodes, false);
|
||||
|
||||
// Check for lots of text with no headings.
|
||||
if (this.editor.get('text').length > 1000 && !this.editor.one('h3, h4, h5')) {
|
||||
this._addWarnings(list, M.util.get_string('needsmoreheadings', COMPONENT), [this.editor], false);
|
||||
}
|
||||
|
||||
// Check for tables with no captions.
|
||||
problemNodes = [];
|
||||
this.editor.all('table').each(function (table) {
|
||||
caption = table.one('caption');
|
||||
if (caption === null) {
|
||||
problemNodes.push(table);
|
||||
}
|
||||
}, this);
|
||||
this._addWarnings(list, M.util.get_string('tablesmissingcaption', COMPONENT), problemNodes, false);
|
||||
|
||||
// Check for tables with merged cells.
|
||||
problemNodes = [];
|
||||
this.editor.all('table').each(function (table) {
|
||||
caption = table.one('[colspan],[rowspan]');
|
||||
if (caption !== null) {
|
||||
problemNodes.push(table);
|
||||
}
|
||||
}, this);
|
||||
this._addWarnings(list, M.util.get_string('tableswithmergedcells', COMPONENT), problemNodes, false);
|
||||
|
||||
// Check for tables with no row/col headers
|
||||
problemNodes = [];
|
||||
this.editor.all('table').each(function (table) {
|
||||
if (table.one('tr').one('td')) {
|
||||
// First row has a non-header cell, so all rows must have at least one header.
|
||||
table.all('tr').some(function (row) {
|
||||
if (!row.one('th')) {
|
||||
problemNodes.push(table);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, this);
|
||||
} else {
|
||||
// First row must have at least one header then.
|
||||
if (!table.one('tr').one('th')) {
|
||||
problemNodes.push(table);
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
this._addWarnings(list, M.util.get_string('tablesmissingheaders', COMPONENT), problemNodes, false);
|
||||
|
||||
if (!list.hasChildNodes()) {
|
||||
list.append('<p>' + M.util.get_string('nowarnings', COMPONENT) + '</p>');
|
||||
}
|
||||
// Append the list of current styles.
|
||||
|
||||
// Return the list of current warnings.
|
||||
return list;
|
||||
},
|
||||
|
||||
@ -187,7 +234,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
* @param {boolean} imagewarnings true if the warnings are related to images, false if text.
|
||||
*/
|
||||
_addWarnings: function(list, description, nodes, imagewarnings) {
|
||||
var warning, fails, i, src, textfield, li, link;
|
||||
var warning, fails, i, src, textfield, li, link, text;
|
||||
|
||||
if (nodes.length > 0) {
|
||||
warning = Y.Node.create('<p>' + description + '</p>');
|
||||
@ -200,7 +247,11 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
link = Y.Node.create('<a href="#"><img src="' + src + '" /> ' + src + '</a>');
|
||||
} else {
|
||||
textfield = ('innerText' in nodes[i]) ? 'innerText' : 'textContent';
|
||||
link = Y.Node.create('<a href="#">' + nodes[i].get(textfield) + '</a>');
|
||||
text = nodes[i].get(textfield).trim();
|
||||
if (text === '') {
|
||||
text = M.util.get_string('emptytext', COMPONENT);
|
||||
}
|
||||
link = Y.Node.create('<a href="#">' + text + '</a>');
|
||||
}
|
||||
link.setData('sourceNode', nodes[i]);
|
||||
li.append(link);
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-atto_accessibilitychecker-button",function(e,t){var n="atto_accessibilitychecker";e.namespace("M.atto_accessibilitychecker").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){this.addButton({icon:"e/accessibility_checker",callback:this._displayDialogue})},_displayDialogue:function(){var e=this.getDialogue({headerContent:M.util.get_string("pluginname",n),width:"500px",focusAfterHide:!0});e.set("bodyContent",this._getDialogueContent()).show()},_getDialogueContent:function(){var t=e.Node.create('<div style="word-wrap: break-word;"></div>');return t.append(this._getWarnings()),t.delegate("click",function(e){e.preventDefault();var t=this.get("host"),n=e.currentTarget.getData("sourceNode"),r=this.getDialogue();n?(r.set("focusAfterHide",this.editor).hide(),t.setSelection(t.getSelectionFromNode(n))):r.hide()},"a",this),t},_getWarnings:function(){var t,r=e.Node.create("<div></div>");return t=[],this.editor.all("img").each(function(e){alt=e.getAttribute("alt"),(typeof alt=="undefined"||alt==="")&&e.getAttribute("role")!=="presentation"&&t.push(e)},this),this._addWarnings(r,M.util.get_string("imagesmissingalt",n),t,!0),t=[],this.editor.all("*").each(function(n){var r,i,s,o,u;if(e.Lang.trim(n.get("text"))!==""){r=n.getComputedStyle("color"),i=n.getComputedStyle("backgroundColor"),o=this._getLuminanceFromCssColor(r),u=this._getLuminanceFromCssColor(i),o>u?s=(o+.05)/(u+.05):s=(u+.05)/(o+.05);if(s<=4.5){var a=0,f=!1;for(a=0;a<t.length;a++){if(n.ancestors("*").indexOf(t[a])!==-1){f=!0;break}if(t[a].ancestors("*").indexOf(n)!==-1){t[a]=n,f=!0;break}}f||t.push(n)}}},this),this._addWarnings(r,M.util.get_string("needsmorecontrast",n),t,!1),r.hasChildNodes()||r.append("<p>"+M.util.get_string("nowarnings",n)+"</p>"),r},_addWarnings:function(t,n,r,i){var s,o,u,a,f,l,c;if(r.length>0){s=e.Node.create("<p>"+n+"</p>"),o=e.Node.create('<ol class="accessibilitywarnings"></ol>'),u=0;for(u=0;u<r.length;u++)l=e.Node.create("<li></li>"),i?(a=r[u].getAttribute("src"),c=e.Node.create('<a href="#"><img src="'+a+'" /> '+a+"</a>")):(f="innerText"in r[u]?"innerText":"textContent",c=e.Node.create('<a href="#">'+r[u].get(f)+"</a>")),c.setData("sourceNode",r[u]),l.append(c),o.append(l);s.append(o),t.append(s)}},_getLuminanceFromCssColor:function(t){var n;t==="transparent"&&(t="#ffffff"),n=e.Color.toArray(e.Color.toRGB(t));var r=function(e){return e=parseInt(e,10)/255,e<=.03928?e/=12.92:e=Math.pow((e+.055)/1.055,2.4),e},i=r(n[0]),s=r(n[1]),o=r(n[2]);return.2126*i+.7152*s+.0722*o}})},"@VERSION@",{requires:["color-base","moodle-editor_atto-plugin"]});
|
||||
YUI.add("moodle-atto_accessibilitychecker-button",function(e,t){var n="atto_accessibilitychecker";e.namespace("M.atto_accessibilitychecker").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){this.addButton({icon:"e/accessibility_checker",callback:this._displayDialogue})},_displayDialogue:function(){var e=this.getDialogue({headerContent:M.util.get_string("pluginname",n),width:"500px",focusAfterHide:!0});e.set("bodyContent",this._getDialogueContent()).show()},_getDialogueContent:function(){var t=e.Node.create('<div style="word-wrap: break-word;"></div>');return t.append(this._getWarnings()),t.delegate("click",function(e){e.preventDefault();var t=this.get("host"),n=e.currentTarget.getData("sourceNode"),r=this.getDialogue();n?(r.set("focusAfterHide",this.editor).hide(),t.setSelection(t.getSelectionFromNode(n))):r.hide()},"a",this),t},_getWarnings:function(){var t,r=e.Node.create("<div></div>");return t=[],this.editor.all("img").each(function(e){alt=e.getAttribute("alt"),(typeof alt=="undefined"||alt==="")&&e.getAttribute("role")!=="presentation"&&t.push(e)},this),this._addWarnings(r,M.util.get_string("imagesmissingalt",n),t,!0),t=[],this.editor.all("*").each(function(n){var r,i,s,o,u;if(e.Lang.trim(n.get("text"))!==""){r=n.getComputedStyle("color"),i=n.getComputedStyle("backgroundColor"),o=this._getLuminanceFromCssColor(r),u=this._getLuminanceFromCssColor(i),o>u?s=(o+.05)/(u+.05):s=(u+.05)/(o+.05);if(s<=4.5){var a=0,f=!1;for(a=0;a<t.length;a++){if(n.ancestors("*").indexOf(t[a])!==-1){f=!0;break}if(t[a].ancestors("*").indexOf(n)!==-1){t[a]=n,f=!0;break}}f||t.push(n)}}},this),this._addWarnings(r,M.util.get_string("needsmorecontrast",n),t,!1),this.editor.get("text").length>1e3&&!this.editor.one("h3, h4, h5")&&this._addWarnings(r,M.util.get_string("needsmoreheadings",n),[this.editor],!1),t=[],this.editor.all("table").each(function(e){caption=e.one("caption"),caption===null&&t.push(e)},this),this._addWarnings(r,M.util.get_string("tablesmissingcaption",n),t,!1),t=[],this.editor.all("table").each(function(e){caption=e.one("[colspan],[rowspan]"),caption!==null&&t.push(e)},this),this._addWarnings(r,M.util.get_string("tableswithmergedcells",n),t,!1),t=[],this.editor.all("table").each(function(e){e.one("tr").one("td")?e.all("tr").some(function(n){return n.one("th")?!1:(t.push(e),!0)},this):e.one("tr").one("th")||t.push(e)},this),this._addWarnings(r,M.util.get_string("tablesmissingheaders",n),t,!1),r.hasChildNodes()||r.append("<p>"+M.util.get_string("nowarnings",n)+"</p>"),r},_addWarnings:function(t,r,i,s){var o,u,a,f,l,c,h,p;if(i.length>0){o=e.Node.create("<p>"+r+"</p>"),u=e.Node.create('<ol class="accessibilitywarnings"></ol>'),a=0;for(a=0;a<i.length;a++)c=e.Node.create("<li></li>"),s?(f=i[a].getAttribute("src"),h=e.Node.create('<a href="#"><img src="'+f+'" /> '+f+"</a>")):(l="innerText"in i[a]?"innerText":"textContent",p=i[a].get(l).trim(),p===""&&(p=M.util.get_string("emptytext",n)),h=e.Node.create('<a href="#">'+p+"</a>")),h.setData("sourceNode",i[a]),c.append(h),u.append(c);o.append(u),t.append(o)}},_getLuminanceFromCssColor:function(t){var n;t==="transparent"&&(t="#ffffff"),n=e.Color.toArray(e.Color.toRGB(t));var r=function(e){return e=parseInt(e,10)/255,e<=.03928?e/=12.92:e=Math.pow((e+.055)/1.055,2.4),e},i=r(n[0]),s=r(n[1]),o=r(n[2]);return.2126*i+.7152*s+.0722*o}})},"@VERSION@",{requires:["color-base","moodle-editor_atto-plugin"]});
|
||||
|
@ -165,10 +165,57 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
}, this);
|
||||
this._addWarnings(list, M.util.get_string('needsmorecontrast', COMPONENT), problemNodes, false);
|
||||
|
||||
// Check for lots of text with no headings.
|
||||
if (this.editor.get('text').length > 1000 && !this.editor.one('h3, h4, h5')) {
|
||||
this._addWarnings(list, M.util.get_string('needsmoreheadings', COMPONENT), [this.editor], false);
|
||||
}
|
||||
|
||||
// Check for tables with no captions.
|
||||
problemNodes = [];
|
||||
this.editor.all('table').each(function (table) {
|
||||
caption = table.one('caption');
|
||||
if (caption === null) {
|
||||
problemNodes.push(table);
|
||||
}
|
||||
}, this);
|
||||
this._addWarnings(list, M.util.get_string('tablesmissingcaption', COMPONENT), problemNodes, false);
|
||||
|
||||
// Check for tables with merged cells.
|
||||
problemNodes = [];
|
||||
this.editor.all('table').each(function (table) {
|
||||
caption = table.one('[colspan],[rowspan]');
|
||||
if (caption !== null) {
|
||||
problemNodes.push(table);
|
||||
}
|
||||
}, this);
|
||||
this._addWarnings(list, M.util.get_string('tableswithmergedcells', COMPONENT), problemNodes, false);
|
||||
|
||||
// Check for tables with no row/col headers
|
||||
problemNodes = [];
|
||||
this.editor.all('table').each(function (table) {
|
||||
if (table.one('tr').one('td')) {
|
||||
// First row has a non-header cell, so all rows must have at least one header.
|
||||
table.all('tr').some(function (row) {
|
||||
if (!row.one('th')) {
|
||||
problemNodes.push(table);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, this);
|
||||
} else {
|
||||
// First row must have at least one header then.
|
||||
if (!table.one('tr').one('th')) {
|
||||
problemNodes.push(table);
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
this._addWarnings(list, M.util.get_string('tablesmissingheaders', COMPONENT), problemNodes, false);
|
||||
|
||||
if (!list.hasChildNodes()) {
|
||||
list.append('<p>' + M.util.get_string('nowarnings', COMPONENT) + '</p>');
|
||||
}
|
||||
// Append the list of current styles.
|
||||
|
||||
// Return the list of current warnings.
|
||||
return list;
|
||||
},
|
||||
|
||||
@ -182,7 +229,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
* @param {boolean} imagewarnings true if the warnings are related to images, false if text.
|
||||
*/
|
||||
_addWarnings: function(list, description, nodes, imagewarnings) {
|
||||
var warning, fails, i, src, textfield, li, link;
|
||||
var warning, fails, i, src, textfield, li, link, text;
|
||||
|
||||
if (nodes.length > 0) {
|
||||
warning = Y.Node.create('<p>' + description + '</p>');
|
||||
@ -195,7 +242,11 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
link = Y.Node.create('<a href="#"><img src="' + src + '" /> ' + src + '</a>');
|
||||
} else {
|
||||
textfield = ('innerText' in nodes[i]) ? 'innerText' : 'textContent';
|
||||
link = Y.Node.create('<a href="#">' + nodes[i].get(textfield) + '</a>');
|
||||
text = nodes[i].get(textfield).trim();
|
||||
if (text === '') {
|
||||
text = M.util.get_string('emptytext', COMPONENT);
|
||||
}
|
||||
link = Y.Node.create('<a href="#">' + text + '</a>');
|
||||
}
|
||||
link.setData('sourceNode', nodes[i]);
|
||||
li.append(link);
|
||||
|
@ -168,10 +168,57 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
}, this);
|
||||
this._addWarnings(list, M.util.get_string('needsmorecontrast', COMPONENT), problemNodes, false);
|
||||
|
||||
// Check for lots of text with no headings.
|
||||
if (this.editor.get('text').length > 1000 && !this.editor.one('h3, h4, h5')) {
|
||||
this._addWarnings(list, M.util.get_string('needsmoreheadings', COMPONENT), [this.editor], false);
|
||||
}
|
||||
|
||||
// Check for tables with no captions.
|
||||
problemNodes = [];
|
||||
this.editor.all('table').each(function (table) {
|
||||
caption = table.one('caption');
|
||||
if (caption === null) {
|
||||
problemNodes.push(table);
|
||||
}
|
||||
}, this);
|
||||
this._addWarnings(list, M.util.get_string('tablesmissingcaption', COMPONENT), problemNodes, false);
|
||||
|
||||
// Check for tables with merged cells.
|
||||
problemNodes = [];
|
||||
this.editor.all('table').each(function (table) {
|
||||
caption = table.one('[colspan],[rowspan]');
|
||||
if (caption !== null) {
|
||||
problemNodes.push(table);
|
||||
}
|
||||
}, this);
|
||||
this._addWarnings(list, M.util.get_string('tableswithmergedcells', COMPONENT), problemNodes, false);
|
||||
|
||||
// Check for tables with no row/col headers
|
||||
problemNodes = [];
|
||||
this.editor.all('table').each(function (table) {
|
||||
if (table.one('tr').one('td')) {
|
||||
// First row has a non-header cell, so all rows must have at least one header.
|
||||
table.all('tr').some(function (row) {
|
||||
if (!row.one('th')) {
|
||||
problemNodes.push(table);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, this);
|
||||
} else {
|
||||
// First row must have at least one header then.
|
||||
if (!table.one('tr').one('th')) {
|
||||
problemNodes.push(table);
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
this._addWarnings(list, M.util.get_string('tablesmissingheaders', COMPONENT), problemNodes, false);
|
||||
|
||||
if (!list.hasChildNodes()) {
|
||||
list.append('<p>' + M.util.get_string('nowarnings', COMPONENT) + '</p>');
|
||||
}
|
||||
// Append the list of current styles.
|
||||
|
||||
// Return the list of current warnings.
|
||||
return list;
|
||||
},
|
||||
|
||||
@ -185,7 +232,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
* @param {boolean} imagewarnings true if the warnings are related to images, false if text.
|
||||
*/
|
||||
_addWarnings: function(list, description, nodes, imagewarnings) {
|
||||
var warning, fails, i, src, textfield, li, link;
|
||||
var warning, fails, i, src, textfield, li, link, text;
|
||||
|
||||
if (nodes.length > 0) {
|
||||
warning = Y.Node.create('<p>' + description + '</p>');
|
||||
@ -198,7 +245,11 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
link = Y.Node.create('<a href="#"><img src="' + src + '" /> ' + src + '</a>');
|
||||
} else {
|
||||
textfield = ('innerText' in nodes[i]) ? 'innerText' : 'textContent';
|
||||
link = Y.Node.create('<a href="#">' + nodes[i].get(textfield) + '</a>');
|
||||
text = nodes[i].get(textfield).trim();
|
||||
if (text === '') {
|
||||
text = M.util.get_string('emptytext', COMPONENT);
|
||||
}
|
||||
link = Y.Node.create('<a href="#">' + text + '</a>');
|
||||
}
|
||||
link.setData('sourceNode', nodes[i]);
|
||||
li.append(link);
|
||||
|
Loading…
x
Reference in New Issue
Block a user