Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(968)

Unified Diff: Source/core/html/HTMLMarqueeElement.js

Issue 386353002: Implement reflected attributes of HTMLMarqueeElement in Blink-in-JS (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLMarqueeElement.idl ('k') | Source/core/testing/PrivateScriptTest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMarqueeElement.js
diff --git a/Source/core/html/HTMLMarqueeElement.js b/Source/core/html/HTMLMarqueeElement.js
index 110b05434330eda129b541fd5a380e0bd1d3403c..3ca0e32892c0144609d39a3b742d80071620fc7c 100644
--- a/Source/core/html/HTMLMarqueeElement.js
+++ b/Source/core/html/HTMLMarqueeElement.js
@@ -4,7 +4,7 @@
'use strict';
-(function(global) {
+installClass('HTMLMarqueeElement', function(global) {
var kDefaultScrollAmount = 6;
var kDefaultScrollDelayMS = 85;
@@ -32,8 +32,7 @@
var pixelLengthRegexp = /^\s*([\d.]+)\s*$/;
var percentageLengthRegexp = /^\s*([\d.]+)\s*%\s*$/;
- function convertHTMLLengthToCSSLength(value)
- {
+ function convertHTMLLengthToCSSLength(value) {
var pixelMatch = value.match(pixelLengthRegexp);
if (pixelMatch)
return pixelMatch[1] + 'px';
@@ -43,8 +42,8 @@
return null;
}
- function reflectAttribute(prototype, attributeName, propertyName)
- {
+ // FIXME: Consider moving these utility functions to PrivateScriptUtils.js.
+ function reflectAttribute(prototype, attributeName, propertyName) {
Object.defineProperty(prototype, propertyName, {
get: function() {
return this.getAttribute(attributeName) || '';
@@ -52,23 +51,26 @@
set: function(value) {
this.setAttribute(attributeName, value);
},
+ configurable: true,
+ enumerable: true,
});
}
- function reflectBooleanAttribute(prototype, attributeName, propertyName)
- {
+ function reflectBooleanAttribute(prototype, attributeName, propertyName) {
Object.defineProperty(prototype, propertyName, {
get: function() {
return this.hasAttribute(attributeName);
},
set: function(value) {
- this.setAttribute(attributeName, value ? '' : null);
+ if (value.valueOf() === false)
arv (Not doing code reviews) 2014/07/14 14:49:09 This will fail when set to null or undefined. The
+ this.removeAttribute(attributeName);
+ else
+ this.setAttribute(attributeName, value ? '' : null);
arv (Not doing code reviews) 2014/07/14 14:49:09 You already handled the the falsey case. this.set
},
});
}
- function defineInlineEventHandler(prototype, eventName)
- {
+ function defineInlineEventHandler(prototype, eventName) {
var propertyName = 'on' + eventName;
// FIXME: We should use symbols here instead.
var functionPropertyName = propertyName + 'Function_';
@@ -397,8 +399,11 @@
}
};
- global.document.registerElement('i-marquee', {
- prototype: HTMLMarqueeElementPrototype,
- });
+ // FIXME: We have to inject this HTMLMarqueeElement as a custom element in order to make
+ // createdCallback, attachedCallback, detachedCallback and attributeChangedCallback workable.
+ // global.document.registerElement('i-marquee', {
+ // prototype: HTMLMarqueeElementPrototype,
+ // });
-})(this);
+ return HTMLMarqueeElementPrototype;
+});
« no previous file with comments | « Source/core/html/HTMLMarqueeElement.idl ('k') | Source/core/testing/PrivateScriptTest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698