Skip to content

Commit 534d5e9

Browse files
author
Jordan Humphreys
committed
Fix issue with utils import.
1 parent 05624aa commit 534d5e9

File tree

8 files changed

+57
-182
lines changed

8 files changed

+57
-182
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tribute",
33
"description": "Native ES6 @mentions",
4-
"version": "2.3.5",
4+
"version": "2.3.6",
55
"main": [
66
"dist/tribute.js",
77
"dist/tribute.css"

dist/tribute.js

Lines changed: 36 additions & 96 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/tribute.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/tribute.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tributejs",
3-
"version": "2.3.5",
3+
"version": "2.3.6",
44
"description": "Native ES6 @mentions",
55
"main": "dist/tribute.js",
66
"devDependencies": {

src/Tribute.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import "./utils";
1+
import TributeUtils from "./utils";
22
import TributeEvents from "./TributeEvents";
33
import TributeMenuEvents from "./TributeMenuEvents";
44
import TributeRange from "./TributeRange";

src/utils.js

Lines changed: 15 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -21,86 +21,21 @@ if (!Array.prototype.find) {
2121
}
2222
}
2323

24-
// Production steps of ECMA-262, Edition 5, 15.4.4.21
25-
// Reference: http://es5.github.io/#x15.4.4.21
26-
// https://tc39.github.io/ecma262/#sec-array.prototype.reduce
27-
if (!Array.prototype.reduce) {
28-
Object.defineProperty(Array.prototype, 'reduce', {
29-
value: function(callback /*, initialValue*/) {
30-
if (this === null) {
31-
throw new TypeError( 'Array.prototype.reduce ' +
32-
'called on null or undefined' );
33-
}
34-
if (typeof callback !== 'function') {
35-
throw new TypeError( callback +
36-
' is not a function');
37-
}
38-
39-
// 1. Let O be ? ToObject(this value).
40-
var o = Object(this);
41-
42-
// 2. Let len be ? ToLength(? Get(O, "length")).
43-
var len = o.length >>> 0;
44-
45-
// Steps 3, 4, 5, 6, 7
46-
var k = 0;
47-
var value;
48-
49-
if (arguments.length >= 2) {
50-
value = arguments[1];
51-
} else {
52-
while (k < len && !(k in o)) {
53-
k++;
54-
}
55-
56-
// 3. If len is 0 and initialValue is not present,
57-
// throw a TypeError exception.
58-
if (k >= len) {
59-
throw new TypeError( 'Reduce of empty array ' +
60-
'with no initial value' );
61-
}
62-
value = o[k++];
63-
}
64-
65-
// 8. Repeat, while k < len
66-
while (k < len) {
67-
// a. Let Pk be ! ToString(k).
68-
// b. Let kPresent be ? HasProperty(O, Pk).
69-
// c. If kPresent is true, then
70-
// i. Let kValue be ? Get(O, Pk).
71-
// ii. Let accumulator be ? Call(
72-
// callbackfn, undefined,
73-
// « accumulator, kValue, k, O »).
74-
if (k in o) {
75-
value = callback(value, o[k], k, o);
76-
}
77-
78-
// d. Increase k by 1.
79-
k++;
80-
}
81-
82-
// 9. Return accumulator.
83-
return value;
84-
}
85-
});
86-
}
87-
88-
(function() {
89-
90-
if (typeof window.CustomEvent === "function") return false
91-
92-
function CustomEvent(event, params) {
93-
params = params || {
94-
bubbles: false,
95-
cancelable: false,
96-
detail: undefined
97-
}
98-
var evt = document.createEvent('CustomEvent')
99-
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail)
100-
return evt
24+
if (window && typeof window.CustomEvent !== "function") {
25+
function CustomEvent(event, params) {
26+
params = params || {
27+
bubbles: false,
28+
cancelable: false,
29+
detail: undefined
10130
}
31+
var evt = document.createEvent('CustomEvent')
32+
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail)
33+
return evt
34+
}
10235

103-
CustomEvent.prototype = window.Event.prototype
36+
if (typeof window.Event !== 'undefined') {
37+
CustomEvent.prototype = window.Event.prototype
38+
}
10439

105-
window.CustomEvent = CustomEvent
106-
})()
40+
window.CustomEvent = CustomEvent
41+
}

tributejs.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Type definitions for TributeJS v2.3.5
1+
// Type definitions for TributeJS v2.3.6
22
// Project: https://github.com/zurb/tribute
33
// Definitions by: Jordan Humphreys <https://github.com/mrsweaters/>
44

0 commit comments

Comments
 (0)