Skip to content

Commit

Permalink
Replace _fixPath.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaste committed Jul 23, 2016
1 parent b02eda0 commit 6d1dd88
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/lib/bind/accessors.html
Expand Up @@ -7,6 +7,7 @@
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../path.html">
<script>

Polymer.Bind = {
Expand Down Expand Up @@ -217,7 +218,8 @@
_notedListenerFactory: function(property, path, isStructured, negated) {
return function(target, value, targetPath) {
if (targetPath) {
this._notifyPath(this._fixPath(path, property, targetPath), value);
var newPath = Polymer.Path.translate(property, path, targetPath);
this._notifyPath(newPath, value);
} else {
// TODO(sorvell): even though we have a `value` argument, we *must*
// lookup the current value of the property. Multiple listeners and
Expand Down
12 changes: 4 additions & 8 deletions src/standard/notify-path.html
Expand Up @@ -299,8 +299,8 @@
// locate the bound node
var node = this._nodes[effect.index];
if (node && node._notifyPath) {
var p = this._fixPath(effect.name , effect.value, path);
node._notifyPath(p, value, true);
var newPath = Path.translate(effect.value, effect.name, path);
node._notifyPath(newPath, value, true);
}
}
},
Expand Down Expand Up @@ -361,17 +361,13 @@
for (var a in this._boundPaths) {
var b = this._boundPaths[a];
if (path.indexOf(a + '.') == 0) {
this._notifyPath(this._fixPath(b, a, path), value);
this._notifyPath(Path.translate(a, b, path), value);
} else if (path.indexOf(b + '.') == 0) {
this._notifyPath(this._fixPath(a, b, path), value);
this._notifyPath(Path.translate(b, a, path), value);
}
}
},

_fixPath: function(property, root, path) {
return property + path.slice(root.length);
},

_notifyPathUp: function(path, value) {
var rootName = Path.head(path);
var dashCaseName = Polymer.CaseMap.camelToDashCase(rootName);
Expand Down

0 comments on commit 6d1dd88

Please sign in to comment.