Forum Moderators: open
The html for the test suite is:
<div class="testgroup one">
<div class="container">
<div class="mytest onea "><p>My p <em>My em</em></p></div>
<div class="mytest oneb"><p>My p <em>My em</em></p></div>
</div><!--end container -->
<div class="container">
<div class="mytest twoa "><p>My p <em>My em</em></p></div>
<div class="mytest twob"><p>My p <em>My em</em></p></div>
</div><!--end container -->
-where the pseudo element is em:after.
<div class="container">Presentation isn't an issue as this is a test suite, it would just be fantastic to have the z-index written out for each element so I don't have to track it manually. Any help really appreciated.
container= 1
<div class="mytest onea "><p>My p <em>My em</em></p></div>
onea=2, p=3, em=4, em:after=5
<div class="mytest oneb"><p>My p <em>My em</em></p></div>
oneb=3, p=4, em=5, em:after=6
<!DOCTYPE html>
<head>
<style type="text/css">
.container { z-index: 1; position: relative;}
.mytest { z-index: 2; position: relative;}
</style>
<title>Test</title>
</head>
<body>
<div class="testgroup one">
<div class="container">
<div class="mytest onea ">
<p>
My p <em>My em</em>
</p>
</div>
<div class="mytest oneb">
<p>
My p <em>My em</em>
</p>
</div>
</div><!--end container -->
<div class="container">
<div class="mytest twoa ">
<p>
My p <em>My em</em>
</p>
</div>
<div class="mytest twob">
<p>
My p <em>My em</em>
</p>
</div>
</div><!--end container -->
</div>
<script type="text/javascript" charset="utf-8"
src="http://yui.yahooapis.com/3.2.0/build/yui/yui-min.js">
</script>
<script type="text/javascript">
YUI().use('node', function(Y) {
/**
* @param n The node to get the z-index value for. This method will also be
* called on each child node of this node.
*/
function getZ(n) {
var clss = n.getAttribute('class'), // the classname of the element
tag = Y.Node.getDOMNode(n).tagName, // the tagname of the element
z = n.getComputedStyle('zIndex'); // the computed z-index value
// iterate recursively through child nodes
n.get('children').each(getZ);
if (clss && clss.length > 0) {
n.prepend(clss + "= " + z);
}
else {
// no classname was available for the node so we'll use the tagname
// instead and append it to the closest div parent instead of
// prepending it to the current node.
n.ancestor('div').append(tag + "= " + z);
}
}
Y.all('.container').each(getZ);
});
</script>
</body>
</html>