ultimate_tictactoe/tools.js

19 lines
424 B
JavaScript
Raw Normal View History

2019-03-24 16:43:29 +01:00
function clear(node) {
while (node.hasChildNodes()) {
clear(node.firstChild);
}
node.parentNode.removeChild(node);
}
function clearInner(node) {
while (node.hasChildNodes()) {
clear(node.firstChild);
}
2019-03-29 20:41:15 +01:00
}
// encoding helper (found here: https://stackoverflow.com/a/2794366)
function encodeHTML(s) {
return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
2019-03-24 16:43:29 +01:00
}