Skip to content

Commit

Permalink
Rename Path.head() to Path.root().
Browse files Browse the repository at this point in the history
  • Loading branch information
kaste committed Jul 23, 2016
1 parent 478978d commit 77808d9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/lib/path.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

Polymer.Path = {

head: function(path) {
root: function(path) {
var dotIndex = path.indexOf('.');
if (dotIndex === -1) {
return path;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/template/templatizer.html
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@

_notifyPathUpImpl: function(path, value) {
var dataHost = this.dataHost;
var root = Polymer.Path.head(path);
var root = Polymer.Path.root(path);
// Call extension point for Templatizer sub-classes
dataHost._forwardInstancePath.call(dataHost, this, path, value);
if (root in dataHost._parentProps) {
Expand All @@ -338,7 +338,7 @@
if (this._forwardParentPath) {
if (path.indexOf(this._parentPropPrefix) === 0) {
var subPath = path.substring(this._parentPropPrefix.length);
var model = Polymer.Path.head(subPath);
var model = Polymer.Path.root(subPath);
if (model in this._parentProps) {
this._forwardParentPath(subPath, value);
}
Expand Down
2 changes: 1 addition & 1 deletion src/standard/annotations.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
if (signature) {
p.signature = signature;
} else {
p.model = Polymer.Path.head(p.value);
p.model = Polymer.Path.root(p.value);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/standard/effectBuilder.html
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
}
// if not literal, look for structured path
if (!a.literal) {
a.model = Polymer.Path.head(arg);
a.model = Polymer.Path.root(arg);
// detect structured path (has dots)
a.structured = Polymer.Path.isDeep(arg);
if (a.structured) {
Expand Down
4 changes: 2 additions & 2 deletions src/standard/notify-path.html
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@

_pathEffector: function(path, value) {
// get root property
var model = Path.head(path);
var model = Path.root(path);
// search property effects of the root property for 'annotation' effects
var fx$ = this._propertyEffects && this._propertyEffects[model];
if (fx$) {
Expand Down Expand Up @@ -369,7 +369,7 @@
},

_notifyPathUp: function(path, value) {
var rootName = Path.head(path);
var rootName = Path.root(path);
var dashCaseName = Polymer.CaseMap.camelToDashCase(rootName);
var eventName = dashCaseName + this._EVENT_CHANGED;
// use a cached event here (_useCache: true) for efficiency
Expand Down
6 changes: 3 additions & 3 deletions test/unit/path.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
Path = Polymer.Path;
});

test('head()', function() {
assert.equal(Path.head('foo'), 'foo');
assert.equal(Path.head('foo.bar'), 'foo');
test('root()', function() {
assert.equal(Path.root('foo'), 'foo');
assert.equal(Path.root('foo.bar'), 'foo');
});

test('isDeep()', function() {
Expand Down

0 comments on commit 77808d9

Please sign in to comment.