-
Notifications
You must be signed in to change notification settings - Fork 429
tidy validates incorrectly inside of <template> #282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@shwoodard thanks for opening this issue... I guess when html5 was added to tidy, the use of the Has the W3C spec moved on since then? Maybe some with W3C knowledge can comment, and maybe provides some links to read... To check browser support I scraped a working example from whatwg.org - thanks to them - <!DOCTYPE html>
<meta charset="utf-8">
<title>Test 2 - template tag #282 - Cat data</title>
<script>
// Data is hard-coded here, but could come from the server
var data = [
{ name: 'Pillar', color: 'Ticked Tabby', sex: 'Female (neutered)', legs: 3 },
{ name: 'Hedral', color: 'Tuxedo', sex: 'Male (neutered)', legs: 4 },
];
</script>
<table>
<thead>
<tr>
<th>Name <th>Colour <th>Sex <th>Legs
<tbody>
<template id="row">
<tr><td><td><td><td>
</template>
</table>
<script>
var template = document.querySelector('#row');
for (var i = 0; i < data.length; i += 1) {
var cat = data[i];
var clone = template.content.cloneNode(true);
var cells = clone.querySelectorAll('td');
cells[0].textContent = cat.name;
cells[1].textContent = cat.color;
cells[2].textContent = cat.sex;
cells[3].textContent = cat.legs;
template.parentNode.appendChild(clone);
}
</script> This seems to function fine in chrome and firefox, but not in IE, Opera, or Safari, but I may not have all the latest windows 7 64-bit versions installed... especially since this caniuse.com report suggests better than I found... Of course I am unable to construct even a simple sample that passes the W3C validator... but there have been some 'complaints' about that like here in stackoverflow... but that was a few years ago... The following sample got close, but shows the nu validator is parsing the text in the <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test 3 - template #282</title>
</head>
<body>
<template id="tmpl__lane">
<li class="lane">
<h2></h2>
<ol class="stories"></ol>
</li>
</template>
<p>Test 3 - template #282</p>
</body>
</html> I hope someone can give us some samples using My reading of the spec is that the But the first step here is to hear from some people with good W3C intel... So again, thanks for bringing it up. Is it now time to kick tidy |
And such a service, to treat the meta content as a text node, with no html parsing applied, if implemented in tidy, may also be useful for the For them we need a service that collects a text token from the stream, until the first container close tag is found, and the |
This As always, ideas, patches, PR very welcome... |
No further comment for many weeks, so closing this for now... Please feel free to re-open, or raise another issue... thanks... |
Templates should be validated with different semantics. IOW, if I am templating an
<li>
, I should not be warned that an<ul>
will be implicitly inserted.Template html src
Error on line one:
missing </template> before <li>
Error on line 2
inserting implicit <ul>
Error on line three
trimming empty <h2>
imho, none of these errors should appear due that we are inside of a
<template>
.The text was updated successfully, but these errors were encountered: