Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ecommerce-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
ecommerce-ui
Commits
6b37e9d1
Commit
6b37e9d1
authored
Apr 25, 2014
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app: add global delete children method
parent
1fd0fc77
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
14 deletions
+21
-14
js/erp5_loader.js
js/erp5_loader.js
+21
-14
No files found.
js/erp5_loader.js
View file @
6b37e9d1
...
...
@@ -3167,9 +3167,7 @@
break
;
default
:
// NOTE: empty - setting .translate on a wrapper will empty it
while
(
element
.
hasChildNodes
())
{
element
.
removeChild
(
element
.
firstChild
);
}
util
.
deleteChildren
(
element
);
element
.
appendChild
(
document
.
createTextNode
(
i18n
.
t
(
target
[
0
])));
break
;
}
...
...
@@ -4723,7 +4721,6 @@
id
=
answer
.
id
;
decode
=
/%
[
0-9a-f
]{2}
/i
.
test
(
id
);
goto_page
=
decode
?
id
:
window
.
encodeURIComponent
(
id
);
$
.
mobile
.
changePage
(
obj
.
state
.
callback
.
replace
(
"
__id__
"
,
goto_page
));
}
};
...
...
@@ -5547,10 +5544,11 @@
}
}
});
}
/*
else {
}
else
{
// TODO: AAAARGH! so much jquery...
// TODO: AND IT DOES NOT WORK... §$%&/()=!
$
(
form_element
).
trigger
(
"
addField
"
,
$
(
form_element
).
find
(
"
.required
"
));
}
*/
}
}
};
...
...
@@ -5813,13 +5811,14 @@
* Get the active JQM page in JavaScript-only
* @method getPage
* @param {string} url url of the page to fetch
* @param {string} straight If not set, we start searching from behind
* @return {string} id of active page
*/
util
.
getPage
=
function
(
url
)
{
var
i
,
kid
,
kids
=
document
.
body
.
children
;
util
.
getPage
=
function
(
url
,
straight
)
{
var
i
,
kid
,
len
,
kids
=
document
.
body
.
children
;
// reverse, because in JQM last page is the active page!
for
(
i
=
kids
.
length
-
1
;
i
>=
0
;
i
-=
1
)
{
for
(
len
=
kids
.
length
,
i
=
len
-
1
;
i
>=
0
;
i
-=
1
)
{
kid
=
kids
[
i
];
if
(
util
.
testForString
(
"
ui-page
"
,
kid
.
className
))
{
...
...
@@ -5831,6 +5830,17 @@
return
undefined
;
};
/**
* Remove all children of an element
* @method deleteChildren
* @param {object} el Element to remove children from
*/
util
.
deleteChildren
=
function
(
el
)
{
while
(
el
.
hasChildNodes
())
{
el
.
removeChild
(
el
.
lastChild
);
}
};
/**
* Reverse an array
* @method reverseArray
...
...
@@ -6719,12 +6729,9 @@
detach
.
appendChild
(
last_child
.
cloneNode
(
true
));
}
}
// clear
while
(
update_target
.
hasChildNodes
())
{
update_target
.
removeChild
(
update_target
.
lastChild
);
}
//add new dynamic content and detached elements
//empty target, add new dynamic content and detached elements
util
.
deleteChildren
(
update_target
);
update_target
.
appendChild
(
wrapper
.
fragment
);
update_target
.
appendChild
(
detach
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment