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

Support Relative URL for Image src #5484

Closed
wants to merge 7 commits into from
Closed

Conversation

nateevans
Copy link
Contributor

see #5476

@@ -349,7 +357,13 @@
if (element.toDataURL) {
return element.toDataURL();
}
return element.src;

if (this.srcFromAttribute && typeof element.getAttribute === 'function') {
Copy link
Member

Choose a reason for hiding this comment

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

We support ie10 ( sort of ) ie11 and then modern browsers.
Can you verify if getAttribute is really unsupported from some of those?

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (this.srcFromAttribute && typeof element.getAttribute === 'function') {
if (this.srcFromAttribute) {

@asturur
Copy link
Member

asturur commented Jan 15, 2019

@nateevans a couple of comments:
Please branch of your master from where you are, restore your master to the top of fabric.js master, and before committing the code remember to do:

git checkout master dist so that you do not commit changes to the dist folder.

Can you try to add a test in the relative file in the test/unit folder?

dist/fabric.js Outdated
* When calling {@link fabric.Image.getSrc}, return value from element src with `element.getAttribute('src')` (if available).
* This allows for relative urls as image src.
* @type Boolean
* @default
Copy link
Member

@asturur asturur Jan 15, 2019

Choose a reason for hiding this comment

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

can you add:
@since 2.7.0 ?

@asturur
Copy link
Member

asturur commented Jan 15, 2019

@nateevans a couple of comments:
You should not commit to the dist folder.
In order to roll it back either

branch off your master from where you are, restore your master to the top of fabric.js master, and before committing the code remember to do:
git checkout master dist so that you do not commit changes to the dist folder.

or find the commit where dist was not changed and do
git checkout ..commithash... dist

@asturur
Copy link
Member

asturur commented Jan 15, 2019

i wonder how we can properly test node. as it is now the test under node does not make much sense.

@nateevans
Copy link
Contributor Author

@asturur

You should not commit to the dist folder.

Ah ok. How do you run tests normally? seems like I had to build those in order to run testem since it runs off of dist/

i wonder how we can properly test node. as it is now the test under node does not make much sense.

I don't think the use case for this actually applies to node. With JSDOM in Node, calling element.src doesn't seem to add any schema/hostname. Which makes sense, I don't know what it would even add there... it just seems to affect usage in browser.

@nateevans
Copy link
Contributor Author

I'll close out this PR and make one from the new branch

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.

None yet

2 participants