Coder Social home page Coder Social logo

filamentgroup / ajax-include-pattern Goto Github PK

View Code? Open in Web Editor NEW
627.0 627.0 52.0 415 KB

An Ajax-Include Pattern for Modular Content

Home Page: http://filamentgroup.com/lab/ajax_includes_modular_content/

License: MIT License

JavaScript 89.78% HTML 5.06% PHP 1.19% CSS 3.97%

ajax-include-pattern's People

Contributors

benembery avatar jefflembeck avatar johnbender avatar morgchopz avatar nhoizey avatar patocallaghan avatar scottjehl avatar zachleat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ajax-include-pattern's Issues

Ajax Include with Respond

Hi Scott et al,
Not an issue per say. But a question/request?
I may be missing something here, and if I am being a total newbie slap me with a wet fish and point me towards the nearest "Responsive Web 101" tuts.
I have, as you may have noticed from tweets, been toying with Ajax include and Lazy Loading over the pst couple of days. Having been pointed that way after asking @beep a rather newbie question like "you mean display:none; is a big no no, have I been doing responsive wrong for the past 9 months"

Anyway, to my point.
Lazy loading looks awesome, and will certainly solve a few issues I have been having with large assets, markup bloat and serving Javascript driven content (such as sliders and carousels) to devices that will never see it.
But the way I envisage using it long term means I shall probably be utilising the "data-media" aspect of it to have content pull in based on screen size. I may find I expend on this at a later date by using feature detection to hone the experience, but softly softly catchy monkey. This throws up a problem. Non-media query browsers, IE 8 in particular, will not receive the proper website experience as they will never pull in the content.
I know this is most likely the point, progressively enhance the experience. But I know my boss, and the client will prefer certain desktop aspects be common across all desktop browsers with a significant market share - Helllooooo IE 8.
Now that I have babbled, here is my question. Is there any way to enhance your wonderful creation Respond.js to give a helping hand to AjaxInclude? Maybe combine the two into some mega respond super power?! Or could you suggest an alternative approach?

I don't mind attempting the donkey work if you just point me in the right direction.

Thanks in advance ducks the flying wet fish

Dave

"ajaxInclude" event fires before the DOM has been updated when using data-replace

This makes it difficult to manipulate the new content that has been inserted because it creates a race condition: at the time that the event is fired, the DOM has not yet been updated, so there is no guarantee that the DOM will have been updated by the time that any registered event handlers begin to run. (In my experience, the event handlers always run before the DOM has been updated.)

I forked the repo and starting working on a solution but I cannot think of one that doesn't involve changing the API. trigger can't be called on an element that isn't in the DOM (which I'm assuming is why you forked that part of the code to trigger before updating for replaceWith only), so there doesn't seem to be a way to have data-replace trigger the event on the element itself like the other methods can.

Obviously I'm not exactly offering any answers here but I wanted to at least get a discussion going about this and see if @scottjehl or other curators of the library have an opinion about it.

ajax-include conflates redundant URLs

Given three instances of the following:

data-append="-/ajaxsamples/slides-teases.html"

$("data-append").ajaxInclude() adds the contents of slides-teases.html to each element three times.

This is for a prototype, but it’d be amazing if it was a bit more context-aware.

What about SEO?

I was just thinking about the impact on search engine optimisation as the vast majority of the page content would not be crawlable.

I don't think there will be an answer to this question, I guess it's the tradeoff here, so it's just a thought ..

There must be some way I'm thinking to work WITHIN the newly acquired (but very limited I suppose) javascript crawling abilities of the main search engines (it's fair enough to just care about Google though).

Any thoughts?

Loading Page Fragments

I think it might be possible to insert a portion of the target page:

<a data-replace="articles.php#related">Link to related articles</a>

Or something which is similar to jQuery load() method.

Omit proxy argument, Bad Things Happen™

So this is interesting: I removed the proxy argument, changing

$("[data-append], [data-replace], [data-after], [data-before]").ajaxInclude( "/quickconcat.php?wrap&files=" );

to

$("[data-append], [data-replace], [data-after], [data-before]").ajaxInclude();

And it would appear that the content from all my ajax-included elements is getting dumped into each element. (So if there are four stubs being pulled in, all four stubs get dumped into each element with a data-append attribute.)

HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy

I am trying to test the library by using code from this demo: http://filamentgroup.github.io/Ajax-Include-Pattern/test/functional/default.html

I am linking to the js from the latest head and getting this error:
HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy Jquery.js:4:0

Also, what about Matchmedia and Matchmedia event listener? are these really dependencies too? I included them for now but I hope they are not dependencies too.

Thank you in advance,

JQuery Free Version?

Are there plans for/would you consider plans for a version of this awesome library that doesn't rely upon jQuery or the like, making it much more portable between various JS frameworks (or without one at all!)

Possible to handle media queries with a class or id and not attributes inline?

Hi, this is a newbie question i am sure :)

My question is related to the demo /media.html basically if it is possible to not define the breakpoints inline?

Is there any way to define certain breakpoints on the whole document for an element that has a class, for example if an h2 has a class of .mobile instead of data-media="(max-width: 500px)":
Like this:

  <h2 class="mobile"  data-after="html/links.html">
        <a href="html/links.html">Related External Links</a>
  </h2>

And then in the script blow, all elements with a ".mobile" class has data-media="(max-width: 500px)" before the $( "[data-after]" ).ajaxInclude(); kicks in.

Pardon me for the way of explaining, as you can tell i am not an expert at this :)
Hope you can send me in the right direction.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.