@samitouri / QOS-React-2 / commits / 37fc21f1e8

Use 0 instead of null in property config

We're using this value to check bits and null is 0 in that sense anyway. This shaves off a few bytes (though as expected, gzip is virtually unchanged)

Paul O’Shannessy committed Mar 9, 2016 at 13:45 UTC 37fc21f1e899622633d6f5e3cb069f1541631874
2 files changed +216 -216
src/renderers/dom/shared/HTMLDOMPropertyConfig.js
+111 -111
@@ -30,176 +30,176 @@ var HTMLDOMPropertyConfig = {
30 /**
31 * Standard Properties
32 */
33 - accept: null,
34 - acceptCharset: null,
35 - accessKey: null,
36 - action: null,
33 + accept: 0,
34 + acceptCharset: 0,
35 + accessKey: 0,
36 + action: 0,
37 allowFullScreen: HAS_BOOLEAN_VALUE,
38 - allowTransparency: null,
39 - alt: null,
38 + allowTransparency: 0,
39 + alt: 0,
40 async: HAS_BOOLEAN_VALUE,
41 - autoComplete: null,
41 + autoComplete: 0,
42 // autoFocus is polyfilled/normalized by AutoFocusUtils
43 // autoFocus: HAS_BOOLEAN_VALUE,
44 autoPlay: HAS_BOOLEAN_VALUE,
45 capture: HAS_BOOLEAN_VALUE,
46 - cellPadding: null,
47 - cellSpacing: null,
48 - charSet: null,
49 - challenge: null,
46 + cellPadding: 0,
47 + cellSpacing: 0,
48 + charSet: 0,
49 + challenge: 0,
50 checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
51 - cite: null,
52 - classID: null,
53 - className: null,
51 + cite: 0,
52 + classID: 0,
53 + className: 0,
54 cols: HAS_POSITIVE_NUMERIC_VALUE,
55 - colSpan: null,
56 - content: null,
57 - contentEditable: null,
58 - contextMenu: null,
55 + colSpan: 0,
56 + content: 0,
57 + contentEditable: 0,
58 + contextMenu: 0,
59 controls: HAS_BOOLEAN_VALUE,
60 - coords: null,
61 - crossOrigin: null,
62 - data: null, // For `<object />` acts as `src`.
63 - dateTime: null,
60 + coords: 0,
61 + crossOrigin: 0,
62 + data: 0, // For `<object />` acts as `src`.
63 + dateTime: 0,
64 default: HAS_BOOLEAN_VALUE,
65 defer: HAS_BOOLEAN_VALUE,
66 - dir: null,
66 + dir: 0,
67 disabled: HAS_BOOLEAN_VALUE,
68 download: HAS_OVERLOADED_BOOLEAN_VALUE,
69 - draggable: null,
70 - encType: null,
71 - form: null,
72 - formAction: null,
73 - formEncType: null,
74 - formMethod: null,
69 + draggable: 0,
70 + encType: 0,
71 + form: 0,
72 + formAction: 0,
73 + formEncType: 0,
74 + formMethod: 0,
75 formNoValidate: HAS_BOOLEAN_VALUE,
76 - formTarget: null,
77 - frameBorder: null,
78 - headers: null,
79 - height: null,
76 + formTarget: 0,
77 + frameBorder: 0,
78 + headers: 0,
79 + height: 0,
80 hidden: HAS_BOOLEAN_VALUE,
81 - high: null,
82 - href: null,
83 - hrefLang: null,
84 - htmlFor: null,
85 - httpEquiv: null,
86 - icon: null,
87 - id: null,
88 - inputMode: null,
89 - integrity: null,
90 - is: null,
91 - keyParams: null,
92 - keyType: null,
93 - kind: null,
94 - label: null,
95 - lang: null,
96 - list: null,
81 + high: 0,
82 + href: 0,
83 + hrefLang: 0,
84 + htmlFor: 0,
85 + httpEquiv: 0,
86 + icon: 0,
87 + id: 0,
88 + inputMode: 0,
89 + integrity: 0,
90 + is: 0,
91 + keyParams: 0,
92 + keyType: 0,
93 + kind: 0,
94 + label: 0,
95 + lang: 0,
96 + list: 0,
97 loop: HAS_BOOLEAN_VALUE,
98 - low: null,
99 - manifest: null,
100 - marginHeight: null,
101 - marginWidth: null,
102 - max: null,
103 - maxLength: null,
104 - media: null,
105 - mediaGroup: null,
106 - method: null,
107 - min: null,
108 - minLength: null,
98 + low: 0,
99 + manifest: 0,
100 + marginHeight: 0,
101 + marginWidth: 0,
102 + max: 0,
103 + maxLength: 0,
104 + media: 0,
105 + mediaGroup: 0,
106 + method: 0,
107 + min: 0,
108 + minLength: 0,
109 // Caution; `option.selected` is not updated if `select.multiple` is
110 // disabled with `removeAttribute`.
111 multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
112 muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
113 - name: null,
114 - nonce: null,
113 + name: 0,
114 + nonce: 0,
115 noValidate: HAS_BOOLEAN_VALUE,
116 open: HAS_BOOLEAN_VALUE,
117 - optimum: null,
118 - pattern: null,
119 - placeholder: null,
120 - poster: null,
121 - preload: null,
122 - profile: null,
123 - radioGroup: null,
117 + optimum: 0,
118 + pattern: 0,
119 + placeholder: 0,
120 + poster: 0,
121 + preload: 0,
122 + profile: 0,
123 + radioGroup: 0,
124 readOnly: HAS_BOOLEAN_VALUE,
125 - rel: null,
125 + rel: 0,
126 required: HAS_BOOLEAN_VALUE,
127 reversed: HAS_BOOLEAN_VALUE,
128 - role: null,
128 + role: 0,
129 rows: HAS_POSITIVE_NUMERIC_VALUE,
130 rowSpan: HAS_NUMERIC_VALUE,
131 - sandbox: null,
132 - scope: null,
131 + sandbox: 0,
132 + scope: 0,
133 scoped: HAS_BOOLEAN_VALUE,
134 - scrolling: null,
134 + scrolling: 0,
135 seamless: HAS_BOOLEAN_VALUE,
136 selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
137 - shape: null,
137 + shape: 0,
138 size: HAS_POSITIVE_NUMERIC_VALUE,
139 - sizes: null,
139 + sizes: 0,
140 span: HAS_POSITIVE_NUMERIC_VALUE,
141 - spellCheck: null,
142 - src: null,
143 - srcDoc: null,
144 - srcLang: null,
145 - srcSet: null,
141 + spellCheck: 0,
142 + src: 0,
143 + srcDoc: 0,
144 + srcLang: 0,
145 + srcSet: 0,
146 start: HAS_NUMERIC_VALUE,
147 - step: null,
148 - style: null,
149 - summary: null,
150 - tabIndex: null,
151 - target: null,
152 - title: null,
147 + step: 0,
148 + style: 0,
149 + summary: 0,
150 + tabIndex: 0,
151 + target: 0,
152 + title: 0,
153 // Setting .type throws on non-<input> tags
154 - type: null,
155 - useMap: null,
154 + type: 0,
155 + useMap: 0,
156 value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
157 - width: null,
158 - wmode: null,
159 - wrap: null,
157 + width: 0,
158 + wmode: 0,
159 + wrap: 0,
160
161 /**
162 * RDFa Properties
163 */
164 - about: null,
165 - datatype: null,
166 - inlist: null,
167 - prefix: null,
164 + about: 0,
165 + datatype: 0,
166 + inlist: 0,
167 + prefix: 0,
168 // property is also supported for OpenGraph in meta tags.
169 - property: null,
170 - resource: null,
171 - typeof: null,
172 - vocab: null,
169 + property: 0,
170 + resource: 0,
171 + typeof: 0,
172 + vocab: 0,
173
174 /**
175 * Non-standard Properties
176 */
177 // autoCapitalize and autoCorrect are supported in Mobile Safari for
178 // keyboard hints.
179 - autoCapitalize: null,
180 - autoCorrect: null,
179 + autoCapitalize: 0,
180 + autoCorrect: 0,
181 // autoSave allows WebKit/Blink to persist values of input fields on page reloads
182 - autoSave: null,
182 + autoSave: 0,
183 // color is for Safari mask-icon link
184 - color: null,
184 + color: 0,
185 // itemProp, itemScope, itemType are for
186 // Microdata support. See http://schema.org/docs/gs.html
187 - itemProp: null,
187 + itemProp: 0,
188 itemScope: HAS_BOOLEAN_VALUE,
189 - itemType: null,
189 + itemType: 0,
190 // itemID and itemRef are for Microdata support as well but
191 // only specified in the WHATWG spec document. See
192 // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
193 - itemID: null,
194 - itemRef: null,
193 + itemID: 0,
194 + itemRef: 0,
195 // results show looking glass icon and recent searches on input
196 // search fields in WebKit/Blink
197 - results: null,
197 + results: 0,
198 // IE-only attribute that specifies security restrictions on an iframe
199 // as an alternative to the sandbox attribute on IE<10
200 - security: null,
200 + security: 0,
201 // IE-only attribute that controls focus behavior
202 - unselectable: null,
202 + unselectable: 0,
203 },
204 DOMAttributeNames: {
205 acceptCharset: 'accept-charset',
src/renderers/dom/shared/SVGDOMPropertyConfig.js
+105 -105
@@ -21,63 +21,63 @@ var NS = {
21
22 var ATTRS = {
23 accentHeight: 'accent-height',
24 - accumulate: null,
25 - additive: null,
24 + accumulate: 0,
25 + additive: 0,
26 alignmentBaseline: 'alignment-baseline',
27 allowReorder: 'allowReorder',
28 - alphabetic: null,
29 - amplitude: null,
28 + alphabetic: 0,
29 + amplitude: 0,
30 arabicForm: 'arabic-form',
31 - ascent: null,
31 + ascent: 0,
32 attributeName: 'attributeName',
33 attributeType: 'attributeType',
34 autoReverse: 'autoReverse',
35 - azimuth: null,
35 + azimuth: 0,
36 baseFrequency: 'baseFrequency',
37 baseProfile: 'baseProfile',
38 baselineShift: 'baseline-shift',
39 - bbox: null,
40 - begin: null,
41 - bias: null,
42 - by: null,
39 + bbox: 0,
40 + begin: 0,
41 + bias: 0,
42 + by: 0,
43 calcMode: 'calcMode',
44 capHeight: 'cap-height',
45 - class: null,
46 - clip: null,
45 + class: 0,
46 + clip: 0,
47 clipPath: 'clip-path',
48 clipRule: 'clip-rule',
49 clipPathUnits: 'clipPathUnits',
50 - color: null,
50 + color: 0,
51 colorInterpolation: 'color-interpolation',
52 colorInterpolationFilters: 'color-interpolation-filters',
53 colorProfile: 'color-profile',
54 colorRendering: 'color-rendering',
55 contentScriptType: 'contentScriptType',
56 contentStyleType: 'contentStyleType',
57 - cursor: null,
58 - cx: null,
59 - cy: null,
60 - d: null,
61 - decelerate: null,
62 - descent: null,
57 + cursor: 0,
58 + cx: 0,
59 + cy: 0,
60 + d: 0,
61 + decelerate: 0,
62 + descent: 0,
63 diffuseConstant: 'diffuseConstant',
64 - direction: null,
65 - display: null,
66 - divisor: null,
64 + direction: 0,
65 + display: 0,
66 + divisor: 0,
67 dominantBaseline: 'dominant-baseline',
68 - dur: null,
69 - dx: null,
70 - dy: null,
68 + dur: 0,
69 + dx: 0,
70 + dy: 0,
71 edgeMode: 'edgeMode',
72 - elevation: null,
72 + elevation: 0,
73 enableBackground: 'enable-background',
74 - end: null,
75 - exponent: null,
74 + end: 0,
75 + exponent: 0,
76 externalResourcesRequired: 'externalResourcesRequired',
77 - fill: null,
77 + fill: 0,
78 fillOpacity: 'fill-opacity',
79 fillRule: 'fill-rule',
80 - filter: null,
80 + filter: 0,
81 filterRes: 'filterRes',
82 filterUnits: 'filterUnits',
83 floodColor: 'flood-color',
@@ -89,70 +89,70 @@ var ATTRS = {
89 fontStyle: 'font-style',
90 fontVariant: 'font-variant',
91 fontWeight: 'font-weight',
92 - format: null,
93 - from: null,
94 - fx: null,
95 - fy: null,
96 - g1: null,
97 - g2: null,
92 + format: 0,
93 + from: 0,
94 + fx: 0,
95 + fy: 0,
96 + g1: 0,
97 + g2: 0,
98 glyphName: 'glyph-name',
99 glyphOrientationHorizontal: 'glyph-orientation-horizontal',
100 glyphOrientationVertical: 'glyph-orientation-vertical',
101 glyphRef: 'glyphRef',
102 gradientTransform: 'gradientTransform',
103 gradientUnits: 'gradientUnits',
104 - hanging: null,
105 - height: null,
104 + hanging: 0,
105 + height: 0,
106 horizAdvX: 'horiz-adv-x',
107 horizOriginX: 'horiz-origin-x',
108 - id: null,
109 - ideographic: null,
108 + id: 0,
109 + ideographic: 0,
110 imageRendering: 'image-rendering',
111 - in: null,
112 - in2: null,
113 - intercept: null,
114 - k: null,
115 - k1: null,
116 - k2: null,
117 - k3: null,
118 - k4: null,
111 + in: 0,
112 + in2: 0,
113 + intercept: 0,
114 + k: 0,
115 + k1: 0,
116 + k2: 0,
117 + k3: 0,
118 + k4: 0,
119 kernelMatrix: 'kernelMatrix',
120 kernelUnitLength: 'kernelUnitLength',
121 - kerning: null,
121 + kerning: 0,
122 keyPoints: 'keyPoints',
123 keySplines: 'keySplines',
124 keyTimes: 'keyTimes',
125 - lang: null,
125 + lang: 0,
126 lengthAdjust: 'lengthAdjust',
127 letterSpacing: 'letter-spacing',
128 lightingColor: 'lighting-color',
129 limitingConeAngle: 'limitingConeAngle',
130 - local: null,
130 + local: 0,
131 markerEnd: 'marker-end',
132 markerMid: 'marker-mid',
133 markerStart: 'marker-start',
134 markerHeight: 'markerHeight',
135 markerUnits: 'markerUnits',
136 markerWidth: 'markerWidth',
137 - mask: null,
137 + mask: 0,
138 maskContentUnits: 'maskContentUnits',
139 maskUnits: 'maskUnits',
140 - mathematical: null,
141 - max: null,
142 - media: null,
143 - method: null,
144 - min: null,
145 - mode: null,
146 - name: null,
140 + mathematical: 0,
141 + max: 0,
142 + media: 0,
143 + method: 0,
144 + min: 0,
145 + mode: 0,
146 + name: 0,
147 numOctaves: 'numOctaves',
148 - offset: null,
149 - opacity: null,
150 - operator: null,
151 - order: null,
152 - orient: null,
153 - orientation: null,
154 - origin: null,
155 - overflow: null,
148 + offset: 0,
149 + opacity: 0,
150 + operator: 0,
151 + order: 0,
152 + orient: 0,
153 + orientation: 0,
154 + origin: 0,
155 + overflow: 0,
156 overlinePosition: 'overline-position',
157 overlineThickness: 'overline-thickness',
158 paintOrder: 'paint-order',
@@ -162,15 +162,15 @@ var ATTRS = {
162 patternTransform: 'patternTransform',
163 patternUnits: 'patternUnits',
164 pointerEvents: 'pointer-events',
165 - points: null,
165 + points: 0,
166 pointsAtX: 'pointsAtX',
167 pointsAtY: 'pointsAtY',
168 pointsAtZ: 'pointsAtZ',
169 preserveAlpha: 'preserveAlpha',
170 preserveAspectRatio: 'preserveAspectRatio',
171 primitiveUnits: 'primitiveUnits',
172 - r: null,
173 - radius: null,
172 + r: 0,
173 + radius: 0,
174 refX: 'refX',
175 refY: 'refY',
176 renderingIntent: 'rendering-intent',
@@ -178,31 +178,31 @@ var ATTRS = {
178 repeatDur: 'repeatDur',
179 requiredExtensions: 'requiredExtensions',
180 requiredFeatures: 'requiredFeatures',
181 - restart: null,
182 - result: null,
183 - rotate: null,
184 - rx: null,
185 - ry: null,
186 - scale: null,
187 - seed: null,
181 + restart: 0,
182 + result: 0,
183 + rotate: 0,
184 + rx: 0,
185 + ry: 0,
186 + scale: 0,
187 + seed: 0,
188 shapeRendering: 'shape-rendering',
189 - slope: null,
190 - spacing: null,
189 + slope: 0,
190 + spacing: 0,
191 specularConstant: 'specularConstant',
192 specularExponent: 'specularExponent',
193 - speed: null,
193 + speed: 0,
194 spreadMethod: 'spreadMethod',
195 startOffset: 'startOffset',
196 stdDeviation: 'stdDeviation',
197 - stemh: null,
198 - stemv: null,
197 + stemh: 0,
198 + stemv: 0,
199 stitchTiles: 'stitchTiles',
200 stopColor: 'stop-color',
201 stopOpacity: 'stop-opacity',
202 strikethroughPosition: 'strikethrough-position',
203 strikethroughThickness: 'strikethrough-thickness',
204 - string: null,
205 - stroke: null,
204 + string: 0,
205 + stroke: 0,
206 strokeDasharray: 'stroke-dasharray',
207 strokeDashoffset: 'stroke-dashoffset',
208 strokeLinecap: 'stroke-linecap',
@@ -210,25 +210,25 @@ var ATTRS = {
210 strokeMiterlimit: 'stroke-miterlimit',
211 strokeOpacity: 'stroke-opacity',
212 strokeWidth: 'stroke-width',
213 - style: null,
213 + style: 0,
214 surfaceScale: 'surfaceScale',
215 systemLanguage: 'systemLanguage',
216 tableValues: 'tableValues',
217 - target: null,
217 + target: 0,
218 targetX: 'targetX',
219 targetY: 'targetY',
220 textAnchor: 'text-anchor',
221 textDecoration: 'text-decoration',
222 textRendering: 'text-rendering',
223 textLength: 'textLength',
224 - to: null,
225 - transform: null,
226 - type: null,
227 - u1: null,
228 - u2: null,
224 + to: 0,
225 + transform: 0,
226 + type: 0,
227 + u1: 0,
228 + u2: 0,
229 underlinePosition: 'underline-position',
230 underlineThickness: 'underline-thickness',
231 - unicode: null,
231 + unicode: 0,
232 unicodeBidi: 'unicode-bidi',
233 unicodeRange: 'unicode-range',
234 unitsPerEm: 'units-per-em',
@@ -236,22 +236,22 @@ var ATTRS = {
236 vHanging: 'v-hanging',
237 vIdeographic: 'v-ideographic',
238 vMathematical: 'v-mathematical',
239 - values: null,
240 - version: null,
239 + values: 0,
240 + version: 0,
241 vertAdvY: 'vert-adv-y',
242 vertOriginX: 'vert-origin-x',
243 vertOriginY: 'vert-origin-y',
244 viewBox: 'viewBox',
245 viewTarget: 'viewTarget',
246 - visibility: null,
247 - width: null,
248 - widths: null,
246 + visibility: 0,
247 + width: 0,
248 + widths: 0,
249 wordSpacing: 'word-spacing',
250 writingMode: 'writing-mode',
251 - x: null,
251 + x: 0,
252 xHeight: 'x-height',
253 - x1: null,
254 - x2: null,
253 + x1: 0,
254 + x2: 0,
255 xChannelSelector: 'xChannelSelector',
256 xlinkActuate: 'xlink:actuate',
257 xlinkArcrole: 'xlink:arcrole',
@@ -263,11 +263,11 @@ var ATTRS = {
263 xmlBase: 'xml:base',
264 xmlLang: 'xml:lang',
265 xmlSpace: 'xml:space',
266 - y: null,
267 - y1: null,
268 - y2: null,
266 + y: 0,
267 + y1: 0,
268 + y2: 0,
269 yChannelSelector: 'yChannelSelector',
270 - z: null,
270 + z: 0,
271 zoomAndPan: 'zoomAndPan',
272 };
273
@@ -289,7 +289,7 @@ var SVGDOMPropertyConfig = {
289 };
290
291 Object.keys(ATTRS).map((key) => {
292 - SVGDOMPropertyConfig.Properties[key] = null;
292 + SVGDOMPropertyConfig.Properties[key] = 0;
293 if (ATTRS[key]) {
294 SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key];
295 }