This feels like really nice sugar, but maybe the first step should be to get the shim out that gets it working using JS now.... and then see how it works in practice. I totally understand why this looks exciting, but I have the same uneasiness as Jonas. It feels like a LOT of magic to go grab a page and grab out the id and ..... and I am sure there are edges. Cool idea for sure! It also feels like this should work nicely with the history/state work that already exists.<br>
<br><div class="gmail_quote">On Sat, Oct 17, 2009 at 9:57 AM, Markus Ernst <span dir="ltr"><<a href="mailto:derernst@gmx.ch">derernst@gmx.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Tab Atkins Jr. schrieb:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On Sat, Oct 17, 2009 at 12:22 AM, Jonas Sicking <jonas@sicking.cc> wrote:<br>
</div><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Also, what should happen if the user presses the 'back' button?<br>
</blockquote>
<br>
If the browser can remember what the page state was previously, just<br>
swap in the old parts. If not, but it at least remembers what parts<br>
were replaced, make a fresh request for the previous page and<br>
substitute in just those bits. If it can't remember anything, just do<br>
an ordinary navigation with a full page swap.<br>
<br>
It should act as exactly like current Back behavior as possible.<br>
We're not really playing with the semantics of navigation, so that<br>
shouldn't be difficult.<br>
</div></blockquote>
<br>
I agree to that. I click a link on a page with an URI, and after clicking I get a new page with another URI - so if I hit the back button, I expect getting back the page I had seen before clicking the link. (Of course with the browser-specific peculiarities - Firefox e.g. remembers the scroll position, others may not...) The user experience when using the back button should not differ whether a browser supports @onlyreplace or not.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On Sat, Oct 17, 2009 at 3:53 AM, Gregory Maxwell <<a href="mailto:gmaxwell@gmail.com" target="_blank">gmaxwell@gmail.com</a>> wrote:<br>
</div><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm guessing that the rare case where you need to write into a<br>
replaced ID you can simply have a JS hook that fires on the load and<br>
fixes up the replaced sections as needed.<br>
</blockquote>
<br>
The functioning of load events here confuses me a bit, because I've<br>
never done any hacking in that area and so don't understand the<br>
mechanics well enough to know what's reasonable. Should the new page<br>
still fire a load event once its replaceable content has loaded? I'm<br>
guessing that the old page never fires an unload event? I really<br>
don't know what should happen in this area.<br>
<br>
(After giving it a little thought, though, I think we shouldn't change<br>
the semantics of load/unload/etc. These are still useful, after all,<br>
for when the page *is* completely unloaded or loaded, such as on first<br>
visit or when the user hits Refresh. We'd probably want a new set of<br>
events that fire at the elements being swapped out, and then at the<br>
new elements once they've been pushed in.)<br>
</div></blockquote>
<br>
I admit I don't fully understand load events either. If I get it correctly, this is about functions called on load, that access elements in the replaceable parts of the page. A common use case for this is setting the focus on the first input element of a form. I don't think that this can be solved at the UA side, some authoring will be necessary; some possible workarounds are:<br>
- Put page-specific scripts into a separate <script> element with an id, and include it in the @onlyreplace list;<br>
- make one script that fits for all pages, by checking if an element exists before doing actions on it;<br>
- instead of using <body onLoad="foo()">, put the function call into a <script> element at the bottom of the replaceable element.<br>
<br>
Anyway such things would be much easier (with or without @onlyreplace) if the onLoad event handler would be allowed on every HTML element rather than on window and body only:<br>
<input type="text" name="Name" onLoad="this.focus()"><br>
<br>
But this looks that trivial to me - element.onLoad must have been suggested long ago and been declined for good reasons, I assume?<br>
</blockquote></div><br>