Here's your answer in plain JavaScript:
// Get the element with ID 'partnered'
// Get a <span> element (create one if there's none)
var partnered = Document.prototype.getElementById.call(document, 'partnered'),
span = (
Document.prototype.querySelector.call(document, 'span') ||
Document.prototype.createElement.call(document, 'span')
);
// Custom function
function addClass() {
var args = [... arguments].slice(1),
$args = args.length,
element = arguments[0];
// Loop through arguments to update them
for (var i = 0; i < $args; i += 1)
args[i] = String(args[i]);
// Loop through arguments after updating all of them
for (var i = 0; i < $args; i += 1) {
// Cache the index
var className = args[i];
// Append new class name
element.setAttribute(
'class',
// Get the current class
((element.getAttribute('class') || '')
// Remove existing duplicates of the class to add
.replace(RegExp('\\b' + className + '\\b', '')
// Keep the class attribute tidy
// and add the class
.trim() + ' ' + className).trim()
)
}
}
/* Synchronously
A while loop could work too if you're certain enough.
*/
if (span.textContent || span.innerText)
addClass(partnered, 'checkmarked');
/* Asynchronously */
(function check() {
if (span.textContent || span.innerText)
addClass(partnered, 'checkmarked');
else
typeof requestAnimationFrame == 'function' ?
requestAnimationFrame(check) :
setTimeout(check)
})