/* runTests - run tests against the content
*
* @param content - a string with the content to test
*/
function runTests(content) { 'use strict';
// keep track of the test number executed var testCounter = 1;
// create a DOM tree for the content var theDOM = document.createElement("body");
// check the content - if it has a body element, strip up to it and after the
// close
content = content.replace(/\n/g, " ");
if (content.search(/<body/i) !== -1) {
// there is an opening body tag
content = content.replace(/^.*<body[^>]*>/i, '');
if (content.search(/<\/[^>]*body/i) !== -1) {
content = content.replace(/<\/[^>]*body.*$/i, '');
}
}
var parseFail = false ; var parseMessage = "" ;
if ("" === content || content.search(/^ +$/) !== -1 ) {
// there is NO content
parseFail = true;
parseMessage = "Content is empty";
} else {
try {
// add the content into the created body element
theDOM.innerHTML = content;
}
catch(err) {
parseFail = true;
parseMessage = err;
}
}
// loop over the tree looking for roles with the values in theRoles
theRoles.forEach(function(role) { var tName = testCounter + " " + "Uses role " + role;
testCounter += 1; var nodes = theDOM.querySelectorAll('[role~="'+role+'"]');
if (nodes.length) {
// there are matching nodes
test(function() {
assert_true(true, "Found the role");
}, tName);
}
});
done();
};
on_event(document, "DOMContentLoaded", function() { var runButton = document.getElementById('dpub-run') ; var closeButton = document.getElementById('dpub-close') ;
on_event(runButton, "click", function() { var content = document.getElementById("dpub-input");
runTests(content.value);
});
});
</script>
</head>
<body>
<p>Fill the textarea below with the contents of a <code>body</code> element
from HTML markup from that reflects your usage of
DPub-ARIA roles. Then select"Run Test" to evaluate the content.</p>
<form name="dpub" id="dpub">
<textarea name="dpub-input" id="dpub-input"style="width: 90%; height: 10em" ></textarea>
<p><input type="button" id="dpub-run" name="Run Test" value="Run Test">
<inputstyle="display: none" type="button" id="dpub-close"
name="Close" value="Close"></p>
</form>
<div id="log"></div>
</body>
</html>
Messung V0.5
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.