コード例 #1
0
 private function _prefix_keyframe(css_group $keyframe, $apply_list)
 {
     $prefixes = array(3 => "@-ms-keyframes", 2 => "@-o-keyframes", 0 => "@-moz-keyframes", 1 => "@-webkit-keyframes");
     foreach ($prefixes as $id => $value) {
         if (isset($apply_list[$id]) && $apply_list[$id]) {
             $new_name = str_replace('@keyframes', $prefixes[$id], $keyframe->name);
             //Check if keyframe with prefix exists
             $found = false;
             foreach ($keyframe->siblings('css_group') as $sibling) {
                 if ($sibling->name == $new_name) {
                     $found = true;
                 }
             }
             if (!$found) {
                 //Create new keyframe only with prefix for the current vendor
                 $new_keyframe = $keyframe->make_clone();
                 $new_keyframe->name = $new_name;
                 $keyframe->insert_after($new_keyframe);
                 $this->_add_prefixes($new_keyframe, array($id => true), true, true);
             }
         }
     }
 }