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

Recognize 'blob:' URLs as absolute #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

zlamma
Copy link

@zlamma zlamma commented Jun 19, 2016

With blob URLs you can play with single-page-components purely in the browser.
E.g. you can feed Ractive.load a URL constructed from a string like this:

var template = '<script>component.exports ={ data:{ Name: "Alice" }}</script>'+
              '<h3>Hello {{Name}}!</h3>';
var url = URL.createObjectURL(new Blob([template], { type: 'text/html' }))
Ractive.load( url )
    .then(ShowItSomewhere)

Or, better yet, from a text input box on a component editor page.

@zlamma zlamma changed the title Make the 'absolute URL detection' code correctly recognize 'blob:' URLs as absolute Recognize 'blob:' URLs as absolute Jun 19, 2016
@fskreuz
Copy link
Contributor

fskreuz commented Jun 20, 2016

Probably requires tests 😄

@zlamma
Copy link
Author

zlamma commented Jun 20, 2016

Would love to but it's the harder part for me. Currently fighting with getting the thing to build and pass tests on Windoze, as this is what I'm currently stuck with 😩. Plently of tests failing because of line endings :(

UPDATE: OK. I think I nailed the Windows problem and I think it can be fixed in the repo for everyone using Windows. Please see pull request #29 . If you merge it, it will make it easier for me to update this PR with a test :)

@zlamma zlamma force-pushed the support_blob_urls branch from ca81aea to e094943 Compare June 20, 2016 23:37
@zlamma zlamma force-pushed the support_blob_urls branch 2 times, most recently from ac87a13 to e2b5028 Compare June 20, 2016 23:43
@zlamma
Copy link
Author

zlamma commented Jun 20, 2016

Added the test now & forced.

@zlamma
Copy link
Author

zlamma commented Jun 22, 2016

Alternatively, not to bake in too much complexity into this dumb logic, rcu can be made to work with URL objects (browsers, node), which are always absolute.
But how would we detect them cross-platform way? Perhaps checking existence of a property that exists in both node and browsers, like href?

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

Successfully merging this pull request may close these issues.

2 participants