mirror of
https://github.com/twitter/twemoji.git
synced 2024-12-26 09:18:33 +00:00
added onerror option and test
This commit is contained in:
parent
e436f75780
commit
f249ba9edd
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "1.4.1",
|
"version": "1.4.2",
|
||||||
"name": "twemoji",
|
"name": "twemoji",
|
||||||
"license": ["MIT", "CC-BY-4.0"],
|
"license": ["MIT", "CC-BY-4.0"],
|
||||||
"description": "A Unicode standard based way to implement emoji across all platforms.",
|
"description": "A Unicode standard based way to implement emoji across all platforms.",
|
||||||
|
18
test.js
18
test.js
@ -535,4 +535,22 @@ wru.test([{
|
|||||||
wru.assert('nothing to do here');
|
wru.assert('nothing to do here');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
name: 'using a different onerror',
|
||||||
|
test: function () {
|
||||||
|
var Image = window.Image;
|
||||||
|
window.Image = function () {
|
||||||
|
var self = new Image;
|
||||||
|
setTimeout(function () {
|
||||||
|
window.Image = Image;
|
||||||
|
self.onerror();
|
||||||
|
}, 10);
|
||||||
|
return self;
|
||||||
|
};
|
||||||
|
var div = document.createElement('div');
|
||||||
|
div.innerHTML = '5\ufe0f\u20e3';
|
||||||
|
twemoji.parse(div, {onerror: wru.async(function () {
|
||||||
|
wru.assert('OK');
|
||||||
|
})});
|
||||||
|
}
|
||||||
}]);
|
}]);
|
@ -664,7 +664,7 @@ function createTwemoji(re) {
|
|||||||
);
|
);
|
||||||
if (src) {
|
if (src) {
|
||||||
img = new Image();
|
img = new Image();
|
||||||
img.onerror = twemoji.onerror;
|
img.onerror = options.onerror;
|
||||||
img.setAttribute('draggable', 'false');
|
img.setAttribute('draggable', 'false');
|
||||||
attrib = options.attributes(icon, variant);
|
attrib = options.attributes(icon, variant);
|
||||||
for (attrname in attrib) {
|
for (attrname in attrib) {
|
||||||
@ -828,7 +828,8 @@ function createTwemoji(re) {
|
|||||||
base: typeof how.base === 'string' ? how.base : twemoji.base,
|
base: typeof how.base === 'string' ? how.base : twemoji.base,
|
||||||
ext: how.ext || twemoji.ext,
|
ext: how.ext || twemoji.ext,
|
||||||
size: how.folder || toSizeSquaredAsset(how.size || twemoji.size),
|
size: how.folder || toSizeSquaredAsset(how.size || twemoji.size),
|
||||||
className: how.className || twemoji.className
|
className: how.className || twemoji.className,
|
||||||
|
onerror: how.onerror || twemoji.onerror
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
twemoji.min.js
vendored
2
twemoji.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user