MDL-43262 JavaScript: Correct width attribute override

This should be done using an attribute modification, rather than at the
constructor level.
This commit is contained in:
Andrew Nicols
2014-01-13 08:26:28 +13:00
committed by Sam Hemelryk
parent 12efa52762
commit 16d024348a
4 changed files with 76 additions and 16 deletions
@@ -70,15 +70,11 @@ DIALOGUE = function(c) {
}
config.srcNode = '#'+id;
config.width = config.width || '400px';
config.visible = config.visible || false;
config.center = config.centered && true;
config.centered = false;
config.COUNT = COUNT;
if (config.width === 'auto') {
delete config.width;
}
// closeButton param to keep the stable versions API.
if (config.closeButton === false) {
config.buttons = null;
@@ -479,6 +475,30 @@ Y.extend(DIALOGUE, Y.Panel, {
}
});
Y.Base.modifyAttrs(DIALOGUE, {
/**
* String with units, or number, representing the width of the Widget.
* If a number is provided, the default unit, defined by the Widgets
* DEF_UNIT, property is used.
*
* If a value of 'auto' is used, then an empty String is instead
* returned.
*
* @attribute width
* @default '400px'
* @type {String|Number}
*/
width: {
value: '400px',
setter: function(value) {
if (value === 'auto') {
return '';
}
return value;
}
}
});
M.core.dialogue = DIALOGUE;
File diff suppressed because one or more lines are too long
@@ -70,15 +70,11 @@ DIALOGUE = function(c) {
}
config.srcNode = '#'+id;
config.width = config.width || '400px';
config.visible = config.visible || false;
config.center = config.centered && true;
config.centered = false;
config.COUNT = COUNT;
if (config.width === 'auto') {
delete config.width;
}
// closeButton param to keep the stable versions API.
if (config.closeButton === false) {
config.buttons = null;
@@ -477,6 +473,30 @@ Y.extend(DIALOGUE, Y.Panel, {
}
});
Y.Base.modifyAttrs(DIALOGUE, {
/**
* String with units, or number, representing the width of the Widget.
* If a number is provided, the default unit, defined by the Widgets
* DEF_UNIT, property is used.
*
* If a value of 'auto' is used, then an empty String is instead
* returned.
*
* @attribute width
* @default '400px'
* @type {String|Number}
*/
width: {
value: '400px',
setter: function(value) {
if (value === 'auto') {
return '';
}
return value;
}
}
});
M.core.dialogue = DIALOGUE;
+25 -5
View File
@@ -39,15 +39,11 @@ DIALOGUE = function(c) {
}
config.srcNode = '#'+id;
config.width = config.width || '400px';
config.visible = config.visible || false;
config.center = config.centered && true;
config.centered = false;
config.COUNT = COUNT;
if (config.width === 'auto') {
delete config.width;
}
// closeButton param to keep the stable versions API.
if (config.closeButton === false) {
config.buttons = null;
@@ -448,4 +444,28 @@ Y.extend(DIALOGUE, Y.Panel, {
}
});
Y.Base.modifyAttrs(DIALOGUE, {
/**
* String with units, or number, representing the width of the Widget.
* If a number is provided, the default unit, defined by the Widgets
* DEF_UNIT, property is used.
*
* If a value of 'auto' is used, then an empty String is instead
* returned.
*
* @attribute width
* @default '400px'
* @type {String|Number}
*/
width: {
value: '400px',
setter: function(value) {
if (value === 'auto') {
return '';
}
return value;
}
}
});
M.core.dialogue = DIALOGUE;