#!/usr/bin/env python TEMPLATE = '''
Documenting the open web
This is a test case that checks how browsers react to specific JavaScript, CSS, or HTML markup. It does not necessarily correspond to any web standard, so you should not automatically interpret a "fail" result as a bug.
<%(parentelementname)s><%(elementname)s id="test">%(elementname)s>%(parentelementname)s>
tested.....<%(parentelementname)s><%(elementname)s id="test"></%(parentelementname)s>
expected...document.getElementById("test") != null
found......document.getElementById("test")
'''
for wikiname, parentelementname, elementname in [l.strip().split(' ', 2) for l in file('html/elements/elements.txt').readlines() if not l.startswith('#')]:
testFile = 'html/elements/' + elementname.replace(' ', '-').replace('=', '-') + '-element-'
if parentelementname != 'null':
testFile += 'as-child-of-' + parentelementname + '-'
aschildof = ' as child of ' + parentelementname
else:
aschildof = ''
testFile += 'appears-in-dom-test.html'
output = TEMPLATE % globals()
output = output.replace('', '').replace(' ', '')
output = output.replace('<null>', '').replace('</null>', '')
print testFile
file(testFile, 'w').write(output)