| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Counter used to give webkit animations unique names. | 5 // Counter used to give webkit animations unique names. |
| 6 var animationCounter = 0; | 6 var animationCounter = 0; |
| 7 | 7 |
| 8 var animationEventTracker_ = new EventTracker(); | 8 var animationEventTracker_ = new EventTracker(); |
| 9 | 9 |
| 10 function addAnimation(code) { | 10 function addAnimation(code) { |
| 11 var name = 'anim' + animationCounter; | 11 var name = 'anim' + animationCounter; |
| 12 animationCounter++; | 12 animationCounter++; |
| 13 var rules = document.createTextNode( | 13 var rules = |
| 14 '@-webkit-keyframes ' + name + ' {' + code + '}'); | 14 document.createTextNode('@-webkit-keyframes ' + name + ' {' + code + '}'); |
| 15 var el = document.createElement('style'); | 15 var el = document.createElement('style'); |
| 16 el.type = 'text/css'; | 16 el.type = 'text/css'; |
| 17 el.appendChild(rules); | 17 el.appendChild(rules); |
| 18 el.setAttribute('id', name); | 18 el.setAttribute('id', name); |
| 19 document.body.appendChild(el); | 19 document.body.appendChild(el); |
| 20 | 20 |
| 21 return name; | 21 return name; |
| 22 } | 22 } |
| 23 | 23 |
| 24 /** | 24 /** |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 while (el.childNodes.length > 0) | 182 while (el.childNodes.length > 0) |
| 183 div.appendChild(el.firstChild); | 183 div.appendChild(el.firstChild); |
| 184 el.appendChild(div); | 184 el.appendChild(div); |
| 185 } | 185 } |
| 186 | 186 |
| 187 div.className = ''; | 187 div.className = ''; |
| 188 div.classList.add('collapsible'); | 188 div.classList.add('collapsible'); |
| 189 for (var i = 0; i < classes.length; i++) | 189 for (var i = 0; i < classes.length; i++) |
| 190 div.classList.add(classes[i]); | 190 div.classList.add(classes[i]); |
| 191 } | 191 } |
| OLD | NEW |