Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support HTML5-History-API polyfill #109

Merged
merged 13 commits into from
Sep 30, 2014
Merged

add support HTML5-History-API polyfill #109

merged 13 commits into from
Sep 30, 2014

Conversation

devote
Copy link
Contributor

@devote devote commented Jun 28, 2014

No description provided.

@nowhereman
Copy link

Really useful pull request, it adds old browsers(IEs) support with only one new line of code !
👍

@A A added the enhancement label Jul 1, 2014
@netpoetica
Copy link

So by merging this pull request in, you simply load in pagesjs + history API polyfill and pagejs can officially support IE8 and 9? It would be useful to have some clarification and potentially add some documentation to this pull request about what the end user will need to do in order to have x-browser code operational without reigning in a new abundance of issues

Also +1 this is awesome

@A
Copy link
Member

A commented Jul 1, 2014

yep, I think the PR is very good, but I need some more time to plan next release. I favorited the PR for merge it some time later :)

@netpoetica
Copy link

Heard, let's not wait too long :) I had to abandon usage of pagejs for Sammyjs instead in order to support IE8. Looking forward to getting back to Pagejs as it is much less opinionated and invasive

@devote
Copy link
Contributor Author

devote commented Jul 2, 2014

@netpoetica

How to use a HTML5-History-API Polyfill together with router (OPTIONAL):

Before calling page.base() use: history.redirect([prefixType], [basepath]) - Translation link if required.

  • prefixTyle: [string|null] - Substitute the string after the anchor (#) by default "/".
  • basepath: [string|null] - Set the base path. See page.base() by default "/". (Note: slash after pathname required)

@A
Copy link
Member

A commented Jul 2, 2014

@devote mb add this guide to readme? Can you?

@jonathanong
Copy link
Contributor

we need to fix the test system so that the tests pass first...

@devote
Copy link
Contributor Author

devote commented Jul 8, 2014

Add a first line?

var window = typeof window !== "undefined" ? window : this;

@jonathanong
Copy link
Contributor

well it's weird because in node, this is actually module or exports, forget which. we want to check both window and global. _.

thinking of just switching over to phantomjs since it's an actual browser environment

@devote
Copy link
Contributor Author

devote commented Jul 8, 2014

Any ideas?

@jonathanong jonathanong mentioned this pull request Jul 8, 2014
@devote
Copy link
Contributor Author

devote commented Jul 8, 2014

Hmmm ... Again, not passed

@devote
Copy link
Contributor Author

devote commented Jul 8, 2014

Was successful test earlier? He stumbles on all that is possible.

This reverts commit cc4feea.
@devote
Copy link
Contributor Author

devote commented Jul 8, 2014

Tests did not pass. And as I understand it, they never pass.

@netpoetica
Copy link

It's hacky but you can also use mocha-browser https://github.com/lepture/mocha-browser that might be a quick solution to get tests passing w/ a browser environment

@alanning
Copy link

alanning commented Jul 8, 2014

Not sure if this is what is causing the failed build but we've had similiar issues with window vs global context with code that can run in both the browser and nodejs. This is what worked for us:

;(function (context) {

   // ... code that sticks something on the global context ...
   // ex. 
   // context.MyGlobalClass

})(typeof global === 'undefined' ? window : global);

Important part is to default to global because it seems in nodejs there is a window object supplied but it is not the same as the global context.

@devote
Copy link
Contributor Author

devote commented Jul 8, 2014

0 passing (375ms)
  1 failing
  1)  "before all" hook:
     TypeError: Object #<Object> has no method 'addEventListener'
      at Function.page.start (/home/travis/build/visionmedia/page.js/index.js:121:41)
      at page (/home/travis/build/visionmedia/page.js/index.js:80:12)

These errors are quite different https://travis-ci.org/visionmedia/page.js/builds/29408064

@jonathanong
Copy link
Contributor

oh dude your code was fine before. it's a matter of fixing the test system, not your tests.

@devote
Copy link
Contributor Author

devote commented Jul 9, 2014

... your code was fine before.

You mean the very first commit?

@andyburke
Copy link
Contributor

what happened with this?

@A A merged commit 38548a6 into visionmedia:master Sep 30, 2014
A added a commit that referenced this pull request Sep 30, 2014
@A
Copy link
Member

A commented Sep 30, 2014

I fixed tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants