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

Don't copy classes to hidden input #651

Closed
santyclaz opened this issue Mar 31, 2015 · 3 comments
Closed

Don't copy classes to hidden input #651

santyclaz opened this issue Mar 31, 2015 · 3 comments

Comments

@santyclaz
Copy link

So I noticed in your code when creating the hidden input for doing the actual upload, it copies over every attribute from whatever element the directive is placed on.

// angular-file-upload.js v3.2.4, lines 244-247
for (var i = 0; i < elem[0].attributes.length; i++) {
    var attribute = elem[0].attributes[i];
    fileElem.attr(attribute.name, attribute.value);
}

My specific issue at hand is that the additional classes messes up my styling despite the hidden input being hidden and given position absolute. I am wondering if it were possible to exclude classes from being copied over when generating this element, or whether there is a specific reason classes must also be included. Also I'm guessing it would be a good idea to exclude copying id attribute as well.

For those curious about the styling issue, it's because I am using bootstrap.css and it has the following CSS:

.btn-block + .btn-block {
    margin-top: 5px;
}

So having something like this:

<div classes="btn btn-block" ng-file-select ...>Upload</div>

results in:

<input classes="btn btn-block" ... /> <!-- hidden but still causes below element to have a margin-top -->
<div classes="btn btn-block" ng-file-select ...>Upload</div>
@danialfarid
Copy link
Owner

gonna fix in the next version

@santyclaz
Copy link
Author

Cool, good to know.

danialfarid pushed a commit that referenced this issue Apr 13, 2015
…and some IE8-9 bugs and styling issue
@danialfarid
Copy link
Owner

Fixed in version 3.3.0

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

No branches or pull requests

2 participants