-
Notifications
You must be signed in to change notification settings - Fork 16
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
Use document.location.path instead of document.location.href #6
Comments
Using pathName instead of href makes sense.
As for the regexp, did you just change:
/[^/]+/[^/]+
to:
(?:/[^/]+){2}
or were there other changes as well? That first change certainly makes
sense.
Happy to take a PR for those two.
|
Yep, that was the change. If we could have multiline regexp's, I'd use
them, but we don't in javascript I don't think.
…On 1/2/2017 5:03 PM, James Teh wrote:
Using pathName instead of href makes sense.
As for the regexp, did you just change:
/[^/]+/[^/]+
to:
(?:/[^/]+){2}
or were there other changes as well? That first change certainly makes
sense.
Happy to take a PR for those two.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFGivf62XeJDyLwf9ZOPZziEz6iUCd88ks5rOZBHgaJpZM4LWo2X>.
--
------------------------------------------------------------------------
Derek Riemer
* Department of computer science, third year undergraduate student.
* Proud user of the NVDA screen reader.
* Open source enthusiast.
* Member of Bridge Cu
* Avid skiier.
Websites:
Honors portfolio <http://derekriemer.com>
Awesome little hand built weather app!
<http://django.derekriemer.com/weather/>
email me at derek.riemer@colorado.edu <mailto:derek.riemer@colorado.edu>
Phone: (303) 906-2194
|
I assume this was about the GitHub script? The new script no longer uses location. It may need to again in future, but it doesn't now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The regexp would be cleaner if we did
var res = document.location.pathName.match(//[^\/]+/[^\/]+(?:/([^\/?]+))?(?:/([^\/?]+))?(?:/([^\/?]+))?(?:/([^\/?]+))?/);
pathNamed only gives us the thing after the url.
Also why couldn't we use
var res = document.location.pathName.match(/(?:/[^\/]+){2}(?:/([^\/?]+))?(?:/([^\/?]+))?(?:/([^\/?]+))?(?:/([^\/?]+))?/);
I'm happy to give a PR if you want.
The text was updated successfully, but these errors were encountered: