Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Implements ajax load using HTM imports - DO NOT MERGE #92

Closed
wants to merge 2 commits into from

Conversation

ebidel
Copy link
Contributor

@ebidel ebidel commented Jan 6, 2015

R: @jeffposnick @devnook @brendankenny

Each page defines an HTML import file that contains <templates> for parts of the page it wants to replace. That content is injected using a <template ref>. The benefit of this approach is that bindings in the injected content get picked up by the page's auto-binding template.

The page can also define a bit of metadata for other parts of the page that need updating (example).

Essentially, we've just invented a web components-based client-side solution for templating :)

Looking for feedback on this idea. Please fetch this branch and give it a go.

for (var i = 0; i < e.path.length; ++i) {
var el = e.path[i];
if (el.localName == 'a') {
if (!el.getAttribute('href').match(/^(https?:|javascript:|\/\/)/) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to require that the link in HTML opts out to be ajaxified in an explicit way, rather than by matching discreet criteria on href, origin and target. This avoids introducing in future links that should not be ajaxified but are by mistake. E.g. I wanted to explicitly add data-ajax-link attribute to links I intend to be ajaxified in HTML.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. Ripped this straight from pp.org. Ajax should be handled with the URL changes (and you're still on the site). Everything should move off that.

@ebidel ebidel changed the title Implements ajax load using HTM imports Implements ajax load using HTM imports - DO NOT MERGE Jan 6, 2015
@ebidel
Copy link
Contributor Author

ebidel commented Jan 6, 2015

Closing in favor of #94

@ebidel ebidel closed this Jan 6, 2015
@ebidel ebidel deleted the useimports branch February 12, 2015 04:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants