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

Side by Side Diff: third_party/polymer/v1_0/components-chromium/iron-location/iron-location-extracted.js

Issue 2158913007: Roll Polymer from 1.5.0 -> 1.6.0 to pick up native CSS custom props (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 'use strict'; 1 'use strict';
2 2
3 Polymer({ 3 Polymer({
4 is: 'iron-location', 4 is: 'iron-location',
5 properties: { 5 properties: {
6 /** 6 /**
7 * The pathname component of the URL. 7 * The pathname component of the URL.
8 */ 8 */
9 path: { 9 path: {
10 type: String, 10 type: String,
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // If another event handler has stopped this event then there's nothing 172 // If another event handler has stopped this event then there's nothing
173 // for us to do. This can happen e.g. when there are multiple 173 // for us to do. This can happen e.g. when there are multiple
174 // iron-location elements in a page. 174 // iron-location elements in a page.
175 if (event.defaultPrevented) { 175 if (event.defaultPrevented) {
176 return; 176 return;
177 } 177 }
178 var href = this._getSameOriginLinkHref(event); 178 var href = this._getSameOriginLinkHref(event);
179 if (!href) { 179 if (!href) {
180 return; 180 return;
181 } 181 }
182 event.preventDefault();
183 // If the navigation is to the current page we shouldn't add a history
184 // entry or fire a change event.
185 if (href === window.location.href) {
186 return;
187 }
182 window.history.pushState({}, '', href); 188 window.history.pushState({}, '', href);
183 this.fire('location-changed', {}, {node: window}); 189 this.fire('location-changed', {}, {node: window});
184 event.preventDefault();
185 }, 190 },
186 /** 191 /**
187 * Returns the absolute URL of the link (if any) that this click event 192 * Returns the absolute URL of the link (if any) that this click event
188 * is clicking on, if we can and should override the resulting full 193 * is clicking on, if we can and should override the resulting full
189 * page navigation. Returns null otherwise. 194 * page navigation. Returns null otherwise.
190 * 195 *
191 * @param {MouseEvent} event . 196 * @param {MouseEvent} event .
192 * @return {string?} . 197 * @return {string?} .
193 */ 198 */
194 _getSameOriginLinkHref: function(event) { 199 _getSameOriginLinkHref: function(event) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 var normalizedHref = url.pathname + url.search + url.hash; 262 var normalizedHref = url.pathname + url.search + url.hash;
258 263
259 // If we've been configured not to handle this url... don't handle it! 264 // If we've been configured not to handle this url... don't handle it!
260 if (this._urlSpaceRegExp && 265 if (this._urlSpaceRegExp &&
261 !this._urlSpaceRegExp.test(normalizedHref)) { 266 !this._urlSpaceRegExp.test(normalizedHref)) {
262 return null; 267 return null;
263 } 268 }
264 // Need to use a full URL in case the containing page has a base URI. 269 // Need to use a full URL in case the containing page has a base URI.
265 var fullNormalizedHref = new URL( 270 var fullNormalizedHref = new URL(
266 normalizedHref, window.location.href).href; 271 normalizedHref, window.location.href).href;
267 // If the navigation is to the current page we shouldn't add a history
268 // entry.
269 if (fullNormalizedHref === window.location.href) {
270 return null;
271 }
272 return fullNormalizedHref; 272 return fullNormalizedHref;
273 }, 273 },
274 _makeRegExp: function(urlSpaceRegex) { 274 _makeRegExp: function(urlSpaceRegex) {
275 return RegExp(urlSpaceRegex); 275 return RegExp(urlSpaceRegex);
276 } 276 }
277 }); 277 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698