Permalink
Browse files

MDL-39949 - Blocks - preventing blocks with empty titles from blockin…

…g the execution of javascript
  • Loading branch information...
jsnfwlr authored and Sam Hemelryk committed Jun 10, 2013
1 parent d3cf194 commit 64ddb28dfd3be46d74e4f7cf627c707c8ef81124
Showing with 9 additions and 2 deletions.
  1. +9 −2 blocks/dock.js
View
@@ -836,8 +836,15 @@ M.core_dock.genericblock.prototype = {
}
// Must set the image src seperatly of we get an error with XML strict headers
- var moveto = Y.Node.create('<input type="image" class="moveto customcommand requiresjs" alt="'+M.str.block.addtodock+'" title="'+
- Y.Escape.html(M.util.get_string('dockblock', 'block', node.one('.header .title h2').getHTML())) +'" />');
+ var moveto = Y.Node.create('<input type="image" class="moveto customcommand requiresjs" />');
+ var header = node.one('.header .title h2');
+ moveto.setAttribute('alt', Y.Escape.html(M.util.get_string('addtodock', 'block')));
+ if (header) {
+ moveto.setAttribute('title', Y.Escape.html(M.util.get_string('dockblock', 'block', header.getHTML())));
+ } else {
+ moveto.setAttribute('title', Y.Escape.html(M.util.get_string('addtodock', 'block')));
+ }
+
var icon = 't/block_to_dock';
if (right_to_left()) {
icon = 't/block_to_dock_rtl';

0 comments on commit 64ddb28

Please sign in to comment.