@@ -4,177 +4,168 @@ title: measurements
4
4
5
5
# measurements
6
6
7
- <a name =" module_measurements " ></a >
8
-
9
- ## measurements
10
- Handle element's width and height calculations so that, when an element's visibility changes, parent element's dimensions can be properly transitioned
11
-
12
-
13
- * [ measurements] ( #module_measurements )
14
- * [ ~ measured] ( #module_measurements..measured )
15
- * [ ~ validateDimension(dimension)] ( #module_measurements..validateDimension )
16
- * [ ~ getMarginNumericValue(margin)] ( #module_measurements..getMarginNumericValue ) ⇒
17
- * [ ~ getVertMargin(margins, arrLength)] ( #module_measurements..getVertMargin ) ⇒
18
- * [ ~ getHorizMargin(margins, arrLength)] ( #module_measurements..getHorizMargin ) ⇒
19
- * [ ~ getElementMargins(element, axis)] ( #module_measurements..getElementMargins ) ⇒
20
- * [ ~ getElementMeasure(element, dimension)] ( #module_measurements..getElementMeasure ) ⇒
21
- * [ ~ getParentMeasure(element, dimension)] ( #module_measurements..getParentMeasure ) ⇒
22
- * [ ~ getParentMeasures(element)] ( #module_measurements..getParentMeasures ) ⇒
23
- * [ ~ setDimensionMax(element, dimension, value)] ( #module_measurements..setDimensionMax )
24
- * [ ~ removeDimensionMax(element, dimension)] ( #module_measurements..removeDimensionMax )
25
- * [ ~ setParentMaxMeasures(args)] ( #module_measurements..setParentMaxMeasures )
26
- * [ ~ DimensionsMeasurements] ( #module_measurements..DimensionsMeasurements ) : <code >Object</code >
27
-
28
- <a name =" module_measurements..measured " ></a >
29
-
30
- ### measurements~ measured
7
+ ## measurements.js
8
+
9
+ Handle element's width and height calculations
10
+ so that, when an element's visibility changes,
11
+ parent element's dimensions can be properly transitioned
12
+
13
+ - [ measurements] ( #measurements )
14
+ - [ measured] ( #measured )
15
+ - [ validateDimension(dimension)] ( #validatedimension-dimension )
16
+ - [ getMarginNumericValue(margin)] ( #getmarginnumericvalue-margin )
17
+ - [ getVertMargin(margins, arrLength)] ( #getvertmargin-margins-arrlength )
18
+ - [ getHorizMargin(margins, arrLength)] ( #gethorizmargin-margins-arrlength )
19
+ - [ getElementMargins(element, axis)] ( #getelementmargins-element-axis )
20
+ - [ getElementMeasure(element, dimension)] ( #getelementmeasure-element-dimension )
21
+ - [ getParentMeasure(element, dimension)] ( #getparentmeasure-element-dimension )
22
+ - [ getParentMeasures(element)] ( #getparentmeasures-element )
23
+ - [ setDimensionMax(element, dimension, value)] ( #setdimensionmax-element-dimension-value )
24
+ - [ removeDimensionMax(element, dimension)] ( #removedimensionmax-element-dimension )
25
+ - [ setParentMaxMeasures(args)] ( #setparentmaxmeasures-args )
26
+ - [ DimensionsMeasurements] ( #dimensionsmeasurements ) : <code >Object</code >
27
+
28
+ ### measured
29
+
31
30
Tracks whether the parent's element measurement should be before or after the element is set to 'display: none'
32
31
33
- ** Kind** : inner constant of [ <code >measurements</code >] ( #module_measurements )
34
- <a name =" module_measurements..validateDimension " ></a >
32
+ ** Kind** : inner constant of [ <code >measurements</code >] ( #measurements )
33
+
34
+ ### validateDimension(dimension)
35
35
36
- ### measurements~ validateDimension(dimension)
37
36
Throws a ReferenceError if 'dimension' is neither 'width' nor 'height'
38
37
39
- ** Kind** : inner method of [ <code >measurements</code >] ( #module_measurements )
38
+ ** Kind** : inner method of [ <code >measurements</code >] ( #measurements )
40
39
41
- | Param | Type | Description |
42
- | --- | --- | --- |
40
+ | Param | Type | Description |
41
+ | --------- | ------------------- | ----------------------- --- |
43
42
| dimension | <code >string</code > | Either 'width' or 'height' |
44
43
45
- < a name = " module_measurements.. getMarginNumericValue" ></ a >
44
+ ### getMarginNumericValue(margin)
46
45
47
- ### measurements~ getMarginNumericValue(margin) ⇒
48
46
Returns only the numeric part of the margin property
49
47
50
- ** Kind** : inner method of [ <code >measurements</code >] ( #module_measurements )
51
- ** Returns** : Margin value without unit
48
+ ** Kind** : inner method of [ <code >measurements</code >] ( #measurements )
49
+ ** Returns** : Margin value without unit
52
50
53
- | Param | Type | Description |
54
- | --- | --- | --- |
51
+ | Param | Type | Description |
52
+ | ------ | ------------------- | ----------------------------- --- |
55
53
| margin | <code >string</code > | Margin value along with its unit |
56
54
57
- < a name = " module_measurements.. getVertMargin" ></ a >
55
+ ### getVertMargin(margins, arrLength)
58
56
59
- ### measurements~ getVertMargin(margins, arrLength) ⇒
60
57
Calculates the total margin of an element in the vertical axis
61
58
62
- ** Kind** : inner method of [ <code >measurements</code >] ( #module_measurements )
63
- ** Returns** : The sum of top-margin and bottom-margin
59
+ ** Kind** : inner method of [ <code >measurements</code >] ( #measurements )
60
+ ** Returns** : The sum of top-margin and bottom-margin
64
61
65
- | Param | Type | Description |
66
- | --- | --- | --- |
67
- | margins | <code >Array.< ; string> ; </code > | Array containing an element's margin values |
68
- | arrLength | <code >number</code > | Number of values declared in the CSS margin property |
62
+ | Param | Type | Description |
63
+ | --------- | --------------------------------- | ------------------------------------------------- --- |
64
+ | margins | <code >Array.< ; string> ; </code > | Array containing an element's margin values |
65
+ | arrLength | <code >number</code > | Number of values declared in the CSS margin property |
69
66
70
- < a name = " module_measurements.. getHorizMargin" ></ a >
67
+ ### getHorizMargin(margins, arrLength)
71
68
72
- ### measurements~ getHorizMargin(margins, arrLength) ⇒
73
69
Calculates the total margin of an element in the horizontal axis
74
70
75
- ** Kind** : inner method of [ <code >measurements</code >] ( #module_measurements )
76
- ** Returns** : The sum of left-margin and right-margin
71
+ ** Kind** : inner method of [ <code >measurements</code >] ( #measurements )
72
+ ** Returns** : The sum of left-margin and right-margin
77
73
78
- | Param | Type | Description |
79
- | --- | --- | --- |
80
- | margins | <code >Array.< ; string> ; </code > | Array containing an element's margin values |
81
- | arrLength | <code >number</code > | Number of values declared in the CSS margin property |
74
+ | Param | Type | Description |
75
+ | --------- | --------------------------------- | ------------------------------------------------- --- |
76
+ | margins | <code >Array.< ; string> ; </code > | Array containing an element's margin values |
77
+ | arrLength | <code >number</code > | Number of values declared in the CSS margin property |
82
78
83
- < a name = " module_measurements.. getElementMargins" ></ a >
79
+ ### getElementMargins(element, axis)
84
80
85
- ### measurements~ getElementMargins(element, axis) ⇒
86
81
Element's total margin in a given axis
87
82
88
- ** Kind** : inner method of [ <code >measurements</code >] ( #module_measurements )
89
- ** Returns** : Total margin in a given axis
83
+ ** Kind** : inner method of [ <code >measurements</code >] ( #measurements )
84
+ ** Returns** : Total margin in a given axis
90
85
91
- | Param | Type | Description |
92
- | --- | --- | --- |
86
+ | Param | Type | Description |
87
+ | ------- | ------------------------ | -------------------------------------- --- |
93
88
| element | <code >HTMLElement</code > | The DOM element to calculate margins from |
94
- | axis | <code >string</code > | 'horizontal' or 'vertical' margins |
89
+ | axis | <code >string</code > | 'horizontal' or 'vertical' margins |
95
90
96
- < a name = " module_measurements.. getElementMeasure" ></ a >
91
+ ### getElementMeasure(element, dimension)
97
92
98
- ### measurements~ getElementMeasure(element, dimension) ⇒
99
93
Calculates the total width or height of an element
100
94
101
- ** Kind** : inner method of [ <code >measurements</code >] ( #module_measurements )
102
- ** Returns** : The total dimension of an element, including its margins
95
+ ** Kind** : inner method of [ <code >measurements</code >] ( #measurements )
96
+ ** Returns** : The total dimension of an element, including its margins
103
97
104
- | Param | Type | Description |
105
- | --- | --- | --- |
106
- | element | <code >HTMLElement</code > | The Dom element to measure |
107
- | dimension | <code >string</code > | Either 'width' or 'height' |
98
+ | Param | Type | Description |
99
+ | --------- | ------------------------ | ----------------------- --- |
100
+ | element | <code >HTMLElement</code > | The Dom element to measure |
101
+ | dimension | <code >string</code > | Either 'width' or 'height' |
108
102
109
- < a name = " module_measurements.. getParentMeasure" ></ a >
103
+ ### getParentMeasure(element, dimension)
110
104
111
- ### measurements~ getParentMeasure(element, dimension) ⇒
112
105
Calculates the element's parent dimension before and after 'element' is set to 'display: none'
113
106
114
- ** Kind** : inner method of [ <code >measurements</code >] ( #module_measurements )
115
- ** Returns** : An object containing the parent element's dimension before and after the child element is set to 'display: none'
107
+ ** Kind** : inner method of [ <code >measurements</code >] ( #measurements )
108
+ ** Returns** : An object containing the parent element's dimension before and after the child element is set to 'display: none'
116
109
117
- | Param | Type | Description |
118
- | --- | --- | --- |
119
- | element | <code >HTMLElement</code > | The DOM element from which the parent will be measured |
120
- | dimension | <code >string</code > | Either 'width' or 'height' |
110
+ | Param | Type | Description |
111
+ | --------- | ------------------------ | --------------------------------------------------- --- |
112
+ | element | <code >HTMLElement</code > | The DOM element from which the parent will be measured |
113
+ | dimension | <code >string</code > | Either 'width' or 'height' |
121
114
122
- < a name = " module_measurements.. getParentMeasures" ></ a >
115
+ ### getParentMeasures(element)
123
116
124
- ### measurements ~ getParentMeasures( element) ⇒
125
- Calculates the width and height of an element's parent, before and after the element is set to 'display: none'
117
+ Calculates the width and height of an element's parent,
118
+ before and after the element is set to 'display: none'
126
119
127
- ** Kind** : inner method of [ <code >measurements</code >] ( #module_measurements )
128
- ** Returns** : An object with the width and height of the parent element
120
+ ** Kind** : inner method of [ <code >measurements</code >] ( #measurements )
121
+ ** Returns** : An object with the width and height of the parent element
129
122
130
- | Param | Type | Description |
131
- | --- | --- | --- |
123
+ | Param | Type | Description |
124
+ | ------- | ------------------------ | -------------------------------------------------- --- |
132
125
| element | <code >HTMLElement</code > | The DOM element to get the parent's measurements from |
133
126
134
- < a name = " module_measurements.. setDimensionMax" ></ a >
127
+ ### setDimensionMax(element, dimension, value)
135
128
136
- ### measurements~ setDimensionMax(element, dimension, value)
137
129
Sets the element's 'max-width' or 'max-height' CSS property
138
130
139
- ** Kind** : inner method of [ <code >measurements</code >] ( #module_measurements )
131
+ ** Kind** : inner method of [ <code >measurements</code >] ( #measurements )
140
132
141
- | Param | Type | Description |
142
- | --- | --- | --- |
143
- | element | <code >HTMLElement</code > \| <code >null</code > | The DOM element to set max-width or max-height value |
144
- | dimension | <code >string</code > | Either 'width' or 'height' |
145
- | value | <code >string</code > | The CSS property value, in pixels |
133
+ | Param | Type | Description |
134
+ | --------- | --------------------------------------------- | ------------------------------------------------- --- |
135
+ | element | <code >HTMLElement</code > \| <code >null</code > | The DOM element to set max-width or max-height value |
136
+ | dimension | <code >string</code > | Either 'width' or 'height' |
137
+ | value | <code >string</code > | The CSS property value, in pixels |
146
138
147
- < a name = " module_measurements.. removeDimensionMax" ></ a >
139
+ ### removeDimensionMax(element, dimension)
148
140
149
- ### measurements~ removeDimensionMax(element, dimension)
150
141
Removes the element's 'max-width' or 'max-height' CSS property
151
142
152
- ** Kind** : inner method of [ <code >measurements</code >] ( #module_measurements )
143
+ ** Kind** : inner method of [ <code >measurements</code >] ( #measurements )
153
144
154
- | Param | Type | Description |
155
- | --- | --- | --- |
156
- | element | <code >HTMLElement</code > \| <code >null</code > | The DOM element to set max-width or max-height value |
157
- | dimension | <code >string</code > | Either 'width' or 'height' |
145
+ | Param | Type | Description |
146
+ | --------- | --------------------------------------------- | ------------------------------------------------- --- |
147
+ | element | <code >HTMLElement</code > \| <code >null</code > | The DOM element to set max-width or max-height value |
148
+ | dimension | <code >string</code > | Either 'width' or 'height' |
158
149
159
- < a name = " module_measurements.. setParentMaxMeasures" ></ a >
150
+ ### setParentMaxMeasures(args)
160
151
161
- ### measurements~ setParentMaxMeasures(args)
162
- Sets element's parent's 'max-width' or 'max-height' property. If 'dimension' is undefined or different from 'all', 'width' or 'height', no property will be set.
152
+ Sets element's parent's 'max-width' or 'max-height' property.
163
153
164
- ** Kind** : inner method of [ <code >measurements</code >] ( #module_measurements )
154
+ If 'dimension' is undefined or different from 'all', 'width' or 'height',
155
+ no property will be set.
165
156
166
- | Param | Type | Description |
167
- | --- | --- | --- |
168
- | args | <code >Object</code > | Object containing all the information needed |
157
+ ** Kind** : inner method of [ <code >measurements</code >] ( #measurements )
169
158
170
- <a name =" module_measurements..DimensionsMeasurements " ></a >
159
+ | Param | Type | Description |
160
+ | ----- | ------------------- | -------------------------------------------- |
161
+ | args | <code >Object</code > | Object containing all the information needed |
171
162
172
- ### measurements~ DimensionsMeasurements : <code >Object</code >
173
- ** Kind** : inner typedef of [ <code >measurements</code >] ( #module_measurements )
163
+ ### DimensionsMeasurements : <code >Object</code >
164
+
165
+ ** Kind** : inner typedef of [ <code >measurements</code >] ( #measurements )
174
166
** Properties**
175
167
176
- | Name | Type | Description |
177
- | --- | --- | --- |
168
+ | Name | Type | Description |
169
+ | ------ | ------------------- | ---------------------------------------------------------------------- --- |
178
170
| height | <code >Object</code > | Element's height before and after child element is set to 'display: none' |
179
- | width | <code >Object</code > | Element's width before and after child element is set to 'display: none' |
180
-
171
+ | width | <code >Object</code > | Element's width before and after child element is set to 'display: none' |
0 commit comments