| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 installClass('HTMLMarqueeElement', function(global) { | 7 installClass('HTMLMarqueeElement', function(global) { |
| 8 | 8 |
| 9 var kDefaultScrollAmount = 6; | 9 var kDefaultScrollAmount = 6; |
| 10 var kDefaultScrollDelayMS = 85; | 10 var kDefaultScrollDelayMS = 85; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 enumerable: true, | 55 enumerable: true, |
| 56 }); | 56 }); |
| 57 } | 57 } |
| 58 | 58 |
| 59 function reflectBooleanAttribute(prototype, attributeName, propertyName) { | 59 function reflectBooleanAttribute(prototype, attributeName, propertyName) { |
| 60 Object.defineProperty(prototype, propertyName, { | 60 Object.defineProperty(prototype, propertyName, { |
| 61 get: function() { | 61 get: function() { |
| 62 return this.hasAttribute(attributeName); | 62 return this.hasAttribute(attributeName); |
| 63 }, | 63 }, |
| 64 set: function(value) { | 64 set: function(value) { |
| 65 if (value.valueOf() === false) | 65 if (value) |
| 66 this.setAttribute(attributeName, ''); |
| 67 else |
| 66 this.removeAttribute(attributeName); | 68 this.removeAttribute(attributeName); |
| 67 else | |
| 68 this.setAttribute(attributeName, value ? '' : null); | |
| 69 }, | 69 }, |
| 70 }); | 70 }); |
| 71 } | 71 } |
| 72 | 72 |
| 73 function defineInlineEventHandler(prototype, eventName) { | 73 function defineInlineEventHandler(prototype, eventName) { |
| 74 var propertyName = 'on' + eventName; | 74 var propertyName = 'on' + eventName; |
| 75 // FIXME: We should use symbols here instead. | 75 // FIXME: We should use symbols here instead. |
| 76 var functionPropertyName = propertyName + 'Function_'; | 76 var functionPropertyName = propertyName + 'Function_'; |
| 77 var eventHandlerPropertyName = propertyName + 'EventHandler_'; | 77 var eventHandlerPropertyName = propertyName + 'EventHandler_'; |
| 78 Object.defineProperty(prototype, propertyName, { | 78 Object.defineProperty(prototype, propertyName, { |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 }; | 400 }; |
| 401 | 401 |
| 402 // FIXME: We have to inject this HTMLMarqueeElement as a custom element in o
rder to make | 402 // FIXME: We have to inject this HTMLMarqueeElement as a custom element in o
rder to make |
| 403 // createdCallback, attachedCallback, detachedCallback and attributeChangedC
allback workable. | 403 // createdCallback, attachedCallback, detachedCallback and attributeChangedC
allback workable. |
| 404 // global.document.registerElement('i-marquee', { | 404 // global.document.registerElement('i-marquee', { |
| 405 // prototype: HTMLMarqueeElementPrototype, | 405 // prototype: HTMLMarqueeElementPrototype, |
| 406 // }); | 406 // }); |
| 407 | 407 |
| 408 return HTMLMarqueeElementPrototype; | 408 return HTMLMarqueeElementPrototype; |
| 409 }); | 409 }); |
| OLD | NEW |