JSFiddle - React, Tailwind, and code Playground
by holf
JavaScript
var fragment = document.implementation.createDocument('http://www.parliament.uk/commons/hansard/print', 'Fragment', null);
var headerElement = createHeaderElement(0, 4, "Monday 17 September 2012", "AA-AB1");
fragment.documentElement.appendChild(headerElement);
console.log(fragment);
function createHeaderElement(houseNumber, systemNumber, hansardDate, sectionCode)
{
var header = fragment.createElement("Header");
header.appendChild(createElementWithTextContent("House", houseNumber));
header.appendChild(createElementWithTextContent("System", systemNumber));
header.appendChild(createElementWithTextContent("Sitting", hansardDate));
header.appendChild(createElementWithTextContent("Section", sectionCode));
header.appendChild(createElementWithTextContent("TransformationVersion", 0.7));
return header;
}
function createElementWithTextContent(nameOfElementToAdd, textContentOfElementToAdd)
{
var elementToAdd = fragment.createElement(nameOfElementToAdd);
var textContent = fragment.createTextNode(textContentOfElementToAdd);
elementToAdd.appendChild(textContent);
return elementToAdd;
}