Skip to content

Commit

Permalink
feature-detect inline SVG, fallback close-msg-area button to text aut…
Browse files Browse the repository at this point in the history
…omatically
  • Loading branch information
YakovL committed Feb 12, 2019
1 parent 3784233 commit 0568548
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions js/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ function getMessageDiv()
return null;
if(!msgArea.hasChildNodes()) {
var btn = createTiddlyButton(createTiddlyElement(msgArea,"div",null,"messageArea__toolbar messageToolbar"),
config.messages.messageClose.text,
'',
config.messages.messageClose.tooltip,
clearMessage,
"button messageToolbar__button");
if(!config.options.chkDontUseSvgIcons) {
btn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10" class="messageToolbar__icon">'+
' <rect width="1" height="13.1" x="4.5" y="-1.6" transform="rotate(-45 5 5)"/>'+
' <rect width="1" height="13.1" x="4.5" y="-1.6" transform="rotate(+45 5 5)"/>'+
'</svg>';
btn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10" class="messageToolbar__icon">'+
' <rect width="1" height="13.1" x="4.5" y="-1.6" transform="rotate(-45 5 5)"/>'+
' <rect width="1" height="13.1" x="4.5" y="-1.6" transform="rotate(+45 5 5)"/>'+
'</svg>';
if(window.HTMLUnknownElement && btn.firstChild instanceof window.HTMLUnknownElement) {
btn.innerHTML = config.messages.messageClose.text;
} else {
btn.classList.add('messageToolbar__button_withIcon');
}
}
Expand Down

0 comments on commit 0568548

Please sign in to comment.