Skip to content

Instantly share code, notes, and snippets.

@Michael-F-Ellis
Created September 11, 2016 17:57
Show Gist options
  • Save Michael-F-Ellis/aecdf25694b9b2c3577240fb09f19274 to your computer and use it in GitHub Desktop.
Save Michael-F-Ellis/aecdf25694b9b2c3577240fb09f19274 to your computer and use it in GitHub Desktop.
pure.js:84 Uncaught pure error: cannot have more than one loop on a target
<!DOCTYPE html>
<html>
<head>
<title>PURE Test</title>
<script src="http://pure.github.io/pure/libs/pure.js"></script>
</head>
<body>
<!-- HTML template -->
<div data-role="page">
<div data-role="header"></div>
<div data-role="content">
<h2></h2>
<div class="ui-grid-a">
<div class="block">
<div class="ui-bar ui-bar-a" style="height: 100%;">
<form class="pgc-parms">
<div class='ui-field-contain'>
<label></label>
<input class="number pgc-parm"/>
</div>
</form>
</div>
</div>
</div>
</div>
<div data-role="footer"></div>
</div>
<script>
<!DOCTYPE html>
<html>
<head>
<title>PURE Test</title>
<script src="http://pure.github.io/pure/libs/pure.js"></script>
</head>
<body>
<!-- HTML template -->
<div data-role="page">
<div data-role="header"></div>
<div data-role="content">
<h2></h2>
<div class="ui-grid-a">
<div class="block">
<div class="ui-bar ui-bar-a" style="height: 100%;">
<form class="pgc-parms">
<div class='ui-field-contain'>
<label></label>
<input class="number pgc-parm"/>
</div>
</form>
</div>
</div>
</div>
</div>
<div data-role="footer"></div>
</div>
<script>
// Generated by CoffeeScript 1.10.0
var pagedata, pagedirective;
pagedata = {
/*
Pages have one or more blocks of readouts and setpoints
arranged side-by-side beneath the page title. From left to
right we suffix the block classes with "a b c ..." to match
the jQuery Mobile grid layout syntax.
*/
pages: [
{
id: 'ah-cal',
title: 'Air-Humidity Calibration',
blocks: [
{
'id': 'air-cal',
letter: 'a'
}, {
'id': 'water-cal',
letter: 'b'
}
]
}, {
id: 'wx-cal',
title: 'Water-Aux Calibration'
}, {
blocks: [
{
'id': 'water-cal',
letter: 'a'
}, {
'id': 'aux-cal',
letter: 'b'
}
]
}
]
};
pagedirective = {
/*
Expands page template. Applies ids and titles.
Expands blocks in each page applying id's and class.
*/
"div[data-role='page']": {
'page<-pages': {
'@id': 'page.id',
"div[data-role='content'] > h2": 'page.title',
'blk<-page.blocks': {
'div.block@id': 'blk.id',
'div.block@class': 'ui-block-' + 'blk.letter'
}
}
}
};
$p('body').render(pagedata, pagedirective);
</script>
</body>
</html>
</script>
</body>
</html>
@ssafras
Copy link

ssafras commented May 20, 2017

Hello!

I had the same problem with you. I guess you should have a look at this:
https://groups.google.com/d/msg/pure-unobtrusive-rendering-engine/omg5yjvGn5g/nlFKKV3TAwAJ

Briefly, the problem is at line 112.

(Copy-pasting from url)
The syntax of the loop should be:

  • first the DOM target to be iterated
  • then the loop property names ( <- )
  • and finally the inside of the block

You seem to have missed the first bullet :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment