Skip to content

Commit

Permalink
Merge pull request #21 from PolymerElements/page-url-to-location
Browse files Browse the repository at this point in the history
Page url to location
  • Loading branch information
cdata committed Mar 23, 2016
2 parents 2ab0371 + cfb2c90 commit 386f637
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 77 deletions.
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!---
This README is automatically generated from the comments in these files:
iron-page-url.html
iron-location.html
Edit those files, and our readme bot will duplicate them over here!
Edit this file, and the bot will squash your changes :)
Expand All @@ -12,45 +12,43 @@ thing! https://github.com/PolymerLabs/tedium/issues
-->

[![Build status](https://travis-ci.org/PolymerElements/iron-page-url.svg?branch=master)](https://travis-ci.org/PolymerElements/iron-page-url)
[![Build status](https://travis-ci.org/PolymerElements/iron-location.svg?branch=master)](https://travis-ci.org/PolymerElements/iron-location)

_[Demo and API docs](https://elements.polymer-project.org/elements/iron-page-url)_
_[Demo and API docs](https://elements.polymer-project.org/elements/iron-location)_


##&lt;iron-page-url&gt;
##&lt;iron-location&gt;

The `iron-page-url` element manages binding to and from the current URL.
The `iron-location` element manages binding to and from the current URL.

iron-page-url is the first, and lowest level element in the Polymer team's
routing system. This is a beta release of iron-page-url as we continue work
on higher level elements, and as such iron-page-url may undergo breaking
iron-location is the first, and lowest level element in the Polymer team's
routing system. This is a beta release of iron-location as we continue work
on higher level elements, and as such iron-location may undergo breaking
changes.

#### Properties

When the URL is: `/search?query=583#details` iron-page-url's properties will be:
When the URL is: `/search?query=583#details` iron-location's properties will be:

* path: `'/search'`
* query: `'query=583'`
* hash: `'details'`

These bindings are bidirectional. Modifying them will in turn modify the URL.

iron-page-url is only active while it is attached to the document.
iron-location is only active while it is attached to the document.

#### Links

While iron-page-url is active in the document it will intercept clicks on links
While iron-location is active in the document it will intercept clicks on links
within your site, updating the URL pushing the updated URL out through the
databinding system. iron-page-url only intercepts clicks with the intent to
databinding system. iron-location only intercepts clicks with the intent to
open in the same window, so middle mouse clicks and ctrl/cmd clicks work fine.

You can customize this behavior with the `urlSpaceRegex`.

#### Dwell Time

iron-page-url protects against accidental history spamming by only adding
iron-location protects against accidental history spamming by only adding
entries to the user's history if the URL stays unchanged for `dwellTime`
milliseconds.


8 changes: 4 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "iron-page-url",
"name": "iron-location",
"version": "0.7.3",
"description": "Bidirectional data binding into the page's URL.",
"private": true,
Expand All @@ -11,13 +11,13 @@
"polymer",
"routing"
],
"main": "iron-page-url.html",
"main": "iron-location.html",
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/iron-page-url.git"
"url": "git://github.com/PolymerElements/iron-location.git"
},
"license": "http://polymer.github.io/LICENSE.txt",
"homepage": "https://github.com/PolymerElements/iron-page-url",
"homepage": "https://github.com/PolymerElements/iron-location",
"ignore": [],
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0"
Expand Down
18 changes: 9 additions & 9 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<html>
<head>

<title>iron-page-url</title>
<title>iron-location</title>

<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../iron-page-url.html">
<link rel="import" href="../iron-location.html">
<link rel="import" href="../../paper-styles/typography.html">
<link rel="import" href="../../iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../../paper-input/paper-input.html">
Expand All @@ -24,7 +24,7 @@
</head>
<body>

<dom-module id="iron-page-url-demo">
<dom-module id="iron-location-demo">
<template>
<style>
div.inputs {
Expand All @@ -51,9 +51,9 @@
@apply(--layout-horizontal);
}
</style>
<iron-page-url path="{{path}}" hash="{{hash}}" query="{{query}}"
<iron-location path="{{path}}" hash="{{hash}}" query="{{query}}"
dwell-time="{{dwellTime}}">
</iron-page-url>
</iron-location>

<div class="container">
<div class="inputs">
Expand All @@ -68,11 +68,11 @@ <h3>URL</h3>
<div class="history_entries">
<h3>Dwell Time</h3>
<p>
iron-page-url won't add extraneous entries to the browser's history
iron-location won't add extraneous entries to the browser's history
when changes come in quick succession.
</p>
<p>
A new history entry will only be added if iron-page-url stays in
A new history entry will only be added if iron-location stays in
the same state longer than dwellTime.
</p>
<div>
Expand All @@ -92,7 +92,7 @@ <h3>Dwell Time</h3>
<script>
window.addEventListener('WebComponentsReady', function() {
Polymer({
is: 'iron-page-url-demo',
is: 'iron-location-demo',
properties: {
historyElementsAdded: {
type: Number
Expand All @@ -119,6 +119,6 @@ <h3>Dwell Time</h3>
</script>
</dom-module>

<iron-page-url-demo></iron-page-url-demo>
<iron-location-demo></iron-location-demo>
</body>
</html>
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<html>
<head>

<title>iron-page-url</title>
<title>iron-location</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

Expand Down
20 changes: 10 additions & 10 deletions iron-page-url.html → iron-location.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@

<!--
The `iron-page-url` element manages binding to and from the current URL.
The `iron-location` element manages binding to and from the current URL.
iron-page-url is the first, and lowest level element in the Polymer team's
routing system. This is a beta release of iron-page-url as we continue work
on higher level elements, and as such iron-page-url may undergo breaking
iron-location is the first, and lowest level element in the Polymer team's
routing system. This is a beta release of iron-location as we continue work
on higher level elements, and as such iron-location may undergo breaking
changes.
#### Properties
When the URL is: `/search?query=583#details` iron-page-url's properties will be:
When the URL is: `/search?query=583#details` iron-location's properties will be:
- path: `'/search'`
- query: `'query=583'`
- hash: `'details'`
These bindings are bidirectional. Modifying them will in turn modify the URL.
iron-page-url is only active while it is attached to the document.
iron-location is only active while it is attached to the document.
#### Links
While iron-page-url is active in the document it will intercept clicks on links
While iron-location is active in the document it will intercept clicks on links
within your site, updating the URL pushing the updated URL out through the
databinding system. iron-page-url only intercepts clicks with the intent to
databinding system. iron-location only intercepts clicks with the intent to
open in the same window, so middle mouse clicks and ctrl/cmd clicks work fine.
You can customize this behavior with the `urlSpaceRegex`.
#### Dwell Time
iron-page-url protects against accidental history spamming by only adding
iron-location protects against accidental history spamming by only adding
entries to the user's history if the URL stays unchanged for `dwellTime`
milliseconds.
Expand All @@ -53,7 +53,7 @@
'use strict';

Polymer({
is: 'iron-page-url',
is: 'iron-location',
properties: {
/**
* The pathname component of the URL.
Expand Down
2 changes: 1 addition & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<body>
<script>
WCT.loadSuites([
'iron-page-url.html',
'iron-location.html',
'iron-query-params.html',
'initialization-tests.html'
]);
Expand Down
Loading

0 comments on commit 386f637

Please sign in to comment.