| Index: third_party/polymer/v1_0/components/more-routing/driver.html
|
| diff --git a/third_party/polymer/v1_0/components/more-routing/driver.html b/third_party/polymer/v1_0/components/more-routing/driver.html
|
| deleted file mode 100644
|
| index 031c87d16b3677a29fe657364318ea77d74cb8e9..0000000000000000000000000000000000000000
|
| --- a/third_party/polymer/v1_0/components/more-routing/driver.html
|
| +++ /dev/null
|
| @@ -1,113 +0,0 @@
|
| -<!--
|
| -Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
| -This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
| -The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
| -The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
| -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
|
| --->
|
| -<script>
|
| -(function(scope) {
|
| -var MoreRouting = scope.MoreRouting = scope.MoreRouting || {};
|
| -MoreRouting.Driver = Driver;
|
| -
|
| -/**
|
| - * TODO(nevir): Docs.
|
| - */
|
| -function Driver(opt_config) {
|
| - var config = opt_config || {};
|
| - if (config.prefix) this.prefix = config.prefix;
|
| -
|
| - this._activeRoutes = [];
|
| -
|
| - this._rootRoutes = [];
|
| -}
|
| -
|
| -Driver.prototype.manageRoute = function manageRoute(route) {
|
| - route.driver = this;
|
| - this._appendRoute(route);
|
| -
|
| - if (route.parent) {
|
| - if (route.parent.active) {
|
| - // Remember: `processPathParts` takes just the path parts relative to that
|
| - // route; not the full set.
|
| - route.processPathParts(this.currentPathParts.slice(route.parent.depth));
|
| - }
|
| - } else {
|
| - route.processPathParts(this.currentPathParts);
|
| - }
|
| -
|
| - if (route.active) this._activeRoutes.push(route);
|
| -};
|
| -
|
| -Driver.prototype.urlForParts = function urlForParts(parts) {
|
| - return this.prefix + parts.join(this.separator);
|
| -};
|
| -
|
| -Driver.prototype.navigateToParts = function(parts) {
|
| - return this.navigateToUrl(this.urlForParts(parts));
|
| -};
|
| -
|
| -Driver.prototype.navigateToUrl = function navigateToUrl(url) {
|
| - throw new Error(this.constructor.name + '#navigateToUrl not implemented');
|
| -};
|
| -
|
| -// Subclass Interface
|
| -
|
| -Driver.prototype.prefix = '/';
|
| -Driver.prototype.separator = '/';
|
| -
|
| -Driver.prototype.setCurrentPath = function setCurrentPath(path) {
|
| - this.currentPathParts = this.splitPath(path);
|
| - var newRoutes = this._matchingRoutes(this.currentPathParts);
|
| -
|
| - // active -> inactive.
|
| - for (var i = 0, route; route = this._activeRoutes[i]; i++) {
|
| - if (newRoutes.indexOf(route) === -1) {
|
| - route.processPathParts(null);
|
| - }
|
| - }
|
| -
|
| - this._activeRoutes = newRoutes;
|
| -}
|
| -
|
| -Driver.prototype.splitPath = function splitPath(rawPath) {
|
| - if (this.prefix && rawPath.indexOf(this.prefix) !== 0) {
|
| - throw new Error(
|
| - 'Invalid path "' + rawPath + '"; ' +
|
| - 'expected it to be prefixed by "' + this.prefix + '"');
|
| - }
|
| - var path = rawPath.substr(this.prefix.length);
|
| - var parts = path.split(this.separator);
|
| - // Ignore trailing separators.
|
| - if (!parts[parts.length - 1]) parts.pop();
|
| -
|
| - return parts;
|
| -};
|
| -
|
| -// Internal Implementation
|
| -Driver.prototype._appendRoute = function _appendRoute(route) {
|
| - if (route.parent) {
|
| - // We only care about root routes.
|
| - return;
|
| - }
|
| - this._rootRoutes.push(route);
|
| -};
|
| -
|
| -Driver.prototype._matchingRoutes = function _matchingRoutes(parts, rootRoutes) {
|
| - var routes = [];
|
| - var candidates = rootRoutes || this._rootRoutes;
|
| - var route;
|
| - for (var i = 0; i < candidates.length; i++) {
|
| - route = candidates[i];
|
| - route.processPathParts(parts);
|
| - if (route.active) {
|
| - routes.push(route);
|
| - routes = routes.concat(this._matchingRoutes(parts.slice(route.compiled.length), route.children));
|
| - }
|
| - }
|
| - return routes;
|
| -}
|
| -
|
| -})(window);
|
| -</script>
|
|
|