Skip to content

Commit 4caf248

Browse files
committed
Update Bower dependencies and fix issues with the update.
1 parent f1e5641 commit 4caf248

File tree

24 files changed

+199
-92
lines changed

24 files changed

+199
-92
lines changed

DOMTreeBindingTarget.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ define([
8383
}
8484
var condition = this.object.bindings[ATTRIBUTE_IF];
8585
if (this.model && (!condition || condition.value)) {
86-
this.instanceData = this.getTemplate().instantiate(this.model);
87-
this.object.parentNode.insertBefore(this.instanceData.content, this.object.nextSibling);
86+
this.instanceData = this.getTemplate().instantiate(this.model).insertBefore(this.object.parentNode, this.object.nextSibling);
8887
}
8988
}
9089
return function (value) {
@@ -174,12 +173,10 @@ define([
174173
}
175174
}
176175
for (var iAddition = 0; iAddition < splices[i].addedCount; ++iAddition) {
177-
var instanceData = this.template.instantiate(this.model[spliceIndex + iAddition]);
178-
this.object.parentNode.insertBefore(instanceData.content, referenceNode);
179176
this.instanceDataList.splice(
180177
spliceIndex + iAddition,
181178
0,
182-
instanceData);
179+
this.template.instantiate(this.model[spliceIndex + iAddition]).insertBefore(this.object.parentNode, referenceNode));
183180
}
184181
}
185182
}
@@ -502,7 +499,8 @@ define([
502499
var instanceData = {
503500
model: model,
504501
content: content,
505-
childNodes: EMPTY_ARRAY.slice.call(content.childNodes)
502+
childNodes: EMPTY_ARRAY.slice.call(content.childNodes),
503+
insertBefore: templateBinder.insertBefore
506504
},
507505
applied = computed.apply(model);
508506

bower.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"version": "0.1.6",
44
"dependencies": {
55
"requirejs": "2.1.x",
6-
"requirejs-dplugins": "0.5.x",
7-
"decor": "c9429f0b1b0f092f774f96c40153d3bcefb79e60",
8-
"dcl": "1.1.2"
6+
"requirejs-dplugins": "0.6.x",
7+
"decor": "0.7.x",
8+
"dcl": "1.1.x"
99
},
1010
"ignore": [
1111
".jshintrc",

delite/bower.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33
"version": "0.1.0-dev",
44
"dependencies": {
55
"requirejs": "2.1.x",
6-
"requirejs-dplugins": "0.5.x",
7-
"decor": "c9429f0b1b0f092f774f96c40153d3bcefb79e60",
8-
"delite": "0.7.x"
9-
},
10-
"resolutions": {
11-
"decor": "c9429f0b1b0f092f774f96c40153d3bcefb79e60"
6+
"requirejs-dplugins": "0.6.x",
7+
"decor": "0.7.x",
8+
"delite": "0.8.x"
129
}
1310
}

delite/createRenderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ define([
5454
if (this.instanceData) {
5555
template._instanceData = this.instanceData;
5656
}
57-
this.appendChild(this.own(template.instantiate(this))[0].content);
57+
this.own(template.instantiate(this).insertBefore(this))[0].content;
5858
forEach.call(this.querySelectorAll("[data-attach-point]"), function (elem) {
5959
var value = elem.getAttribute("data-attach-point");
6060
if (value) {

delite/templateBinderExtension.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ define([
1616

1717
var slice = [].slice;
1818

19+
// Cope with the case where delite widget does not run `attachedCallback()`
20+
// Refs:
21+
// https://github.com/ibm-js/delite/blame/0.8.2/docs/architecture.md#L76
22+
// https://github.com/ibm-js/delite/blob/0.8.2/Container.js#L102-L108
23+
function attached(node) {
24+
if (node.ownerDocument.documentElement.contains(node) && typeof node.attachedCallback === "function" && !node.attached) {
25+
node.attachedCallback();
26+
}
27+
for (var child = node.firstChild; child; child = child.nextSibling) {
28+
attached(child);
29+
}
30+
}
31+
1932
// If document.register() is there, upgradable elements will be upgraded automatically.
2033
// "document-register" has() flag is tested in delite/register.
2134
if (!has("document-register") && typeof Node !== "undefined") {
@@ -30,6 +43,15 @@ define([
3043
}
3144
return imported;
3245
};
46+
47+
var origInsertBefore = templateBinder.insertBefore;
48+
templateBinder.insertBefore = function () {
49+
var result = origInsertBefore.apply(this, arguments);
50+
for (var i = 0, l = this.childNodes.length; i < l; ++i) {
51+
attached(this.childNodes[i]);
52+
}
53+
return result;
54+
};
3355
}
3456

3557
function remove(origRemove) {

delite/widgets/RadioButton.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ define([
2020
var RadioButton = dcl(Widget, /** @lends module:liaison/delite/widgets/RadioButton# */ {
2121
baseClass: "d-l-radiobutton",
2222

23+
/**
24+
* List of properties whose data binding should be handled by this widget
25+
* but don't want to define property here.
26+
* @type {Object}
27+
*/
28+
owns: {
29+
checked: true,
30+
value: true
31+
},
32+
2333
/**
2434
* The current value of the radio group of this radio button.
2535
* @type {string}

polymer/bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.1.0-dev",
44
"dependencies": {
55
"requirejs": "2.1.x",
6-
"requirejs-dplugins": "0.5.x",
6+
"requirejs-dplugins": "0.6.x",
77
"polymer": "0.2.1"
88
}
99
}

samples/bower.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"version": "0.1.0-dev",
44
"dependencies": {
55
"requirejs": "2.1.x",
6-
"requirejs-dplugins": "0.5.x",
7-
"decor": "c9429f0b1b0f092f774f96c40153d3bcefb79e60",
8-
"dojo": "~1.10.0",
9-
"dojox": "~1.10.0",
10-
"dcl": "1.1.2"
6+
"requirejs-dplugins": "0.6.x",
7+
"decor": "0.7.x",
8+
"dojo": "~1.11.0",
9+
"dojox": "~1.11.0",
10+
"dcl": "1.1.x"
1111
}
1212
}

samples/delite-polymer/bower.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@
33
"version": "0.1.0-dev",
44
"dependencies": {
55
"requirejs": "2.1.x",
6-
"requirejs-dplugins": "0.5.x",
7-
"decor": "c9429f0b1b0f092f774f96c40153d3bcefb79e60",
8-
"dojo": "~1.10.0",
9-
"dojox": "~1.10.0",
10-
"delite": "0.7.x",
11-
"deliteful": "0.7.x",
6+
"requirejs-dplugins": "0.6.x",
7+
"decor": "0.7.x",
8+
"dojo": "~1.11.0",
9+
"dojox": "~1.11.0",
10+
"delite": "0.8.x",
11+
"deliteful": "0.8.x",
1212
"platform": "Polymer/platform#0.2.1"
13-
},
14-
"resolutions": {
15-
"decor": "c9429f0b1b0f092f774f96c40153d3bcefb79e60"
1613
}
1714
}

samples/delite-polymer/loan.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}
1212
</style>
1313
<script type="text/javascript" src="../../../platform/platform.js"></script>
14-
<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="async: 1"></script>
14+
<script type="text/javascript" src="../../../requirejs/require.js" data-main="../../../"></script>
1515
<script id="loan-template" type="text/x-template">
1616
<div>
1717
<h2>Borrower information</h2>
@@ -30,7 +30,15 @@ <h2>Analysis</h2>
3030
</div>
3131
</script>
3232
<script type="text/javascript">
33-
require([
33+
require({
34+
packages: [
35+
{
36+
name: "dojox",
37+
location: "dojox",
38+
main: "main"
39+
}
40+
]
41+
}, [
3442
"delite/register",
3543
"liaison/ObservablePath",
3644
"liaison/BindingSourceList",

0 commit comments

Comments
 (0)