WordPress Capability Test
If you can see this text with a border around it, basic HTML + inline styles work.
#test-style {
background: #ccffcc !important;
}
// Test 1: Basic JS
document.getElementById(‘test-js’).style.background = ‘#ccffcc’;
document.getElementById(‘test-js’).textContent = ‘✅ Test 1: JavaScript runs!’;
// Test 2: DOM manipulation
var el = document.getElementById(‘test-dom’);
var newSpan = document.createElement(‘span’);
newSpan.textContent = ‘✅ Test 2: DOM manipulation works!’;
el.textContent = ”;
el.appendChild(newSpan);
el.style.background = ‘#ccffcc’;
// Test 3: Style tag – already handled by the block above
// If it turned green, it works. Update the text:
var styleEl = document.getElementById(‘test-style’);
var computed = window.getComputedStyle(styleEl).backgroundColor;
if (computed === ‘rgb(204, 255, 204)’) {
styleEl.textContent = ‘✅ Test 3: Style tags work!’;
}
// Test 5: Data handling
var dolls = [
{ name: “Kaya”, hair: “black” },
{ name: “Felicity”, hair: “red” },
{ name: “Kit”, hair: “blonde” }
];
var filtered = dolls.filter(function(d) { return d.hair === “red”; });
var dataEl = document.getElementById(‘test-data’);
if (filtered.length === 1 && filtered[0].name === “Felicity”) {
dataEl.style.background = ‘#ccffcc’;
dataEl.textContent = ‘✅ Test 5: JS data handling works! (Found ‘ + filtered[0].name + ‘)’;
}
https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js
if (typeof _ !== ‘undefined’) {
var extEl = document.getElementById(‘test-external’);
extEl.style.background = ‘#ccffcc’;
extEl.textContent = ‘✅ Test 6: External scripts load! (lodash v’ + _.VERSION + ‘)’;
}