Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1430)

Unified Diff: bower_components/app-router/app-router.js

Issue 786953007: npm_modules: Fork bower_components into Polymer 0.4.0 and 0.5.0 versions (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bower_components/app-router/app-router.html ('k') | bower_components/app-router/app-router.csp.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bower_components/app-router/app-router.js
diff --git a/bower_components/app-router/app-router.js b/bower_components/app-router/app-router.js
deleted file mode 100644
index 2a1f4138f37ed531350773a732230fbe6d7ecd45..0000000000000000000000000000000000000000
--- a/bower_components/app-router/app-router.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(t,e){function i(t,i,r){var n=e.createEvent("CustomEvent");return n.initCustomEvent(t,!1,!0,i),r.dispatchEvent(n)}e.registerElement("app-route",{prototype:Object.create(HTMLElement.prototype)}),e.registerElement("active-route",{prototype:Object.create(HTMLElement.prototype)});var r=Object.create(HTMLElement.prototype),n={},a="ActiveXObject"in t;r.attachedCallback=function(){"manual"!==this.getAttribute("init")&&this.init()},r.init=function(){this.isInitialized||(this.isInitialized=!0,this.activeRoute=e.createElement("app-route"),this.stateChangeHandler=this.go.bind(this),t.addEventListener("popstate",this.stateChangeHandler,!1),a&&t.addEventListener("hashchange",this.stateChangeHandler,!1),this.activeRouteContent=e.createElement("active-route"),this.appendChild(this.activeRouteContent),this.hasAttribute("shadow")&&(this.activeRouteContent=this.activeRouteContent.createShadowRoot()),this.go())},r.detachedCallback=function(){t.removeEventListener("popstate",this.stateChangeHandler,!1),a&&t.removeEventListener("hashchange",this.stateChangeHandler,!1)},r.go=function(){var e=this.parseUrlPath(t.location.href),r={path:e};if(i("state-change",r,this)){for(var n=this.querySelectorAll("app-route"),a=0;a<n.length;a++)if(this.testRoute(n[a].getAttribute("path"),e,this.getAttribute("trailingSlash"),n[a].hasAttribute("regex")))return void this.activateRoute(n[a],e);i("not-found",r,this)}},r.activateRoute=function(t,e){var r={path:e,route:t,oldRoute:this.activeRoute};if(i("activate-route-start",r,this)&&i("activate-route-start",r,t)){this.activeRoute.removeAttribute("active"),t.setAttribute("active","active"),this.activeRoute=t;var n=t.getAttribute("import"),a=t.getAttribute("path"),s=t.hasAttribute("regex"),o=t.getAttribute("element"),c=t.hasAttribute("template"),l=!c;l&&n?this.importAndActivateCustomElement(n,o,a,e,s,r):l&&!n&&o?this.activateCustomElement(o,a,e,s,r):c&&n?this.importAndActivateTemplate(n,t,r):c&&!n&&this.activateTemplate(t,r)}},r.importAndActivateCustomElement=function(t,i,r,a,s,o){if(!n.hasOwnProperty(t)){n[t]=!0;var c=e.createElement("link");c.setAttribute("rel","import"),c.setAttribute("href",t),e.head.appendChild(c)}this.activateCustomElement(i||t.split("/").slice(-1)[0].replace(".html",""),r,a,s,o)},r.activateCustomElement=function(i,r,n,a,s){var o=e.createElement(i),c=this.routeArguments(r,n,t.location.href,a);for(var l in c)c.hasOwnProperty(l)&&(o[l]=c[l]);this.activeElement(o,s)},r.importAndActivateTemplate=function(t,i,r){if(n.hasOwnProperty(t)){var a=e.querySelector('link[href="'+t+'"]');a.import?this.activeElement(e.importNode(a.import.querySelector("template").content,!0),r):a.onload=function(){i.hasAttribute("active")&&this.activeElement(e.importNode(a.import.querySelector("template").content,!0),r)}.bind(this)}else{n[t]=!0;var s=e.createElement("link");s.setAttribute("rel","import"),s.setAttribute("href",t),s.onload=function(){i.hasAttribute("active")&&this.activeElement(e.importNode(s.import.querySelector("template").content,!0),r)}.bind(this),e.head.appendChild(s)}},r.activateTemplate=function(t,i){var r=e.importNode(t.querySelector("template").content,!0);this.activeElement(r,i)},r.activeElement=function(t,e){for(;this.activeRouteContent.firstChild;)this.activeRouteContent.removeChild(this.activeRouteContent.firstChild);this.activeRouteContent.appendChild(t),i("activate-route-end",e,this),i("activate-route-end",e,e.route)},r.parseUrlPath=function(t){var e=t.split("/"),i="/"+e.splice(3,e.length-3).join("/"),r=i.split(/[\?#]/)[0],n=i.indexOf("#");if(-1!==n){var a=i.substring(n).split("?")[0];"#/"===a.substring(0,2)?r=a.substring(1):"#!/"===a.substring(0,3)&&(r=a.substring(2))}return r},r.testRoute=function(t,e,i,r){if("ignore"===i&&("/"===e.slice(-1)&&(e=e.slice(0,-1)),"/"!==t.slice(-1)||r||(t=t.slice(0,-1))),r){if("/"!==t.charAt(0))return!1;t=t.slice(1);var n="";if("/"===t.slice(-1))t=t.slice(0,-1);else{if("/i"!==t.slice(-2))return!1;t=t.slice(0,-2),n="i"}return new RegExp(t,n).test(e)}if(t===e||"*"===t)return!0;if(-1===t.indexOf("*")&&-1===t.indexOf(":"))return!1;var a=e.split("/"),s=t.split("/");if(a.length!==s.length)return!1;for(var o=0;o<s.length;o++){var c=s[o];if(c!==a[o]&&"*"!==c&&":"!==c.charAt(0))return!1}return!0},r.routeArguments=function(t,e,i,r){var n={},a=e.split("/");if(!r)for(var s=t.split("/"),o=0;o<s.length;o++){var c=s[o];":"===c.charAt(0)&&(n[c.substring(1)]=a[o])}var l=i.indexOf("?"),h="";if(-1!==l){h=i.substring(l);var u=h.indexOf("#");-1!==u&&(h=h.substring(0,u))}var v=i.indexOf("#/"),p=i.indexOf("#!/");if(-1!==v||-1!==p){var m="";m=i.substring(-1!==v?v:p),l=m.indexOf("?"),-1!==l&&(h=m.substring(l))}var d=h.substring(1).split("&");1===d.length&&""===d[0]&&(d=[]);for(var f=0;f<d.length;f++){var g=d[f],b=g.split("=");n[b[0]]=b.splice(1,b.length-1).join("=")}for(var A in n){var E=n[A];n[A]="true"===E?!0:"false"===E?!1:isNaN(E)||""===E?decodeURIComponent(E):+E}return n},e.registerElement("app-router",{prototype:r})}(window,document);
« no previous file with comments | « bower_components/app-router/app-router.html ('k') | bower_components/app-router/app-router.csp.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698