Css clip-path can be coerced into working

By turning off clipping for the first object before enabling the second, then we can get them both to work.

by mtjhax

HTML

<div class="circle">
    <div></div>
</div>

<div class="circle">
    <div></div>
</div>

<svg>
    <defs>
        <clippath id="circle_clip" clipPathUnits="objectBoundingBox">
            <circle cx=".5" cy=".5" r=".5" />
        </clippath>
    </defs>
</svg>

CSS

.circle {
    width: 100px;
    height: 100px;
    overflow: hidden;
    margin-bottom: 10px;
}

.circle div {
    width: 100%;
    height: 100%;
    background: red;
    position: relative;
}

.clipped {
    -webkit-clip-path: url(#circle_clip);
    -moz-clip-path: url(#circle_clip);
    -o-clip-path: url(#circle_clip);
    clip-path: url(#circle_clip);
}

JavaScript

// note that it does not work without the timers
// implying that this is a bug in webkit browsers
setTimeout(function(){
    $('.circle:first div').addClass('clipped');
    setTimeout(function(){
        $('.circle:first div').removeClass('clipped');
        $('.circle:nth-of-type(2) div').addClass('clipped');
        setTimeout(function(){
            $('.circle:first div').addClass('clipped');
        }, 2000);    
    }, 2000);    
}, 2000);