@@ -101,58 +101,48 @@ ALMCSS.template = function() {
101101
102102 Slot . prototype . getIntrinsicMinimumWidth = function ( ) {
103103
104- var computeIntrinsicMinimumWidth = function ( ) {
105-
106- if ( this . name === Slot . emptySlot ) {
107- return 0 ;
108- }
109- // It is a letter or '@'
110- if ( this . colspan > 1 ) {
111- return 0 ;
112- }
113- // Otherwise (it is a letter or '@' slot of a single column) we need
114- // to do some DOM manipulation to calculate its intrinsic minimumWidth
115- this . htmlElement . style . float = 'left' ;
116- var result = getComputedStyle ( this . htmlElement , 'width' ) ;
117- //this.htmlElement.style.float = 'none';
118- return result ;
119- } ;
104+ var minimumWidth = ALMCSS . width . computeIntrinsicMinimumWidth ;
120105
121106 assert ( this . htmlElement , 'For computing the intrinsic minimum width of a slot ' +
122107 'first it is needed to have done the process of moving the elements into it' ) ;
123108
124- if ( ! this . intrinsicMinimumWidth ) {
125- this . intrinsicMinimumWidth = computeIntrinsicMinimumWidth ( ) ;
109+ if ( this . intrinsicMinimumWidth ) {
110+ return this . intrinsicMinimumWidth ;
126111 }
112+
113+ if ( this . name === Slot . emptySlot ) {
114+ return 0 ;
115+ }
116+ // It is a letter or '@'
117+ if ( this . colspan > 1 ) {
118+ return 0 ;
119+ }
120+ // Otherwise (it is a letter or '@' slot of a single column) we need
121+ // to do some DOM manipulation to calculate its intrinsic minimum width
122+ this . intrinsicMinimumWidth = minimumWidth ( this . htmlElement ) ;
127123 return this . intrinsicMinimumWidth ;
128124 } ;
129125
130126 Slot . prototype . getIntrinsicPreferredWidth = function ( ) {
131127
132- var computeIntrinsicMinimumWidth = function ( ) {
133-
134- if ( this . name === Slot . emptySlot ) {
135- return 0 ;
136- }
137- // It is a letter or '@'
138- if ( this . colspan > 1 ) {
139- return 0 ;
140- }
141- // Otherwise (it is a letter or '@' slot of a single column) we need
142- // to do some DOM manipulation to calculate its intrinsic minimumWidth
143- this . htmlElement . style . float = 'left' ;
144- var result = getComputedStyle ( this . htmlElement , 'width' ) ;
145- //this.htmlElement.style.float = 'none';
146- return result ;
147- } ;
128+ var preferredWidth = ALMCSS . width . computeIntrinsicPreferredWidth ;
148129
149130 assert ( this . htmlElement , 'For computing the intrinsic minimum width of a slot ' +
150131 'first it is needed to have done the process of moving the elements into it' ) ;
151132
152- if ( ! this . intrinsicMinimumWidth ) {
153- this . intrinsicMinimumWidth = computeIntrinsicMinimumWidth ( ) ;
133+ if ( this . intrinsicPreferredWidth ) {
134+ return this . intrinsicPreferredWidth ;
154135 }
155- return this . intrinsicMinimumWidth ;
136+
137+ // The intrinsic preferred width of a '.' is 0
138+ if ( this . name === Slot . emptySlot ) {
139+ return 0 ;
140+ }
141+ // The intrinsic preferred width of a letter or '@' is the intrinsic
142+ // preferred width as defined by the CSS3 Box Module
143+ // preferred width as defined by the CSS3 Box Module
144+ this . intrinsicPreferredWidth = preferredWidth ( this . htmlElement ) ;
145+ return this . intrinsicPreferredWidth ;
156146 } ;
157147
158148 Slot . prototype . valueOf = function ( ) {
@@ -196,7 +186,7 @@ ALMCSS.template = function() {
196186 return slots [ i ] ;
197187 }
198188 }
199- } ,
189+ } ,
200190
201191 add : function ( slot ) {
202192 assert ( ! this . contains ( slot . name ) ,
0 commit comments