Commit f31e54b9 authored by Sven Franck's avatar Sven Franck

app: fix for Opera/oldIOS not supporting first/lastElementChild...

parent b3413ed0
...@@ -873,6 +873,8 @@ ...@@ -873,6 +873,8 @@
* @param {object} spec JSON configuration * @param {object} spec JSON configuration
* @return {object} object including fragment, child-selector, placeholder * @return {object} object including fragment, child-selector, placeholder
*/ */
// TODO: too complicated and too much custom stuff passed back
// This cannot be so difficult...
factory.widget.header = function (spec) { factory.widget.header = function (spec) {
var container, id, target, set_img, img; var container, id, target, set_img, img;
...@@ -882,11 +884,11 @@ ...@@ -882,11 +884,11 @@
img = spec.image || {}; img = spec.image || {};
// button group wrappers and title (inserted before last wrapper!) // button group wrappers and title (inserted before last wrapper!)
target = function (spec) { target = function (new_spec) {
var position, drop_content, fragment, count, config; var position, drop_content, fragment, count, config;
count = spec.j; count = new_spec.j;
config = spec.config; config = new_spec.config;
fragment = document.createDocumentFragment(); fragment = document.createDocumentFragment();
position = (config.section_list || ["first", "last"])[count]; position = (config.section_list || ["first", "last"])[count];
drop_content = config.add_content === 0 ? 0 : 1; drop_content = config.add_content === 0 ? 0 : 1;
...@@ -949,9 +951,10 @@ ...@@ -949,9 +951,10 @@
return { return {
"fragment": container, "fragment": container,
"child_selector": container.querySelector("#" + id), "child_selector": container.querySelector("#" + id) || container,
"target": target, "target": target,
"target_selector": "last", "target_selector": "last",
// TODO: remove this...
"spec": { "spec": {
"img": !!set_img, "img": !!set_img,
"src": img.src, "src": img.src,
...@@ -6696,8 +6699,12 @@ ...@@ -6696,8 +6699,12 @@
// NOTE: wrapper_selector will return a fragment (set to // NOTE: wrapper_selector will return a fragment (set to
// first/last-ElementChild or a DOM node // first/last-ElementChild or a DOM node
// NOTE: Opera/old IOS do not support first/lastELEMENTChild...
// must use first/lastChild instead
// TODO: can this be .... removed?
done_target = done_target =
wrapper_selector[wrapper.target_selector + "ElementChild"] wrapper_selector[wrapper.target_selector + "ElementChild"]
|| wrapper_selector[wrapper.target_selector + "Child"]
|| wrapper_selector; || wrapper_selector;
done_target.appendChild(response); done_target.appendChild(response);
} }
......
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