Files
servo/tests/wpt/css-tests/css-regions-1_dev/html/support/helpers.js

32 lines
843 B
JavaScript

document.addEventListener("DOMContentLoaded", function() {
// Mare sure we're styling with CSS
document.execCommand("styleWithCss", true, null);
});
function insertText(selector, newText) {
var selection = window.getSelection(),
insertionPoint = document.querySelector(selector),
range = document.createRange();
range.selectNode(insertionPoint);
selection.removeAllRanges();
selection.addRange(range);
document.execCommand("insertText", true, newText);
}
function duplicate(selector) {
var selection = window.getSelection(),
insertionPoint = document.querySelector(selector),
range = document.createRange();
range.selectNode(insertionPoint);
selection.removeAllRanges();
selection.addRange(range);
document.execCommand("copy", true, null);
selection.removeAllRanges();
document.execCommand("paste", true, null);
}