1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-06-15 03:35:16 +00:00

Validate the first argument of parse method

The first argument type of `parse` method can only be of `String` or `HTML Element`.
This commit is contained in:
josephj 2016-04-04 22:24:55 +10:00
parent 2c4d66ec91
commit ad1fc0e48d

View File

@ -515,6 +515,14 @@ var twemoji = (function (
}
function parse(what, how) {
// first argument can only be string or HTML Element
if (
typeof what !== 'string' &&
!(what && what.nodeName)
) {
return what;
}
if (!how || typeof how === 'function') {
how = {callback: how};
}