这是一个我不太了解的关于z-index和css伪元素:: before/:: after的行为.
它在这个jsfiddle上有说明:http://jsfiddle.net/jgoyon/T6QCf/
我创建了一个定位框并使用:: after伪元素添加内容(也定位).
#no-z-index {
background:lightblue;
width:100px;
height:100px;
position:relative;
}
#no-z-index:after {
content: 'z-index -1';
width:50px;
height:50px;
background:yellow;
position:absolute;
z-index:-1; /* z-index in question */
top:70px;
left:70px;
}
Run Code Online (Sandbox Code Playgroud)
#z-index {
background:lightblue;
left:200px;
width:100px;
height:100px;
position:relative;
z-index:0; /* parent z-index */
}
#z-index:after {
content: 'z-index -1';
width:50px;
height:50px;
background:yellow;
position:absolute;
z-index:-1; /* z-index in question */
top:70px;
left:70px;
}
Run Code Online (Sandbox Code Playgroud)
这是预期的行为吗?
我试图理解为什么在数组中推送许多(在我的情况下为130798)对象返回一个SystemStackError.
big = Array.new(130797, 1)
[].push(*big) && false
=> false
bigger = Array.new(130798, 1)
[].push(*bigger) && false
=> SystemStackError: stack level too deep
from (irb):104
from /Users/julien/.rbenv/versions/2.2.0/bin/irb:11:in `<main>'
Run Code Online (Sandbox Code Playgroud)
我能够在MRI 1.9.3和2.2.0上重现它,而Rubinius(2.5.2)没有出现任何错误.
我知道这是由于Array在MRI中实施的方式,但不太明白为什么a SystemStackError被提出.