It seems like phantomjs does not like <template> tags inside of a <table> or <tr> tag. The <template> tag was introduced a long while ago, and intentionally is supposed to be supported as a child of nearly any other element, including <table> and <tr>.
I've been utilizing them in an experiment with vue.js, so I know it works in the major web browsers, but I went to try it with phantomjs, and received unexpected errors: the result of it moving the <template> tag outside of the <table>.
Here's the test html code I have for demonstration purposes:
<!DOCTYPE html>
<html>
<head>
<script src='http://cdnjs.cloudflare.com/ajax/libs/vue/1.0.14/vue.min.js' type="text/javascript"></script>
</head>
<body>
<div id='page'>
<div id='content'>
<h1 class='ui-widget-header ui-corner-top'>Job List</h1>
<table id="job_report" class="job_report">
<thead>
<tr>
<th class='nowrap'> Job # </th>
</tr>
</thead>
<tbody>
<template v-for='entry in report.jobs'>
<tr>
<td colspan=4>{{entry.number}}</td>
</tr>
</template>
</tbody>
</table>
<script type='text/javascript'>
lastnote = null;
jobdata = new Vue({
el: '#job_report',
data: {
report: {'jobs': [{"number":"12345"}, {"number":"67890"}]},
},
});
</script>
</div>
</div>
</body>
</html>
I've been using phantomjs from the command line like this:
phantomjs render_page.js test.html
render_page.js:
var page = require('webpage').create(),
system = require('system'),
address;
if(system.args.length === 1) {
console.log('Usage: render_page.js <URL>');
phantom.exit();
}
address = system.args[1];
page.onConsoleMessage = function(msg) {
console.log(msg);
}
page.open(address, function(status) {
if(status !== 'success') {
console.log('Failed to load address "'+address+'"');
} else {
console.log(page.content);
}
phantom.exit();
});
Doing this will result in showing you html content that doesn't have the data loaded, and the <template> tag gets moved before the table (as if it were something like a <div>).
I'm not sure where to start in helping to solve the problem, but I figured I'd report it, since all the modern web browsers (firefox, chrome, safari, opera, edge) handle it correctly.
-Joe