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

let, function() assigment typos #292

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/chips/chips.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@
}
},

_renderSelectElement() {
_renderSelectElement: function() {

},

_renderChips: function() {
if(this.value) {
for(let i = 0; i < this.value.length; i++) {
for(var i = 0; i < this.value.length; i++) {
this._renderChip(this.value[i]);
}
}
Expand Down
4 changes: 2 additions & 2 deletions components/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@
return data[field];
}
else {
let fields = field.split('.');
let value = data;
var fields = field.split('.');
var value = data;
for(var i = 0, len = fields.length; i < len; ++i) {
value = value[fields[i]];
}
Expand Down
20 changes: 10 additions & 10 deletions components/fileupload/fileupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
this.messagesElement.puimessages('clear');
var files = event.dataTransfer ? event.dataTransfer.files : event.target.files;

for(var file of files) {
for(var file in files) {
if(!this._isFileSelected(file)) {
if(this._validate(file)) {
if(this._isImage(file)) {
Expand Down Expand Up @@ -191,7 +191,7 @@
},

_isFileSelected: function(file) {
for(var sFile of this.files){
for(var sFile in this.files){

Choose a reason for hiding this comment

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

I think changing for of to for in require an additional check:
if (this.files.hasOwnProperty(sFile))

if((sFile.name + sFile.type + sFile.size) === (file.name + file.type + file.size))
return true;
}
Expand All @@ -217,25 +217,25 @@

upload: function() {
this.messagesElement.puimessages('clear');
let xhr = new XMLHttpRequest();
let formData = new FormData();
var xhr = new XMLHttpRequest();
var formData = new FormData();
var $this = this;

this._trigger('onBeforeUpload', null, {'xhr': xhr, 'formData': formData});

for(var file of this.files) {
for(var file in this.files) {

Choose a reason for hiding this comment

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

I think changing for of to for in require an additional check:
if (this.files.hasOwnProperty(file))

formData.append(this.options.name, file, file.name);
}

xhr.upload.addEventListener('progress', (event) => {
xhr.upload.addEventListener('progress', function(event) {
if(event.lengthComputable) {
$this.progressBar.puiprogressbar('option', 'value', Math.round((event.loaded * 100) / event.total));
}

this._trigger('onProgress', event, {progress: this.progress});
});

xhr.onreadystatechange = () => {
xhr.onreadystatechange( function(){
if(xhr.readyState === 4) {
$this.progressBar.puiprogressbar('option', 'value', 0);

Expand All @@ -250,7 +250,7 @@

$this.clear();
}
};
});

xhr.open('POST', this.options.url, true);

Expand Down Expand Up @@ -284,7 +284,7 @@
}
},

_remove(index) {
_remove: function(index) {
this._refreshInputElement();
this.files.splice(index, 1);
this.filesListElement.children().eq(index).fadeOut('normal', function() {$(this.remove())});
Expand All @@ -305,7 +305,7 @@
if(bytes === 0) {
return '0 B';
}
let k = 1000,
var k = 1000,
dm = 3,
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));
Expand Down
8 changes: 4 additions & 4 deletions components/sidebar/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
this._bindEvents();
},

_bindEvents() {
_bindEvents:function() {
var $this = this;

this.closeIcon.on('click.puisidebar', function(e) {
Expand All @@ -49,7 +49,7 @@
});
},

_unbindEvents() {
_unbindEvents: function() {
this.closeIcon.off('click.puisidebar');
},

Expand All @@ -68,7 +68,7 @@
this._trigger('onHide');
},

_enableModality() {
_enableModality: function() {
if(!this.mask) {
var $this = this;
this.mask = $('<div class="ui-widget-overlay ui-sidebar-mask"></div>');
Expand All @@ -80,7 +80,7 @@
}
},

_disableModality() {
_disableModality:function() {
if(this.mask) {
this.mask.off('click.puislider').remove();
$(document.body).removeClass('ui-overflow-hidden');
Expand Down