зеркало из https://github.com/mozilla/pjs.git
32 строки
807 B
HTML
32 строки
807 B
HTML
|
<html>
|
||
|
<head>
|
||
|
<script>
|
||
|
function doit()
|
||
|
{
|
||
|
const Elements = ["span", "div", "a", "b", "c", "d", "e"];
|
||
|
for (id in Elements) {
|
||
|
var child = document.getElementById(Elements[id]);
|
||
|
var parent = child.parentNode;
|
||
|
var next = child.nextSibling;
|
||
|
parent.removeChild(child);
|
||
|
parent.insertBefore(child, next);
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
</head>
|
||
|
<body onload="doit();">
|
||
|
<div id="div">
|
||
|
<span id="span">
|
||
|
here <span id="a" style="color:green;">is</span> a span
|
||
|
<div id="div" style="display:block;">with a <span id="b" style="color:red;">block</span></div>
|
||
|
in
|
||
|
<span id="c" style="color:blue;">
|
||
|
it.
|
||
|
<span id="d" style="color:purple;">
|
||
|
And here is a much more <span id="e" style="color:pink;">deeply nested span</span>
|
||
|
</span>
|
||
|
</span>
|
||
|
</span>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|