maquette 4.1.3 → 4.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,531 +0,0 @@
1
- (function (global) {
2
-
3
- "use strict";
4
-
5
- // Test if 'Object.defineProperty' can be used (IE8 has wrong implementation)
6
- var object_defineProperty = true;
7
- try
8
- {
9
- Object.defineProperty({}, "x", {});
10
- }
11
- catch(e)
12
- {
13
- object_defineProperty = false;
14
- }
15
-
16
- // polyfill for window.requestAnimationFrame
17
- (function ()
18
- {
19
- var lastTime = 0;
20
- var vendors = ['webkit', 'moz'];
21
- for(var x = 0; x < vendors.length && !global.requestAnimationFrame; ++x)
22
- {
23
- global.requestAnimationFrame = global[vendors[x] + 'RequestAnimationFrame'];
24
- global.cancelAnimationFrame = global[vendors[x] + 'CancelAnimationFrame'] || global[vendors[x] + 'CancelRequestAnimationFrame'];
25
- }
26
-
27
- if(!global.requestAnimationFrame || /iP(ad|hone|od).*OS 6/.test(global.navigator.userAgent)) // Buggy iOS6
28
- global.requestAnimationFrame = function (callback, element)
29
- {
30
- var currTime = new Date().getTime();
31
- var timeToCall = Math.max(0, 16 - (currTime - lastTime));
32
- var id = global.setTimeout(function () { callback(currTime + timeToCall); }, timeToCall);
33
- lastTime = currTime + timeToCall;
34
- return id;
35
- };
36
-
37
- if(!global.cancelAnimationFrame)
38
- global.cancelAnimationFrame = function (id)
39
- {
40
- clearTimeout(id);
41
- };
42
- }());
43
-
44
- // polyfill for Array.isArray
45
- if(!Array.isArray) {
46
- Array.isArray = function (arg) {
47
- return Object.prototype.toString.call(arg) === '[object Array]';
48
- };
49
- }
50
-
51
- // Polyfill for textContent
52
- if(!("textContent" in document.documentElement)) {
53
-
54
- (function (createElement) {
55
-
56
- var onPropertyChange = function (e) {
57
-
58
- if(e.propertyName === "textContent") {
59
- e.srcElement.innerText = e.srcElement.textContent;
60
- }
61
- };
62
-
63
- document.createElement = function (tagName) {
64
- var element = createElement(tagName);
65
- element.textContent = "";
66
- element.attachEvent("onpropertychange", onPropertyChange);
67
- return element;
68
- };
69
-
70
- })(document.createElement);
71
- }
72
-
73
- // polyfill for classList
74
- if(!("classList" in document.documentElement))
75
- {
76
- (function (join, splice, createElement)
77
- {
78
- if(object_defineProperty)
79
- {
80
- var DOMEx = function (type, message)
81
- {
82
- this.name = type;
83
- this.code = DOMException[type];
84
- this.message = message;
85
- };
86
-
87
- var strTrim = String.prototype.trim || function ()
88
- {
89
- return this.replace(/^\s+|\s+$/g, "");
90
- };
91
-
92
- var arrIndexOf = Array.prototype.indexOf || function (item)
93
- {
94
- var i = 0;
95
- var len = this.length;
96
-
97
- for(; i < len; i++)
98
- {
99
- if(i in this && this[i] === item)
100
- {
101
- return i;
102
- }
103
- }
104
-
105
- return -1;
106
- };
107
-
108
- var checkTokenAndGetIndex = function (classList, token)
109
- {
110
- if(token === "")
111
- {
112
- throw new DOMEx("SYNTAX_ERR", "An invalid or illegal string was specified");
113
- }
114
-
115
- if(/\s/.test(token))
116
- {
117
- throw new DOMEx("INVALID_CHARACTER_ERR", "String contains an invalid character");
118
- }
119
-
120
- return arrIndexOf.call(classList, token);
121
- };
122
-
123
- var classListObject = function (elem)
124
- {
125
- var trimmedClasses = strTrim.call(elem.getAttribute("class") || "");
126
- var classes = trimmedClasses ? trimmedClasses.split(/\s+/) : [];
127
- var i = 0;
128
- var len = classes.length;
129
-
130
- for(; i < len; i++)
131
- {
132
- this.push(classes[i]);
133
- }
134
-
135
- this._updateClassName = function ()
136
- {
137
- elem.setAttribute("class", this.toString());
138
- };
139
- };
140
-
141
- var classListProto = classListObject.prototype = [];
142
-
143
- classListProto.item = function (i)
144
- {
145
- return this[i] || null;
146
- };
147
-
148
- classListProto.contains = function (token)
149
- {
150
- token += "";
151
- return checkTokenAndGetIndex(this, token) !== -1;
152
- };
153
-
154
- classListProto.add = function ()
155
- {
156
- var tokens = arguments;
157
- var i = 0;
158
- var l = tokens.length;
159
- var token;
160
- var updated = false;
161
-
162
- do
163
- {
164
- token = tokens[i] + "";
165
- if(checkTokenAndGetIndex(this, token) === -1)
166
- {
167
- this.push(token);
168
- updated = true;
169
- }
170
- }
171
- while(++i < l);
172
-
173
- if(updated)
174
- {
175
- this._updateClassName();
176
- }
177
- };
178
-
179
- classListProto.remove = function ()
180
- {
181
- var tokens = arguments;
182
- var i = 0;
183
- var l = tokens.length;
184
- var token;
185
- var updated = false;
186
- var index;
187
-
188
- do
189
- {
190
- token = tokens[i] + "";
191
- index = checkTokenAndGetIndex(this, token);
192
- while(index !== -1)
193
- {
194
- this.splice(index, 1);
195
- updated = true;
196
- index = checkTokenAndGetIndex(this, token);
197
- }
198
- }
199
- while(++i < l);
200
-
201
- if(updated)
202
- {
203
- this._updateClassName();
204
- }
205
- };
206
-
207
- classListProto.toggle = function (token, force)
208
- {
209
- token += "";
210
-
211
- var result = this.contains(token);
212
- var method = result
213
- ? force !== true && "remove"
214
- : force !== false && "add";
215
-
216
- if(method)
217
- {
218
- this[method](token);
219
- }
220
-
221
- if(force === true || force === false)
222
- {
223
- return force;
224
- }
225
- else
226
- {
227
- return !result;
228
- }
229
- };
230
-
231
- classListProto.toString = function ()
232
- {
233
- return this.join(" ");
234
- };
235
-
236
- var classListGetter = function ()
237
- {
238
- return new classListObject(this);
239
- };
240
-
241
- Object.defineProperty(global.Element.prototype, "classList", {
242
- get: classListGetter,
243
- enumerable: true,
244
- configurable: true
245
- });
246
- }
247
- else
248
- {
249
- var tokenize = function (token)
250
- {
251
- if(/^-?[_a-zA-Z]+[_a-zA-Z0-9-]*$/.test(token))
252
- {
253
- return String(token);
254
- }
255
- else
256
- {
257
- throw new Error('InvalidCharacterError: DOM Exception 5');
258
- }
259
- };
260
-
261
- var toObject = function (self)
262
- {
263
- for(var index = -1, object = {}, element; element = self[++index];)
264
- {
265
- object[element] = true;
266
- }
267
-
268
- return object;
269
- };
270
-
271
- var fromObject = function (self, object)
272
- {
273
- var array = [], token;
274
-
275
- for(token in object)
276
- {
277
- if(object[token])
278
- {
279
- array.push(token);
280
- }
281
- }
282
-
283
- splice.apply(self, [0, self.length].concat(array));
284
- };
285
-
286
- document.createElement = function (tagName)
287
- {
288
- var element = createElement(tagName);
289
- var classList = [];
290
-
291
- element.classList = {
292
- add: function ()
293
- {
294
- for(var object = toObject(classList), index = 0, token; index in arguments; ++index)
295
- {
296
- token = tokenize(arguments[index]);
297
-
298
- object[token] = true;
299
- }
300
-
301
- fromObject(classList, object);
302
-
303
- element.className = join.call(classList, ' ');
304
- },
305
- remove: function ()
306
- {
307
- for(var object = toObject(classList), index = 0, token; index in arguments; ++index)
308
- {
309
- token = tokenize(arguments[index]);
310
-
311
- object[token] = false;
312
- }
313
-
314
- fromObject(classList, object);
315
-
316
- element.className = join.call(classList, ' ');
317
- }
318
- };
319
-
320
- return element;
321
- };
322
- }
323
- }(Array.prototype.join, Array.prototype.splice, document.createElement));
324
- }
325
-
326
- // Polyfill for Object.Keys
327
- // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
328
- if(!Object.keys) {
329
- Object.keys = (function () {
330
- 'use strict';
331
- var hasOwnProperty = Object.prototype.hasOwnProperty,
332
- hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'),
333
- dontEnums = [
334
- 'toString',
335
- 'toLocaleString',
336
- 'valueOf',
337
- 'hasOwnProperty',
338
- 'isPrototypeOf',
339
- 'propertyIsEnumerable',
340
- 'constructor'
341
- ],
342
- dontEnumsLength = dontEnums.length;
343
-
344
- return function (obj) {
345
- if(typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {
346
- throw new TypeError('Object.keys called on non-object');
347
- }
348
-
349
- var result = [], prop, i;
350
-
351
- for(prop in obj) {
352
- if(hasOwnProperty.call(obj, prop)) {
353
- result.push(prop);
354
- }
355
- }
356
-
357
- if(hasDontEnumBug) {
358
- for(i = 0; i < dontEnumsLength; i++) {
359
- if(hasOwnProperty.call(obj, dontEnums[i])) {
360
- result.push(dontEnums[i]);
361
- }
362
- }
363
- }
364
- return result;
365
- };
366
- }());
367
- }
368
-
369
- // Polyfill for Array.prototype.forEach
370
- // Production steps of ECMA-262, Edition 5, 15.4.4.18
371
- // Reference: http://es5.github.io/#x15.4.4.18
372
- if(!Array.prototype.forEach) {
373
-
374
- Array.prototype.forEach = function (callback, thisArg) {
375
-
376
- var T, k;
377
-
378
- if(this == null) {
379
- throw new TypeError(' this is null or not defined');
380
- }
381
-
382
- // 1. Let O be the result of calling ToObject passing the |this| value as the argument.
383
- var O = Object(this);
384
-
385
- // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length".
386
- // 3. Let len be ToUint32(lenValue).
387
- var len = O.length >>> 0;
388
-
389
- // 4. If IsCallable(callback) is false, throw a TypeError exception.
390
- // See: http://es5.github.com/#x9.11
391
- if(typeof callback !== "function") {
392
- throw new TypeError(callback + ' is not a function');
393
- }
394
-
395
- // 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
396
- if(arguments.length > 1) {
397
- T = thisArg;
398
- }
399
-
400
- // 6. Let k be 0
401
- k = 0;
402
-
403
- // 7. Repeat, while k < len
404
- while(k < len) {
405
-
406
- var kValue;
407
-
408
- // a. Let Pk be ToString(k).
409
- // This is implicit for LHS operands of the in operator
410
- // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk.
411
- // This step can be combined with c
412
- // c. If kPresent is true, then
413
- if(k in O) {
414
-
415
- // i. Let kValue be the result of calling the Get internal method of O with argument Pk.
416
- kValue = O[k];
417
-
418
- // ii. Call the Call internal method of callback with T as the this value and
419
- // argument list containing kValue, k, and O.
420
- callback.call(T, kValue, k, O);
421
- }
422
- // d. Increase k by 1.
423
- k++;
424
- }
425
- // 8. return undefined
426
- };
427
- }
428
-
429
- // Production steps of ECMA-262, Edition 5, 15.4.4.19
430
- // Reference: http://es5.github.io/#x15.4.4.19
431
- if(!Array.prototype.map) {
432
-
433
- Array.prototype.map = function (callback, thisArg) {
434
-
435
- var T, A, k;
436
-
437
- if(this == null) {
438
- throw new TypeError(' this is null or not defined');
439
- }
440
-
441
- // 1. Let O be the result of calling ToObject passing the |this|
442
- // value as the argument.
443
- var O = Object(this);
444
-
445
- // 2. Let lenValue be the result of calling the Get internal
446
- // method of O with the argument "length".
447
- // 3. Let len be ToUint32(lenValue).
448
- var len = O.length >>> 0;
449
-
450
- // 4. If IsCallable(callback) is false, throw a TypeError exception.
451
- // See: http://es5.github.com/#x9.11
452
- if(typeof callback !== 'function') {
453
- throw new TypeError(callback + ' is not a function');
454
- }
455
-
456
- // 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
457
- if(arguments.length > 1) {
458
- T = thisArg;
459
- }
460
-
461
- // 6. Let A be a new array created as if by the expression new Array(len)
462
- // where Array is the standard built-in constructor with that name and
463
- // len is the value of len.
464
- A = new Array(len);
465
-
466
- // 7. Let k be 0
467
- k = 0;
468
-
469
- // 8. Repeat, while k < len
470
- while(k < len) {
471
-
472
- var kValue, mappedValue;
473
-
474
- // a. Let Pk be ToString(k).
475
- // This is implicit for LHS operands of the in operator
476
- // b. Let kPresent be the result of calling the HasProperty internal
477
- // method of O with argument Pk.
478
- // This step can be combined with c
479
- // c. If kPresent is true, then
480
- if(k in O) {
481
-
482
- // i. Let kValue be the result of calling the Get internal
483
- // method of O with argument Pk.
484
- kValue = O[k];
485
-
486
- // ii. Let mappedValue be the result of calling the Call internal
487
- // method of callback with T as the this value and argument
488
- // list containing kValue, k, and O.
489
- mappedValue = callback.call(T, kValue, k, O);
490
-
491
- // iii. Call the DefineOwnProperty internal method of A with arguments
492
- // Pk, Property Descriptor
493
- // { Value: mappedValue,
494
- // Writable: true,
495
- // Enumerable: true,
496
- // Configurable: true },
497
- // and false.
498
-
499
- // In browsers that support Object.defineProperty, use the following:
500
- // Object.defineProperty(A, k, {
501
- // value: mappedValue,
502
- // writable: true,
503
- // enumerable: true,
504
- // configurable: true
505
- // });
506
-
507
- // For best browser support, use the following:
508
- A[k] = mappedValue;
509
- }
510
- // d. Increase k by 1.
511
- k++;
512
- }
513
-
514
- // 9. return A
515
- return A;
516
- };
517
- }
518
-
519
- if(!document.createElementNS)
520
- {
521
- (function (createElement) {
522
-
523
- document.createElementNS = function (namespace, tagName)
524
- {
525
- return createElement(tagName);
526
- }
527
-
528
- })(document.createElement);
529
- }
530
-
531
- })(this);