Skip to content

Commit

Permalink
Fixed $.css(), ready for publish
Browse files Browse the repository at this point in the history
  • Loading branch information
arguiot committed Oct 1, 2017
1 parent 9d382be commit 9bd7153
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 20 deletions.
26 changes: 14 additions & 12 deletions dist/display.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ class DisplayJS {
}
}
toNodeList(el){
el.setAttribute("wrapNodeList","");
const list = document.querySelectorAll("[wrapNodeList]");
el.removeAttribute("wrapNodeList");
el.setAttribute('wrapNodeList','');
const list = document.querySelectorAll('[wrapNodeList]');
el.removeAttribute('wrapNodeList');
return list;
}
// custom repeat function
Expand Down Expand Up @@ -291,7 +291,7 @@ class DisplayJS {
window.scroll(x, y);
}
scrollTop (el) {
el = el != null ? el : document.body.scrollTop == 0 ? this.toNodeList(document.documentElement) : this.toNodeList(document.body);
el = el != null ? el : document.body.scrollTop == 0 ? this.toNodeList(document.documentElement) : this.toNodeList(document.body)
el = this.s(el);
return el[0].scrollTop;
}
Expand Down Expand Up @@ -339,8 +339,10 @@ class DisplayJS {
}
css(el, name, value) {
el = this.s(el);
if (typeof(name) == "object") {
el[0].style = name;
if (typeof(name) == 'object') {
for (let i in name) {
el[0].style[i] = name[i];
}
} else {
el[0].style[name] = value;
}
Expand Down Expand Up @@ -477,10 +479,10 @@ class DisplayJS {
return array.reduce((a, b) => a.concat(b), []);
}
drop(array, val) {
return val > 0 ? array.slice(val, array.length) : array.slice(0, array.length + val);
return val > 0 ? array.slice(val, array.length) : array.slice(0, array.length + val)
}
isIn(array, val) {
return array.includes(val) ? true : false;
return array.includes(val) ? true : false
}
rmFromArray(array, condition) {
const obj = [];
Expand All @@ -496,7 +498,7 @@ class DisplayJS {
el = this.s(el);
this.ajax(url, "GET", "", text => {
try {
el[0].innerHTML = text;
el[0].innerHTML = text
callback();
} catch(e) {
callback(e);
Expand Down Expand Up @@ -524,8 +526,8 @@ class DisplayJS {
}
get(url, callback, parse=false) {
this.ajax(url, "GET", "", (data) => {
parse ? callback(JSON.parse(data)) : callback(data);
});
parse ? callback(JSON.parse(data)) : callback(data)
})
}
// create your own $.var() like function
custom(targetAttr, callback, push) {
Expand Down Expand Up @@ -811,7 +813,7 @@ class DisplayJS {
}
then(toCall, callback) {
try {
callback(toCall());
callback(toCall())
} catch (e) {
throw "DisplayJS: " + e;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/display.es6.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion dist/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,9 @@ var DisplayJS = function () {
value: function css(el, name, value) {
el = this.s(el);
if ((typeof name === "undefined" ? "undefined" : _typeof(name)) == 'object') {
el[0].style = name;
for (var i in name) {
el[0].style[i] = name[i];
}
} else {
el[0].style[name] = value;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/display.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion dist/light/display.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,9 @@ class DisplayJS {
css(el, name, value) {
el = this.s(el);
if (typeof(name) == 'object') {
el[0].style = name;
for (let i in name) {
el[0].style[i] = name[i];
}
} else {
el[0].style[name] = value;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/light/display.es6.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion dist/light/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,9 @@ var DisplayJS = function () {
value: function css(el, name, value) {
el = this.s(el);
if ((typeof name === "undefined" ? "undefined" : _typeof(name)) == 'object') {
el[0].style = name;
for (var i in name) {
el[0].style[i] = name[i];
}
} else {
el[0].style[name] = value;
}
Expand Down
Loading

0 comments on commit 9bd7153

Please sign in to comment.