lib/assets/javascripts/unpoly/flow.js.coffee in unpoly-rails-0.28.1 vs lib/assets/javascripts/unpoly/flow.js.coffee in unpoly-rails-0.29.0
- old
+ new
@@ -78,11 +78,11 @@
The current and new elements must both match the given CSS selector.
The UJS variant of this is the [`a[up-target]`](/a-up-target) selector.
- \#\#\#\# Example
+ \#\#\# Example
Let's say your curent HTML looks like this:
<div class="one">old one</div>
<div class="two">old two</div>
@@ -103,11 +103,11 @@
<div class="two">new two</div>
Note how only `.two` has changed. The update for `.one` was
discarded, since it didn't match the selector.
- \#\#\#\# Appending or prepending instead of replacing
+ \#\#\# Appending or prepending instead of replacing
By default Unpoly will replace the given selector with the same
selector from a freshly fetched page. Instead of replacing you
can *append* the loaded content to the existing content by using the
`:after` pseudo selector. In the same fashion, you can use `:before`
@@ -124,28 +124,28 @@
In order to append more items from a URL, replace into
the `.tasks:after` selector:
up.replace('.tasks:after', '/page/2')
- \#\#\#\# Setting the window title from the server
+ \#\#\# Setting the window title from the server
If the `replace` call changes history, the document title will be set
to the contents of a `<title>` tag in the response.
The server can also change the document title by setting
an `X-Up-Title` header in the response.
- \#\#\#\# Optimizing response rendering
+ \#\#\# Optimizing response rendering
The server is free to optimize Unpoly requests by only rendering the HTML fragment
that is being updated. The request's `X-Up-Target` header will contain
the CSS selector for the updating fragment.
If you are using the `unpoly-rails` gem you can also access the selector via
`up.target` in all controllers, views and helpers.
- \#\#\#\# Events
+ \#\#\# Events
Unpoly will emit [`up:fragment:destroyed`](/up:fragment:destroyed) on the element
that was replaced and [`up:fragment:inserted`](/up:fragment:inserted) on the new
element that replaces it.
@@ -298,11 +298,11 @@
###*
Updates a selector on the current page with the
same selector from the given HTML string.
- \#\#\#\# Example
+ \#\#\# Example
Let's say your curent HTML looks like this:
<div class="one">old one</div>
<div class="two">old two</div>
@@ -537,11 +537,11 @@
The element you're keeping should have an umambiguous class name, ID or `up-id`
attribute so Unpoly can find its new position within the page update.
Emits events [`up:fragment:keep`](/up:fragment:keep) and [`up:fragment:kept`](/up:fragment:kept).
- \#\#\#\# Controlling if an element will be kept
+ \#\#\# Controlling if an element will be kept
Unpoly will **only** keep an existing element if:
- The existing element has an `up-keep` attribute
- The response contains an element matching the CSS selector of the existing element
@@ -676,11 +676,11 @@
###*
When a page fragment has been [inserted or updated](/up.replace),
this event is [emitted](/up.emit) on the fragment.
- \#\#\#\# Example
+ \#\#\# Example
up.on('up:fragment:inserted', function(event, $fragment) {
console.log("Looks like we have a new %o!", $fragment);
});
@@ -864,10 +864,10 @@
###
###*
Replaces the given element with a fresh copy fetched from the server.
- \#\#\#\# Example
+ \#\#\# Example
up.on('new-mail', function() {
up.reload('.inbox');
});