Commit 987a942b authored by Sven Franck's avatar Sven Franck

items/fix: updated CSS, refactor bindings for refresh

parent 87e2b117
......@@ -21,6 +21,7 @@
}
.items_listview li,
.items_listview li a {
display: inline-block;
border-width: 0px !important;
}
.items_listview li,
......
......@@ -12,32 +12,6 @@ define([
// like pointers or a default fallback. This is what we are doing currently.
// Leave it like that!
// Javascript closest()
priv.closest = function (elem, selector) {
var matchesSelector = elem.matches ||
elem.webkitMatchesSelector ||
elem.mozMatchesSelector ||
elem.msMatchesSelector,
oldbrowserReturn;
if (matchesSelector) {
while (elem) {
if (matchesSelector.bind(elem)(selector)) {
return elem;
} else {
elem = elem.parentNode;
}
}
return false;
} else {
oldbrowserReturn = $( elem ).closest( selector );
if (oldBrowserReturn.length > 0) {
return oldBrowserReturn;
}
return false;
}
};
// generate items to display
priv.generateItems = function (params) {
var markup, spec,
......@@ -129,15 +103,17 @@ define([
// TODO: this is for page event bindings. Once JQM content replaces
// page, remove this and make the gadget the content section to
// be updated.
spec.page = priv.closest(spec.gadget.dom.get(0), "div[data-role='page']");
spec.page = App.util.closest(spec.gadget.dom.get(0), "div[data-role='page']");
spec.pageId = "#" + spec.page.id;
spec.source = source;
spec.callback_mockup = callback_mockup;
if (!spec.page.getAttribute("items_tag")) {
spec.page.setAttribute("items_tag", "true");
$(document).on("pagebeforeshow.items", spec.pageId, function (e) {
priv.generateItems(spec);
if (!spec.page.getAttribute("events_items")) {
spec.page.setAttribute("events_items", true);
$(document).on("pagebeforeshow.items", spec.pageId, function (e, data) {
if ($.mobile.firstPage.attr('id') !== spec.pageId.replace("#","")) {
priv.generateItems(spec);
}
});
// and run intial
priv.generateItems(spec);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment