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:
parent
2c4d66ec91
commit
ad1fc0e48d
@ -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};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user